Seite 16 von 342 ErsteErste ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 66 116 ... LetzteLetzte
Zeige Ergebnis 451 bis 480 von 10238

Lua Programming Help Thread

This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I tried using functions. Thats when it isn't working. Hmm I'll just go over the code again. Thx though!...

  
  1. #451
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I tried using functions. Thats when it isn't working. Hmm I'll just go over the code again. Thx though!


    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  2. #452
    QJ Gamer Green
    Points: 6.520, Level: 52
    Level completed: 85%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Ort
    Sweden
    Beiträge
    460
    Points
    6.520
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    if pad:cross() then
    if menustatus == 0 then
    dofile("./data/game.lua")
    end
    I guess that this part should be more like this.

    Code:
    if pad:cross() and menustatus == 0 then
    		dofile("./data/game.lua")
    	end

  3. #453
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    That wasn't my code but soadnation's, but thx anyway =). BTW idon't really understand your piece of code, atleast i don't see how it would make your character jump. Im guessing yP is the jumpt variable. But i don't get the time thingies. So sorry can't help ya there.

    And i still don't get my code to run. Since i put those functions in it doesnt work. I don't get it. According to me theres nothing wrond, but yeah ofcourse there is. Is this a correct usage of the function command:

    function game()
    while true do
    ...... -- code here
    end
    end

    And can i go back to it like this:

    if pad:cross() then
    game()
    end


    Its a bit long sorry bout that.
    Altair

    EDIT: Ok got it to work but only because i changed the code to using while commands instead of function. I would still like to know if i use the function command correct though and what i coould have done wrong. Thx!
    Geändert von Altair (02-01-2006 um 02:03 PM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  4. #454
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von soadnation
    ok i pinpoted the problem down to exit funtion(if pad.start() break). when i delete4 it it lodss. kindof. when it loads it just freezes right away this i have no idea what could be causeing it.
    This is a fixed version of your code.
    Code:
    green = Color.new(0, 255, 0)
    color = Color.new(255, 255, 255)
    menustatus=0
    
    while true do
    --set menu option
    --Select Options
    pad = Controls.read()
    if pad:down() then
    	menustatus = menustatus + 1
    screen.waitVblankStart(10)
    end
    if pad:up() then
    	menustatus = menustatus - 1
    screen.waitVblankStart(10)
    end
    
    if pad:cross() and
    	menustatus == 0 then
    		dofile("./index.lua")
    	end
    	if menustatus == 2 and pad:cross() then
    		break
    	end
    --Make Menu
    if menustatus == 0 then
    	screen:print(160, 100, "Play", color)
    	screen:print(160, 120, "Info", green)
    	screen:print(160, 140, "Exit", green)
    	screen.flip()
    end
    
    if menustatus == 1 then
    	screen:print(160, 100, "Play", green)
    	screen:print(160, 120, "Info", color)
    	screen:print(160, 140, "Exit", green)
    	screen.flip()
    end
    
    if menustatus == 2 then
    	screen:print(160, 100, "Play", green)
    	screen:print(160, 120, "Info", green)
    	screen:print(160, 140, "Exit", color)
    	screen.flip()
    end
    if menustatus == -1 then
    menustatus = menustatus +3
    end
    if menustatus == 3 then
    menustatus = menustatus -3
    end
    end
    I Deleted everything that wasnt needed
    Because you had alot of stuff that wasnt needed at all lol.
    Anyway i hope you like it and i made it possible
    to select "EXIT" and then press cross to exit lol.

    EDIT:
    I Added the bit where you are at "Play" and then
    press up and you select EXIT...
    Anyway please say thanks when you drop by :icon_bigg
    Geändert von c5cha7 (02-01-2006 um 02:56 PM Uhr)
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  5. #455
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    sweet thanks alot. i was starting to think i should just ask someoene if i could use there menu. anyways now i just need to get started on the game part. it should be pretty easy exept for one part but ill ask for help when i get to it.

    quick question. ive been looking at some other apps and they use dofile to load stuff like all the colors, in game menu's, or like in acno's energizer he loads the dig funtion.do i have to do anything special for that or can i just load then in the begining of the script?
    Geändert von soadnation (02-01-2006 um 04:26 PM Uhr)

  6. #456
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von soadnation
    sweet thanks alot. i was starting to think i should just ask someoene if i could use there menu. anyways now i just need to get started on the game part. it should be pretty easy exept for one part but ill ask for help when i get to it.

    quick question. ive been looking at some other apps and they use dofile to load stuff like all the colors, in game menu's, or like in acno's energizer he loads the dig funtion.do i have to do anything special for that or can i just load then in the begining of the script?
    You do know that you dont need to load a new script
    from the menu?? You can just add your script to the menu
    along with options etc..
    I Could probally show you an example but i aint
    so good at menu's yet (even though i fixed yours??? lol).

    Anyway i think "dofile" is mainly for loading a new lua script.
    Or you could probally use it to load addons etc..
    I hope that clear's something on your todo list lol...

    Good Luck :icon_smil
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  7. #457
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Well i have some sort of a basic menu, but it's in the main code. So if that's your question then no you don't have to use dofile. The only use i can think of it's easy to keep track of the different parts of code. Also its easy to change between different pieces of code: you can just rename the files.
    Anyway i dont need it yet.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  8. #458
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    @HaxxBlaster:
    I don't know how you want to code the jump, but i was thinking:

    Just have a variable say z. Where z is the jump height. And if z increase you just make some anymation of a jump that plays at the same time. Increasing the z and then decreasing it when it reaches a certain value shouldn't be that hard. I don't really know how to make an animation of different images, but it shows you how to here (its at the last part) .
    You probably have something like this, i guess. But if not then maybe this is a solution?

    Altair


    EDIT:
    I see you did what i said sort of. But you can also do it like this, without the time variable, so its shorter:

    Code:
    if pad:cross() then
    
    while i < 140 do -- or you can use "for ...." etc.
    
    if i<71 then -- so till 70
    yP = yP - 1
    end
    if i > 70 then -- so from 71
    yP = yP +1
    end
    
    i=i+1
    
    end -- end while
    end -- end if pad:cross()
    Geändert von Altair (02-02-2006 um 08:01 AM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  9. #459
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    c5cha7, does the 10 in "screen.waitVblankStart(1 0 )" mean it waits 10 times the whole cycle or 10 seconds or something completly different?
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  10. #460
    QJ Gamer Blue
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    USA
    Beiträge
    214
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    c5cha7, does the 10 in "screen.waitVblankStart(1 0 )" mean it waits 10 times the whole cycle or 10 seconds or something completly different?
    60=one second so that makes it wait about a 6th of a second

  11. #461
    QJ Gamer Blue
    Points: 5.594, Level: 48
    Level completed: 22%, Points required for next Level: 156
    Overall activity: 0%

    Registriert seit
    Aug 2005
    Ort
    USA
    Beiträge
    214
    Points
    5.594
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    how would you make it so if x=5 then score+1 when x is pushed? i tried this but it didnt work
    if pad:cross() then
    screen:blit(184, 213, mallet)
    screen.flip()
    if count = 6 then
    score = score + 1
    end

  12. #462
    QJ Gamer Green
    Points: 13.310, Level: 75
    Level completed: 15%, Points required for next Level: 340
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Here
    Beiträge
    2.715
    Points
    13.310
    Level
    75
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sofa king dumb
    how would you make it so if x=5 then score+1 when x is pushed? i tried this but it didnt work
    if pad:cross() then
    screen:blit(184, 213, mallet)
    screen.flip()
    if count = 6 then
    score = score + 1
    end
    first off, i'm not an experienced coder. (see my sig?) so if someone else comes with a possible solution, ignore me and listen to them, but i'll still try to help.

    from what i see, the problem is what i dont see. your code doesnt mention 5 anywhere. i assume what you want is for the "count" to reach 6.

    so this what i think you should do:

    if pad:cross() then
    screen:blit(184, 213, mallet)
    screen.flip()
    if count = 5 then --simply change 6 to 5.
    score = score + 1
    end
    [CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]

  13. #463
    11th Squad Captain
    Points: 26.490, Level: 97
    Level completed: 14%, Points required for next Level: 860
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    You are here -----> 名前: アダム | 飲むコー&#1
    Beiträge
    2.562
    Points
    26.490
    Level
    97
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    c5cha7, does the 10 in "screen.waitVblankStart(1 0 )" mean it waits 10 times the whole cycle or 10 seconds or something completly different?
    60 = 1 second so 10 equal's 10 Mini sec's or whatever lol...
    I just did that because it flicks past the menu too fast so you
    wouldnt off been able to select anything ;) .
    FAVORITE GAME! - BEER & ANIME! - SO EXICTING!

    開発者, 携帯用プログラマー 日本サポータおよび恋人 本名のアダムの鍛冶屋
    Currently Working On: - Flashmod V2.50 - Flashmod V2.60
    Currently Drinking: Coffee! - 私はコーヒーを飲む
    Chao Garden: DEMO v0.6
    Chao Garden V0.5b Review!

  14. #464
    QJ Gamer Bronze
    Points: 5.975, Level: 50
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Alabama
    Beiträge
    272
    Points
    5.975
    Level
    50
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sofa king dumb
    how would you make it so if x=5 then score+1 when x is pushed? i tried this but it didnt work
    if pad:cross() then
    screen:blit(184, 213, mallet)
    screen.flip()
    if count = 6 then
    score = score + 1
    end
    Explain more about what you are doing... also show more of your code.
    and to compare you use ==
    = is an assignment operator
    if count == 6 is how you would check for that.

    You said earlier you wanted to know how would you make it so if x=5 then score+1 when x is pushed
    Code:
    if pad:cross() and x == 5 then
      screen:blit(184, 213, mallet)
      score = score + 1
    end
    If you have a main loop the screen.flip() should be at the bottom of your main loop.
    Geändert von PSPMillionaire (02-02-2006 um 03:22 PM Uhr)
    My lua tutorials for PSP - www.evilmana.com/tutorials
    PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/

  15. #465
    QJ Gamer Blue
    Points: 5.631, Level: 48
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Beiträge
    375
    Points
    5.631
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    @HaxxBlaster:
    I don't know how you want to code the jump, but i was thinking:

    Just have a variable say z. Where z is the jump height. And if z increase you just make some anymation of a jump that plays at the same time. Increasing the z and then decreasing it when it reaches a certain value shouldn't be that hard. I don't really know how to make an animation of different images, but it shows you how to here (its at the last part) .
    You probably have something like this, i guess. But if not then maybe this is a solution?

    Altair


    EDIT:
    I see you did what i said sort of. But you can also do it like this, without the time variable, so its shorter:

    Code:
    if pad:cross() then
    
    while i < 140 do -- or you can use "for ...." etc.
    
    if i<71 then -- so till 70
    yP = yP - 1
    end
    if i > 70 then -- so from 71
    yP = yP +1
    end
    
    i=i+1
    
    end -- end while
    end -- end if pad:cross()
    i just want to do a dofile because it makes things seem more organized to me. in my vb programing class once im done with the basics i spend mroe time making it look nicer and more organized then i do on fixing it up.

    now for the reason why i quoted. i was wondering if this would work(the part about juust having a Z variable for jumping)

  16. #466
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    well it works (i think, i haven't tried it yet), but it wont change the position of the character. By z i meant another variable than x and y, which i, and i think most people, use for the x and y coordinates. The z variable is just there so you can compare the z of the character and the z of the thing you are jumping over (if you have assigned it a specific z value). If you just want the jump animation, then just use the animation.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  17. #467
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Thx both sofa king dumb and c5cha7, for explaining!
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  18. #468
    Points: 4.478, Level: 42
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    7
    Points
    4.478
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Im trying to create a stopwatch for my psp but I've run into a few problems maybe some of you guys could help me out. I've been using MagicianFB's timer example that was posted earlier in this thread but I've run into a few problems. Most importantly is that after 15min or so it 'breaks', it displays 63 minutes and every minute after that it goes it subtracts a minute instead of adding one (62, 61, 60, 59 and so on) Anyone know a way to fix it or have an example of another timer? Here is the example I've been using:

    Code:
    -- Define Colors
    white = Color.new(255, 255, 255)
    yellow = Color.new(255, 255, 0)
    
    -- Print Instructions
    screen:print(5, 5, "Press L to begin and R to stop.", yellow)
    screen:flip()
    
    -- Create Timer
    Timer = Timer.new(0)
    
    -- Start Main Program
    while true do
    	screen.waitVblankStart(5)  
    	pad = Controls.read()
    	if pad:l() then
    		Timer:reset()
    		Timer:start()
    		while true do
    			pad = Controls.read()
    			screen:clear()
    			screen:print(5, 5, "Press L to begin and R to stop.", yellow)
    			screen:print(220, 133, tostring(math.floor(Timer  :time()/1000/60) .. ":" .. math.floor((Timer:time()/1000/60-math.floor(Timer:time()/1000/60))*60) .. ":" .. string.sub(tostring(math.  floor(Timer:time()/10)), -2)), white)
    			screen:flip()
    			if pad:r() then
    				Timer:stop()
    				break
    			end
    		end
    	elseif pad:start() then
    		break
    	elseif pad:select() then
    		screen:save("screenshot.png")
    	end
    end

  19. #469
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Which example is that? Can you post a link? Oh and there is a stopwatch example in the sample applications that come whith LUA.

    EDIT:
    Ok i think i have something here:

    Code:
    screen:print(220, 133, tostring(math.floor(Timer    :time()/1000/60) .. ":" .. math.floor((Timer:time()/1000/60-math.floor(Timer:time()/1000/60))*60) .. ":" .. string.sub(tostring(math.    floor(Timer:time()/10)), -2)), white)
    should be:
    Code:
    screen:print(220, 133, tostring(math.floor(Timer:time()/1000/60) .. ":" .. math.floor((Timer:time()/100)/10) .. ":" .. math.floor(Timer:time()/10)), white)
    Idon't think you need the "tostring" part aswell. I just don't know if it's possible to display multiple variables then, but probably you can.
    Geändert von Altair (02-03-2006 um 04:32 AM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  20. #470
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Could someone explain what the command "local" means? I sometimes see it in front of some variables i think.
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  21. #471
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    W00t!!! I finished my little test game! Its for some reason really addictive, eventhough it's a really stupid game. Its sort of an analog-skillz-trainer. You have to move a really small cursor over a really small target :) .
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  22. #472
    Points: 4.478, Level: 42
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Beiträge
    7
    Points
    4.478
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    Which example is that? Can you post a link? Oh and there is a stopwatch example in the sample applications that come whith LUA.

    EDIT:
    Ok i think i have something here:

    Code:
    screen:print(220, 133, tostring(math.floor(Timer    :time()/1000/60) .. ":" .. math.floor((Timer:time()/1000/60-math.floor(Timer:time()/1000/60))*60) .. ":" .. string.sub(tostring(math.    floor(Timer:time()/10)), -2)), white)
    should be:
    Code:
    screen:print(220, 133, tostring(math.floor(Timer:time()/1000/60) .. ":" .. math.floor((Timer:time()/100)/10) .. ":" .. math.floor(Timer:time()/10)), white)
    Idon't think you need the "tostring" part aswell. I just don't know if it's possible to display multiple variables then, but probably you can.


    I used the code you gave me but it still breaks.... around 8 minutes

  23. #473
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Altair
    c5cha7, does the 10 in "screen.waitVblankStart(1 0 )" mean it waits 10 times the whole cycle or 10 seconds or something completly different?
    technically, it waits 10 vertical blanks, which are how many times the processor refreshes the screen with what you said, so if you wanted some image to display for 5 seconds, than blit the image or w/e and put Screen.waitVblankStart(60 * 5)

    its much easier just to have the psp do the math then have u, look in my other tread about me doing my homewokr in C/C++, youll see in my code (if u understand C/c++ that all i had to know was the procedure inwhich to do the problem, so if it was -x^2 (-x squared), you would do

    Code:
    x = pi;
    x * x * -1 = y;
    return y;
    thats c/c++ simple functions on a graph, meaning the function is x squared then to its opposite, when x = pi, and earlier, pi was defined

    you also could do it this way
    Code:
    x = pi;
    x^2 = y;
    return y;
    Geändert von SG57 (02-03-2006 um 11:08 PM Uhr)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  24. #474
    QJ Gamer Silver
    Points: 7.109, Level: 55
    Level completed: 80%, Points required for next Level: 41
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Puerto Rico
    Beiträge
    310
    Points
    7.109
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    The damn thing does not work.I'm using lua player 1.15. I'm just playing around with it. I just want to show a pic and display a some words.Lession one basics, but it doesn't work.Is it ok?This is my code:

    testing---------------

    black=Color.new(0,0,0)

    background=Image.load("ba ckground.png")


    screen:blit(0,0,backgroun d,false)
    screen.waitVblankStart()
    screen.flip()
    end

    screenrint(200,130,"It worked Finally",black)
    screen:flip()
    while true do
    screen.waitVblankStart()
    end
    end

  25. #475
    Points: 4.168, Level: 41
    Level completed: 9%, Points required for next Level: 182
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    5
    Points
    4.168
    Level
    41
    Downloads
    0
    Uploads
    0

    Talking

    Hi everyone I'm new here and i need a little help.Does someone know how can i create a slideshow with sound and can you upload me the index.lua(1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg and sound.wav)Please help

  26. #476
    QJ Gamer Green
    Points: 6.721, Level: 53
    Level completed: 86%, Points required for next Level: 29
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    543
    Points
    6.721
    Level
    53
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    black=Color.new(0,0,0)
    background1=Image.load("1.jpg")
     background2=Image.load("2.jpg")
     background3=Image.load("3.jpg")
     background4=Image.load("4.jpg")
     background5=Image.load("5.jpg")
     sound=Sound.load("sound.wav")
    while true do
    screen:clear(black)
    sound:play()
    if stage==1 then
    screen:blit(backround1)
    stage=2
    elseif stage==2
    screen:blit(backround2)
    stage=3
    elseif stage==3
    screen:blit(backround3)
     stage=4
    elseif stage==4
    screen:blit(backround4)
     stage=5
    elseif stage==5
    screen:blit(backround5)
     stage=6
    elseif stage==6
    screen:blit(backround2)
     stage=1
    end
    screen.waitVblankStart(90)
    screen.flip()
    end
    that might work.....
    HELP ME HAIRY LEG!!!!

    I have a 1.5 (downgraded) US PSP
    [code]
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
    ( P | S | P | - | P | r | o | g | r | a | m | m | i | n | g )
    \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
    _ _ _ _ _
    / \ / \ / \ / \ / \
    ( A | d | m | i | n )
    \_/ \_/ \_/ \_/ \_/ [/code]

  27. #477
    Points: 4.168, Level: 41
    Level completed: 9%, Points required for next Level: 182
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    5
    Points
    4.168
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    I doesnt work but thanks anyway,does anyone else know?

  28. #478
    QJ Gamer Silver
    Points: 7.109, Level: 55
    Level completed: 80%, Points required for next Level: 41
    Overall activity: 0%

    Registriert seit
    Jun 2005
    Ort
    Puerto Rico
    Beiträge
    310
    Points
    7.109
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Is my code able to work of not? If not why?

  29. #479
    QJ Gamer Green
    Points: 5.559, Level: 48
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    506
    Points
    5.559
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    @ KKDDKK:
    Nathan's code is almost right he just forgot to state that "stage =1" at the beginning. That's why it doesn't work because stage is never equal to 1, so it never starts (duh). So just add stage=1 at the beginning.
    EDIT: Also change the "backround"'s to "background"'s hehe that might help hehe :P

    @shadow-evillink:
    Is this your complete code?

    Code:
    testing---------------
     
     black=Color.new(0,0,0)
     
     background=Image.load("background.png")
     
     
     screen:blit(0,0,backgroun d,false)
     screen.waitVblankStart()
     screen.flip()
     end
     
     screenrint(200,130,"It worked Finally",black)
     screen:flip()
     while true do
     screen.waitVblankStart()
     end
     end
    if so then it should be:
    Code:
     black=Color.new(0,0,0)
     background=Image.load("background.png")
     screen:blit(0,0,background,false)
     screenrint(200,130,"It worked Finally",black)
    
     while true do
     screen.waitVblankStart()
     screen:flip()
     end
    The thing you did wrong was that you put in an "end" while there wasn't any if/while/for/etc. command in fornt of it. Also you have a lot of waitVblankstart's and screenflips, but that should still work, i think.
    Geändert von Altair (02-05-2006 um 07:35 AM Uhr)
    LUA manual:
    [url]http://www.lua.org/manual/5.0/manual.html[/url]

    LUA Wiki:
    [url]http://wiki.ps2dev.org/psp:lua_player[/url]

  30. #480
    Points: 4.168, Level: 41
    Level completed: 9%, Points required for next Level: 182
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Beiträge
    5
    Points
    4.168
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    stage =1
    black=Color.new(0,0,0)
    background1=Image.load("1.jpg")
     background2=Image.load("2.jpg")
     background3=Image.load("3.jpg")
     background4=Image.load("4.jpg")
     background5=Image.load("5.jpg")
     sound=Sound.load("sound.wav")
    while true do
    screen:clear(black)
    sound:play()
    if stage==1 then
    screen:blit(background1)
    stage=2
    elseif stage==2
    screen:blit(background2)
    stage=3
    elseif stage==3
    screen:blit(background3)
     stage=4
    elseif stage==4
    screen:blit(background4)
     stage=5
    elseif stage==5
    screen:blit(background5)
     stage=6
    elseif stage==6
    screen:blit(background2)
     stage=1
    end
    screen.waitVblankStart(90  )
    screen.flip()
    end
    I edited it like this but it shows Error: index.lua:16: 'then' expect near 'screen'
    Error: No script file found
    Can someone please upload the whole document but the working one


 
Seite 16 von 342 ErsteErste ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 66 116 ... LetzteLetzte

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 08:58 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .