Seite 318 von 342 ErsteErste ... 218 268 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 ... LetzteLetzte
Zeige Ergebnis 9.511 bis 9.540 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; Zitat von Freshmilk I'm a little lost. What exactly are you trying to do? You want it to display one ...

  
  1. #9511
    Points: 2.282, Level: 28
    Level completed: 88%, Points required for next Level: 18
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Oct 2008
    Beiträge
    18
    Points
    2.282
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Freshmilk Beitrag anzeigen
    I'm a little lost. What exactly are you trying to do? You want it to display one message whilst X isn't being held, and another whilst X is being held? Also, if so, why exactl yisn't it working, what's happening instead?
    No, I want it so that all I have to do is press X and it shows a different text.

    So say this is my menu.

    Menu Items:
    1.Say yes (when selected with X prints "Yes")
    2.Say no (when selected with X prints "No")
    3.Exit (exits the program obviously)

    Now, what im having trouble with is, when I select option 1 with X I have to hold X for the message "Yes" to stay on the screen. If i just press X the message "Yes" only stays on the screen for as long as I hold X.

    What im trying to accomplish, is when I press X I want the new message of "Yes" to stay on screen till say I press O or something, i dont know yet. But I do know that i dont want to have to hold X for the message to stay on screen.

    Get what im saying lol, its kind of hard to explain.



  2. #9512
    QJ Gamer Bronze
    Points: 5.583, Level: 48
    Level completed: 17%, Points required for next Level: 167
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    127
    Points
    5.583
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I'll bet your in a loop, and at the top of the loop is a screen clear, so when you hold X, its really clearing + displaying really quickly...

    but since you dont post any code we cant be sure...
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

    "Did IQ's just drop sharply while I was away?" (Ripley)

  3. #9513
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Freshmilk Beitrag anzeigen
    I'm a little lost. What exactly are you trying to do? You want it to display one message whilst X isn't being held, and another whilst X is being held? Also, if so, why exactl yisn't it working, what's happening instead?

    Also, on a different note, I wanted to ask if there is any way I could fade from one image to another in lua? I know how to fade an image out to black, and then the next in, but is there no way I could do it straight from one to another? Thanks in advance.
    To your question: Yes, talk to me on msn for various methods
    To original question:
    Code:
    displayText = false
    while true do
        screen:clear(Color.new(255,255,255))
        oldpad = pad
        pad = Controls.read
        if pad:cross() and not oldpad:cross() then
            displayText = not displayText
        end
        if displayText then
            screen:print(0,0,"Text is on")
        end
        screen.waitVblankStart()
        screen.flip()
    end
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  4. #9514
    Points: 2.282, Level: 28
    Level completed: 88%, Points required for next Level: 18
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Oct 2008
    Beiträge
    18
    Points
    2.282
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von TurtlesPwn Beitrag anzeigen
    talk to me on msn for various methods
    Well it seems that I will have to make a msn s/n, so I can get more help from you in the future if I need it :)

    I have yet to try your bit of code out but im sure it will help me lots :)

    Thanks :)
    Geändert von Nava (11-15-2008 um 10:31 AM Uhr) Grund: forgot something

  5. #9515
    Points: 2.282, Level: 28
    Level completed: 88%, Points required for next Level: 18
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Oct 2008
    Beiträge
    18
    Points
    2.282
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Well, that bit of code works but it doesnt work. Ill let you see for yourself whats going on while its being run.

    Note:You will see that with what I have in my code I am still experimenting with Lua, as I amstill learning, so bear with me if some of my choices in the menu dont make sense.
    Also, if your trying to run this code, put an image named image.jpg in the same folder as this .lua or it wont load properly.

    Code:
    image = Image.load("image.jpg")
    red = Color.new(255,0,0)
    black = Color.new(0,0,0)
    white = Color.new(255,255,255)
    menustatus = 1
    while true do
    screen:clear(black)
    pad = Controls.read()
    if pad:up() then
    menustatus = menustatus - 1
    screen.waitVblankStart(4)
    end
    if pad:down() then
    menustatus = menustatus + 1
    screen.waitVblankStart(4)
    end
    color={white, white, white, white, white, white}
    color[menustatus]=red
    screen:print(50, 50, "Display Text", color[1])
    screen:print(50, 60, "Info", color[2])
    screen:print(50, 70, "Display Image", color[3])
    screen:print(50, 80, "Screen Lock", color[4])
    screen:print(50, 90, "Test", color[5])
    screen:print(50, 100, "Exit", color[6])
    if menustatus == 1 then
        if pad:cross() then
        screen:clear(black)
        screen:print(50, 50, "Hey it worked!", color[1])
        end
    end
    if menustatus == 2 then
        if pad:cross() then
        screen:clear(black)
        screen:print(50, 50, "Created by Nava -C- 2008", red)
        end
    end
    if menustatus == 3 then
        if pad:cross() then
        screen:blit(0,0,image)
        end
    end
    if menustatus == 4 then
        if pad:cross() then
        screen:clear(black)
        screen:print(50, 50, "Can you figure out the password?", red)
        end
    end
    if menustatus == 5 then
        while true do
        displayText = false
        oldpad = pad
        pad = Controls.read()
        if pad:cross() and not oldpad:cross() then
            displayText = not displayText
        end
        if displayText then
            screen:print(50,50, "Hey it worked!", red)
        end
        screen:waitVblankStart()
        screen:flip()
        end
    end
    if menustatus <= 0 then
    menustatus = 6
    end
    if menustatus >= 7 then
    menustatus = 1
    end
    screen.flip()
    screen.waitVblankStart()
    end

  6. #9516
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    screen:clear() is defaulted to clear black, you don't really need that Or the created color unless you intend to use it.

  7. #9517
    QJ Gamer Green
    Points: 5.875, Level: 49
    Level completed: 63%, Points required for next Level: 75
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    In your pocket.
    Beiträge
    192
    Points
    5.875
    Level
    49
    My Mood
    Angelic
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    screen:clear() is defaulted to clear black, you don't really need that Or the created color unless you intend to use it.
    In the new lua you have to put "screen:clear(somethi ng)" in order for it to work. "0" can be put in there for black.
    AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13

  8. #9518
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Digikid13 Beitrag anzeigen
    In the new lua you have to put "screen:clear(somethi ng)" in order for it to work. "0" can be put in there for black.
    Well, thats just s*** it should be defaulted, you shouldn't have to put 0, or anything. I use PGE mostly now, so i wouldn't of known that, THAT has pge.gfx.clearscreen() -- defaulted to BLACK!!!!

  9. #9519
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Digikid13 Beitrag anzeigen
    In the new lua you have to put "screen:clear(somethi ng)" in order for it to work. "0" can be put in there for black.
    In the new lua? Do you even know what lua is?
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  10. #9520
    Seven Year Vet. BOW DOWN.
    Points: 14.794, Level: 78
    Level completed: 86%, Points required for next Level: 56
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    Manchester, UK
    Beiträge
    2.240
    Points
    14.794
    Level
    78
    My Mood
    Cheerful
    Downloads
    1
    Uploads
    0

    Standard

    How hard would it be for me to port an unindented 1,400-line game into PGE lua from Lua v0.16? And for the change in speed, would it be worth doing it?

  11. #9521
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    how complex is the code, what game is it, depends on the game.
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  12. #9522
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Hey people, I'm stuck with my game. The coding goes perfect but I want to make a option, that pauses the game if you press start. There's a lot of action in my game so
    I really do need a pause option so people can take a break, or just want to stop for a while.

    I searched google but didn't find anything.

    Something like this:

    Code:
    if pad:start() then
    --Pause Game (Show An Image And Pause Game)
    end

  13. #9523
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    u need to create a simple variable like so:
    pause = 1;

    than anything that increments simple multiply it by the pause variable
    and if u want to pause:
    Code:
    if pad:start() then
       --thanks dan for pointing out that it's ~, instead of !
       pause ~= pause;
    end
    and that creates the pause state, simple do an if pause==0 then //menu here
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  14. #9524
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Isn't '!pause' for C?
    In Lua it's '~=' So it would be
    Code:
     
    pause ~= pause;

  15. #9525
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    sorry, haven't used lua in a long time, it's why i said for someone to correct me if i'm wrong, and it's for many other languages than just C, but it's the major one for homebrew, so yes
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  16. #9526
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Does somebody know where I can find a sample, or post a sample?

    Is this code right:

    Code:
    if pad:start() then
    pause ~= pause;
    screen:blit("0,0, pause")
    end

  17. #9527
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von slicer4ever Beitrag anzeigen
    sorry, haven't used lua in a long time, it's why i said for someone to correct me if i'm wrong, and it's for many other languages than just C, but it's the major one for homebrew, so yes
    Thought so, using my very minimal knowledge of C.

  18. #9528
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von malliet Beitrag anzeigen
    Does somebody know where I can find a sample, or post a sample?

    Is this code right:

    Code:
    if pad:start() then
    pause ~= pause;
    screen:blit("0,0, pause")
    end
    no
    ------ FaT3oYCG -----
    AKA Craig, call me what you want to It's your preference.
    My Website: http://www.modern-gamer.co.uk/

    Currently working on:
    (0) MediaGrab
    (0) PGE Gears Of War - On hold (Very large project).
    (0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).

  19. #9529
    QJ Gamer Green
    Points: 3.721, Level: 38
    Level completed: 48%, Points required for next Level: 79
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Beiträge
    612
    Points
    3.721
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    pause = not pause
    [size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]

  20. #9530
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    I don't understand. How is the code got to be then?

  21. #9531
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Simple.
    Say you have a boolean called pause,
    then you have your if statement,
    Code:
     
    if press sumthing then
         pause = true
    end
    then another simple if statement
    Code:
    if pause then 
         blit watever
    end
    Basically if pause then do things, pause would either be true Or false. When you press say start it would make it true, then that if comes into play.
    Then have another If checking e.g
    Code:
     
    if pad:cross()  then
        pause = not pause 
    end
    if pause is true & you set it to not pause (or any boolean) then it basically means the opposite, so pause would be......... (i know but i want malliet to answer, see if he understands)

  22. #9532
    Points: 3.497, Level: 36
    Level completed: 98%, Points required for next Level: 3
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    In the heart of europe!
    Beiträge
    22
    Points
    3.497
    Level
    36
    Downloads
    0
    Uploads
    0

    Standard

    Hi there!

    Is there any way to merge the source of my lua game into the eboot.pbp? I don't want the people to complain about my style in writing games

    Thanks in advance!

  23. #9533
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    from: LUA development Help

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    it is hard to do and not really worth it, why did you want to do it anyway, to protect your source? well you can just open the eboot in a text editor and see the source anyway, use the lua compiler if that is what you want to do.
    and if you still want to do it:

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    *cough* my site
    *cough* link:
    *cough* http://gaming-network.ath.cx/Gaming-...a_compiler.rar

    hopefully that helps you, and next time try to search first=-), and lastly if you manage to accompalish what you wanted to do, than don't listen to people complaining about your code, it only happens if you release something really, really pointless, and easy to do with a few lines of lua
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  24. #9534
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Why don't you want people criticising your code? People don't just say "ZOMG HIS CODZ SUCK LOLOLO U SUCK!!!!!!!!!!!!!11111", most people will give you helpful suggestions and advice for improving yourself.

    Besides, if you have bad code and you just bytecode your app, people will then just complain about the fact that it is bytecoded.

  25. #9535
    Points: 3.497, Level: 36
    Level completed: 98%, Points required for next Level: 3
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    In the heart of europe!
    Beiträge
    22
    Points
    3.497
    Level
    36
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    Why don't you want people criticising your code? People don't just say "ZOMG HIS CODZ SUCK LOLOLO U SUCK!!!!!!!!!!!!!11111", most people will give you helpful suggestions and advice for improving yourself.

    Besides, if you have bad code and you just bytecode your app, people will then just complain about the fact that it is bytecoded.
    You're no help :P

  26. #9536
    Points: 2.231, Level: 28
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Dec 2008
    Beiträge
    27
    Points
    2.231
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    how do u load a .wav file in luaplayer? please help

  27. #9537
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KiNGxLeGiTx Beitrag anzeigen
    how do u load a .wav file in luaplayer? please help
    Code:
    nameofyourfile = Sound.load("ms0:/nameofyourfile.wav")
    
    nameofyourfile:play()

  28. #9538
    Points: 2.231, Level: 28
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Dec 2008
    Beiträge
    27
    Points
    2.231
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    thanks malliet :)
    -=Double Post Merge =-
    well now i have a problem my psp freezes look at my code please see if anythings wrong

    korn = Sound.load("Music/korn.wav")

    if pad:l() then
    korn:"without these quotes"play()
    end

    theres more code in between but these are what im haveing trouble with
    Geändert von KiNGxLeGiTx (12-05-2008 um 09:29 AM Uhr)

  29. #9539
    QJ Gamer Green
    Points: 3.567, Level: 37
    Level completed: 45%, Points required for next Level: 83
    Overall activity: 0%

    Registriert seit
    May 2008
    Ort
    The Netherlands
    Beiträge
    330
    Points
    3.567
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KiNGxLeGiTx Beitrag anzeigen
    thanks malliet :)
    -=Double Post Merge =-
    well now i have a problem my psp freezes look at my code please see if anythings wrong

    korn = Sound.load("Music/korn.wav")

    if pad:l() then
    korn:"without these quotes"play()
    end

    theres more code in between but these are what im haveing trouble with
    I don't see the problem. Which luaplayer do you use? And is your WAV file in the music map?

  30. #9540
    Points: 2.231, Level: 28
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Dec 2008
    Beiträge
    27
    Points
    2.231
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    i figured out what was wrong but i still need help its my wav file i loaded up another one and it worked but i cant get my korn.wav to work
    Geändert von KiNGxLeGiTx (12-05-2008 um 10:53 AM Uhr)


 

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 09:07 PM Uhr.

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