Seite 231 von 342 ErsteErste ... 131 181 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 281 331 ... LetzteLetzte
Zeige Ergebnis 6.901 bis 6.930 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; Ok i tried that table.remove and it didnt work, and now im stuck again...

  
  1. #6901
    QJ Gamer Gold
    Points: 11.942, Level: 71
    Level completed: 73%, Points required for next Level: 108
    Overall activity: 0%

    Registriert seit
    Nov 2006
    Ort
    ...
    Beiträge
    2.080
    Points
    11.942
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Ok i tried that table.remove and it didnt work, and now im stuck again



  2. #6902
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    How would I make an image stay.
    if pad:triangle() then
    screen:blit(0, 236, start, true)
    screen.flip()
    end

    That will work while I hold it down, but I want it to stay once its pressed once.

  3. #6903
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Urameshi
    Ok i tried that table.remove and it didnt work, and now im stuck again
    table.remove is so simple..
    -= Double Post =-
    Zitat Zitat von yumCOOKIEZZ
    How would I make an image stay.
    if pad:triangle() then
    screen:blit(0, 236, start, true)
    screen.flip()
    end

    That will work while I hold it down, but I want it to stay once its pressed once.
    Use a bool variable.
    Geändert von Yonathan_Jantis (04-17-2007 um 07:22 PM Uhr) Grund: Automerged Doublepost
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  4. #6904
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    aka if pad:triangle() then showtheimage = true end
    if showtheimage then screen:blit(x,y,theimage) end

  5. #6905
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Thanks ;D

    (I'm gonna try to cut down on questions -.-)
    -= Double Post =-
    When I did that it gives the same effect. The image is loading a lot of times and giving problemness.
    Geändert von yumCOOKIEZZ (04-17-2007 um 07:40 PM Uhr) Grund: Automerged Doublepost

  6. #6906
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    ..
    in the begining
    showstart = false

    ..main..

    showstart = pad:triangle() or showstart
    ...
    if showstart then screen:blit(0, 236, start, true) end
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  7. #6907
    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

    Yonathan - Wouldn't 'showstart = pad:triangle()' do the same as his first method (where it shows only when held), as if tirnagle isn't being pressed, than return false, making showstart false, making it not blit hte image...

    ...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


  8. #6908
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Yonathan - Wouldn't 'showstart = pad:triangle()' do the same as his first method (where it shows only when held), as if tirnagle isn't being pressed, than return false, making showstart false, making it not blit hte image...
    Read the whole thing..
    showstart = pad:triangle() or showstart

    btw this is youresam :P
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  9. #6909
    QJ Gamer Gold
    Points: 11.629, Level: 70
    Level completed: 95%, Points required for next Level: 21
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    1.633
    Points
    11.629
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    And since it's an or statement, only one part must be true to make it true. So if showstart is already true it will remain true.

  10. #6910
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    HIYA im back to the scene:)...

    can anyone tell me how to make a menu selector go to right and left instead of up and down? coz my app will make too many menu...;)

  11. #6911
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ai3gtmc
    HIYA im back to the scene:)...

    can anyone tell me how to make a menu selector go to right and left instead of up and down? coz my app will make too many menu...;)
    *sigh*
    Change the coordinates.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  12. #6912
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    I got what I wanted to work. When you scroll over the image, it will change. When you scroll off, it changes back. One problem is when ON the image itself theres a bit of lag and the cursor moves slowly. Is there any way to prevent this?

    I can still work around it but it would be helpful to fix.

  13. #6913
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Yonathan_Jantis
    *sigh*
    Change the coordinates.
    if i change coords i still need to use the up and down not right and left button right?>.<

  14. #6914
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yumCOOKIEZZ
    I got what I wanted to work. When you scroll over the image, it will change. When you scroll off, it changes back. One problem is when ON the image itself theres a bit of lag and the cursor moves slowly. Is there any way to prevent this?

    I can still work around it but it would be helpful to fix.
    Err...what?
    -= Double Post =-
    Zitat Zitat von ai3gtmc
    if i change coords i still need to use the up and down not right and left button right?>.<
    ...how are the buttons a problem??
    Geändert von Yonathan_Jantis (04-17-2007 um 08:49 PM Uhr) Grund: Automerged Doublepost
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  15. #6915
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    hmm my menu selection is a lil big.... so i want an up and down,left and right selection..

  16. #6916
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    oh, and, thats a bit more complicated
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  17. #6917
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    yeah lol thats y i asked.. if its just the coords i wont ask lol

  18. #6918
    QJ Gamer Blue
    Points: 3.525, Level: 37
    Level completed: 17%, Points required for next Level: 125
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    81
    Points
    3.525
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Yonathan_Jantis
    Err...what?
    -= Double Post =-

    ...how are the buttons a problem??

    Uhg...How do I explain it...

    There are 2 images. Exactly the same in size, shape, ect. Just some differing in colors. One will display no matter what. One will display when I scroll over to it. When the cursor (what I use to move with the analog) is over the image, the second image is written on top of the first.

    Why am I explaining?...Heres the code.
    showstart = false
    if x > 0 and x < 50 and y >236 and y < 272 then showstart = true end
    if x > 50 and y < 236 then showstart = false
    if showstart then
    starton = Image.load ("images/Start-Over.png")
    screen:blit (0, 236, starton, true)

    else
    screen:blit(0, 236, start, true)
    end

  19. #6919
    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

    tuhm... Simply change all 'down()' to 'left()' and all 'up()' to 'right()'. If you structure each menu option from left to right, you wont need to redo the entire menu code.

    Guy above me - its cause you continually load your Start-Over.png once on it. Simply move it out of the infinite loop, not in your if statement.

    ...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


  20. #6920
    QJ Gamer Green
    Points: 6.446, Level: 52
    Level completed: 48%, Points required for next Level: 104
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    beside my PC
    Beiträge
    520
    Points
    6.446
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    ok thx sg ill try after i buy a battery

  21. #6921
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Id like to take this opporuntity to draw back to my problem

    Code:
    function MedCol()
    for y=1,en_2 do
    for u=1,no_bull do
    if asteroidmed[y].x+24>bullet[u].x and asteroidmed[y].x<bullet[u].x+6 and asteroidmed[y].y+24>bullet[u].y and asteroidmed[y].y<bullet[u].y+6 then
    score=score+20
    asteroidsm[en_3+1]={x=asteroidmed[y].x, y=asteroidmed[y].y, width=32, height=32, vspeed=(math.random(0,1))-(math.random(0,2)), hspeed=(math.random(0,1))-(math.random(0,2))}
    en_3=en_3+1
    asteroidmed[y].x=489346983
    bullet[u].x=-99999999999
    end
    end
    end
    end
    I get an error that in the collision if "attempt to index field "?" null value". There is a asteroidmed array, en_2 is equal to 1, there are several bullets, no_bull is the amount of bullets, there is an asteroidmed[1] and it has x and y coordinates, same as the bullet. However i see no difference with this code and my other one:

    Code:
    function Collision()
    for f=1,en_1 do
    for g=1, no_bull do
    if asteroid[f].x+32>bullet[g].x and asteroid[f].x<bullet[g].x+6 and asteroid[f].y+32>bullet[g].y and asteroid[f].y<bullet[g].y+6 then
    score=score+20
    asteroid[en_2+1]={x=asteroid[f].x, y=asteroid[f].y, width=32, height=32, vspeed=(math.random(0,1))-(math.random(0,2)), hspeed=(math.random(0,1))-(math.random(0,2))}
    en_2=en_2+1
    asteroid[f].x=489346983
    bullet[g].x=-99999999999
    end
    end
    end
    end
    Apart from the names. any help?!

    I have tried a lot of things. What does the error mean? Uncalled table/variable?
    -= Double Post =-
    Never mind, I fixed that error (finally)
    Geändert von xmex (04-18-2007 um 12:47 AM Uhr) Grund: Automerged Doublepost

  22. #6922
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von ai3gtmc
    ok thx sg ill try after i buy a battery
    you can make menu with tables...

    so you will have only for example 5 lines on the screen which could be changed with left right

  23. #6923
    QJ Gamer Blue
    Points: 4.349, Level: 41
    Level completed: 99%, Points required for next Level: 1
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Upstate, NY USA
    Beiträge
    121
    Points
    4.349
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Could someone please explain how to make looping Backgrounds on a menu. Say 3 bgs' showing for 3 seconds a piece. If thats possible...

    Thanks for the help guys :)

  24. #6924
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    forget the fact that its a menu and ask yourself, how would I make a 3 frame animation? Theres craploads of tutorials out there that will help you with this, or look into the animlib.

  25. #6925
    Monster Masher
    Points: 5.084, Level: 45
    Level completed: 67%, Points required for next Level: 66
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Behind you...
    Beiträge
    265
    Points
    5.084
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Is there a way to draw an image at an angle?

  26. #6926
    QJ Gamer Blue
    Points: 4.349, Level: 41
    Level completed: 99%, Points required for next Level: 1
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Upstate, NY USA
    Beiträge
    121
    Points
    4.349
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KleptoOne
    forget the fact that its a menu and ask yourself, how would I make a 3 frame animation? Theres craploads of tutorials out there that will help you with this, or look into the animlib.

    Damn... In the time it took you to write that you could have just copy/pasted the code snippet for me...

    But I'll google animlib, to see what I can find out about it. Thanks for the heads up on that. :)

  27. #6927
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Not really, unless you texture the image to triangles using the GU, then you can scale and rotate all you want. The only way I know of to do it without the GU is to copy the image pixel by pixel, running it through an algorithm that will angle it, but this process is so slow that you would have to buffer the created images into some type of array and it would eat up your memory quick depending on the size of the image.
    -= Double Post =-
    Zitat Zitat von psp phd
    Damn... In the time it took you to write that you could have just copy/pasted the code snippet for me...

    But I'll google animlib, to see what I can find out about it. Thanks for the heads up on that. :)
    The reason I said that was because a lot of the newer programmers are getting lazy. When I was learning I would read everything I could get my hands on to figure something out, and if I needed help on something I always asked regarding the concept and not the code, because its the concepts that will allow you to jump into pretty much any language and be productive.
    Chances are you already realize this and you're just being lazy, which I understand, but I personally can't promote.
    Geändert von KleptoOne (04-18-2007 um 11:15 AM Uhr) Grund: Automerged Doublepost

  28. #6928
    QJ Gamer Blue
    Points: 4.349, Level: 41
    Level completed: 99%, Points required for next Level: 1
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Upstate, NY USA
    Beiträge
    121
    Points
    4.349
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von KleptoOne
    The reason I said that was because a lot of the newer programmers are getting lazy. When I was learning I would read everything I could get my hands on to figure something out, and if I needed help on something I always asked regarding the concept and not the code, because its the concepts that will allow you to jump into pretty much any language and be productive.
    Chances are you already realize this and you're just being lazy, which I understand, but I personally can't promote.

    Actually, I have wrote a simple project in LUA and have since decided to pick up C instead. (I just needed something to get my feet wet with all this)
    But - I thought it would be nice to do a 10 min. spiff up the lua project.

    Lua was good to get comfortable with the basic concepts of programming. But I don't want to stuff my brain up with a bunch of info I'm never going to use again. LOL. C is much different from Lua. And the rules of C are what I have begin studying. Why confuse myself with more Lua stuff? I just wanted a quick code snippet to polish up & end my lua project. Then I dont plan on using Lua anymore...


    EDIT: And I'm far from lazy bud... This is a hobby for me. I work 40+ hrs a week.

  29. #6929
    QJ Gamer Blue
    Points: 3.768, Level: 38
    Level completed: 79%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    70
    Points
    3.768
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    hii there people, im makings some test, and i im in a way to make more eficient process i have.... ok i have a value in a variable and i want another variable.. to be a poiter of the last one...soo..if:
    var1 = 10
    var2 = pointer of var1... then
    when i do var1 = 20.. var2 automatically takes the var1 value... how can i do that ?
    also i want to do this:
    var1 ={x=1,y=1}
    var2 ={x=2,y=2}
    var3 = {{pointer of var1},{pointer of var2}}
    soo when i change the values of var1.x the var3[1].x actomatically takes the value... how to do this in lua ? the point is that i wont redefine the var3 each time the others change his value.

  30. #6930
    Developer
    Points: 4.205, Level: 41
    Level completed: 28%, Points required for next Level: 145
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    San Diego
    Beiträge
    177
    Points
    4.205
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von psp phd
    Actually, I have wrote a simple project in LUA and have since decided to pick up C instead. (I just needed something to get my feet wet with all this)
    But - I thought it would be nice to do a 10 min. spiff up the lua project.

    Lua was good to get comfortable with the basic concepts of programming. But I don't want to stuff my brain up with a bunch of info I'm never going to use again. LOL. C is much different from Lua. And the rules of C are what I have begin studying. Why confuse myself with more Lua stuff? I just wanted a quick code snippet to polish up & end my lua project. Then I dont plan on using Lua anymore...


    EDIT: And I'm far from lazy bud... This is a hobby for me. I work 40+ hrs a week.
    A simple animation is the same regardless of the language that you use. You find a way to judge time and cycle through the images based on that. Also, none of us are being paid to do this, so given that its a hobby why would you want to cheat yourself of the learning process and ask for ready made code? I guarentee you that if you learned how to animate in lua, it would help you in C.


 

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 .