Seite 223 von 342 ErsteErste ... 123 173 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 273 323 ... LetzteLetzte
Zeige Ergebnis 6.661 bis 6.690 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; LOL, today seems to be "hate animlib day" heh. BAN ON ANIMLIB!! (JK!!)...

  
  1. #6661
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    LOL, today seems to be "hate animlib day" heh.

    BAN ON ANIMLIB!! (JK!!)


    --------------------------------------------------------------------------------------

  2. #6662
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    i actually like it because i can do an animation in two lines which kicks a$$

  3. #6663
    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

    actually i dont like animLib on like walking animations, but on other animation animLib saves the day

  4. #6664
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Which string function counts how many times a letter occurs in that string (if such a function exists). For example: string.getnum(mystring,"\ n") would count how many newlines in a string.

  5. #6665
    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

    You gotta write it yourself.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  6. #6666
    QJ Gamer Blue
    Points: 3.680, Level: 38
    Level completed: 20%, Points required for next Level: 120
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    172
    Points
    3.680
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    in c/c++ there is a command in the string.h library(don't remeber it off hand)

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

    but this is lua

  8. #6668
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    almost done...
    --------------------------------------------------------------------------------------

  9. #6669
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Any idea on how I could do this youresam? You've probably done something like this before I suppose?
    EDIT: Nevermind, I know how.

  10. #6670
    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

    bleh?
    total = 0
    for a=1,string.len(str) do
    if string.sub(str,a,a) == char then total = total + 1 end
    end
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  11. #6671
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    bleh?
    total = 0
    for a=1,string.len(str) do
    if string.sub(str,a,a) == char then total = total + 1 end
    end
    Mine was:
    lastenter = string.find(currenttext," \n",0)
    numenter = 0
    function NumEnters( )
    lastenter = string.find(currenttext," \n",lastenter)
    if lastenter ~= nil then
    numenter = numenter + 1
    end
    end

  12. #6672
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    dofile("animLib.lua")
    
    standright = SS.new("jackstandright", "png", 24, 50, "images/jack/")
    standleft = SS.new("jackstandleft", "png", 24, 50, "images/jack/")
    runright = SS.new("jackrunright", "png", 64, 48, "images/jack/")
    runleft = SS.new("jackrunleft", "png", 64, 48, "images/jack/")
    
    pad = Controls.read()
    
    player = {}
    player.x = 20
    player.y = 210
    player.state = "standRight" -- ditch the img, use states --
    
    -- NOTE: oldpad isnt necessary. --
    
    while true do
    
    screen:clear()
    
    -- NOW, the part you're having trouble with --
    
    if pad:right() then -- if RIGHT is pressed --
    	player.state = "runRight"
    	player.x = player.x + 7
    elseif pad:left() then -- if LEFT is pressed --
    	player.state = "runLeft"
    	player.x = player.x - 7
    else -- meaning NEITHER IS PRESSED --
    	if  player.state == "runRight" then -- if he was running right before --
    		player.state = "standRight" -- then he is standing right --
    	elseif player.state == "runLeft" then -- same as above --
    		player.state = "standLeft"
    	end
    end
    
    -- draw animation --
    if player.state == "runRight" then
         runright:blit(player.x, player.y, 50)
    elseif player.state == "standRight" then
         standright:blit(player.x, player.y, 50)
    elseif player.state == "runLeft" then
         runleft:blit(player.x, player.y, 50)
    elseif player.state == "standLeft" then
         standleft:blit(player.x, player.y, 50)
    end
    
    screen.waitVblankStart()
    screen.flip()
    end
    Geändert von Grimfate126 (04-07-2007 um 07:57 PM Uhr)
    --------------------------------------------------------------------------------------

  13. #6673
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    I haven't checked it but should work (I hope).

  14. #6674
    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 romulator
    Mine was:
    lastenter = string.find(currenttext," \n",0)
    numenter = 0
    function NumEnters( )
    lastenter = string.find(currenttext," \n",lastenter)
    if lastenter ~= nil then
    numenter = numenter + 1
    end
    end
    That would be the proper way to do it. Except you forgot to loop it
    -= Double Post =-
    Grim you know you could replace the states with the images, would make it a lot easier to blit.
    Geändert von youresam (04-07-2007 um 07:50 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. #6675
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    Grim you know you could replace the states with the images, would make it a lot easier to blit.
    yea, why did you switch to states? You said it was easier in that code but i don't see how.

  16. #6676
    QJ Gamer Blue
    Points: 4.412, Level: 42
    Level completed: 31%, Points required for next Level: 138
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    Tokoroa, New Zealand
    Beiträge
    103
    Points
    4.412
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Oh yeah woops. Well its good to know I was on the right track.

  17. #6677
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    if pad:buttons() > 0 then
    lol, i just made a script of:
    Code:
    while true do
    	screen:clear()
    	pad = Controls.read()
    	screen:print(100,100,pad:buttons(),Color.new(255,255,255))
    	screen.flip()
    	screen.waitVblankStart()
    end
    and it turns out pressing cross == 16384

  18. #6678
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von emericaska8r
    yea, why did you switch to states? You said it was easier in that code but i don't see how.
    im simply thinking for a long term solution. suppose you had a player image (which is treated like a state) and you didnt have an animation for it. (believe me, it does happen. such as: player.img = dead) if you did that, you would need an animation for every single state. on the other hand, using states seperately gives you the freedom to not have to use animations for everything. sure, the blitting is a bit tedious, but its ultimately the better choice.
    --------------------------------------------------------------------------------------

  19. #6679
    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 emericaska8r
    lol, i just made a script of:
    Code:
    while true do
    	screen:clear()
    	pad = Controls.read()
    	screen:print(100,100,pad:buttons(),Color.new(255,255,255))
    	screen.flip()
    	screen.waitVblankStart()
    end
    and it turns out pressing cross == 16384
    Wait a minute, Controls:buttons() returns the C variable of the pad?
    I shoulda guessed that, since there is no "total buttons" variable. So yeah, I guess you can use bitmasks in lua for buttons
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  20. #6680
    QJ Gamer Gold
    Points: 12.189, Level: 72
    Level completed: 35%, Points required for next Level: 261
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Under Your Bed
    Beiträge
    3.083
    Points
    12.189
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Does anybody know where to get an lrx or something w/ zip compress and uncompress abilities

  21. #6681
    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

    someone wrote a lib in lua that does it btw
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  22. #6682
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    my god, animlib is getting complicated with my demands

  23. #6683
    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

    how come this doesnt work:

    Code:
    if collision(Player,Enemy) then
    screen.waitVblankStart(300)
    screen:blit(0,0,next)
    level2()
    end
    when Player collides with Enemy i want it to wait 5 seconds and blit the image next then go to level2() but it just pauses then goes to level2 without blitting the image:Argh: :Argh:

  24. #6684
    QJ Gamer Blue
    Points: 4.369, Level: 42
    Level completed: 10%, Points required for next Level: 181
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    246
    Points
    4.369
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Oh god, that's so easy.

    Just take a look at your code again and really think about what you've written, if you still can't figure it out...

  25. #6685
    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

    if collision(Player,Enemy) then
    screen:blit(0,0,next)
    screen.flip()
    screen.waitVblankStart(30 0)
    level2()
    end

  26. #6686
    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

    Zitat Zitat von myschoo
    if collision(Player,Enemy) then
    screen:blit(0,0,next)
    screen.flip()
    screen.waitVblankStart(30 0)
    level2()
    end
    thanks dude, i dont know why, but when i tried that earlier it didnt work

  27. #6687
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    r u done grim?
    Geändert von moncristo_da_dev (04-08-2007 um 11:39 AM Uhr)

  28. #6688
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von moncristo_da_dev
    r u done grim?
    i posted it yesterday... here:
    Code:
    dofile("animLib.lua")
    
    standright = SS.new("jackstandright", "png", 24, 50, "images/jack/")
    standleft = SS.new("jackstandleft", "png", 24, 50, "images/jack/")
    runright = SS.new("jackrunright", "png", 64, 48, "images/jack/")
    runleft = SS.new("jackrunleft", "png", 64, 48, "images/jack/")
    
    pad = Controls.read()
    
    player = {}
    player.x = 20
    player.y = 210
    player.state = "standRight" -- ditch the img, use states --
    
    -- NOTE: oldpad isnt necessary. --
    
    while true do
    
    screen:clear()
    
    -- NOW, the part you're having trouble with --
    
    if pad:right() then -- if RIGHT is pressed --
    	player.state = "runRight"
    	player.x = player.x + 7
    elseif pad:left() then -- if LEFT is pressed --
    	player.state = "runLeft"
    	player.x = player.x - 7
    else -- meaning NEITHER IS PRESSED --
    	if  player.state == "runRight" then -- if he was running right before --
    		player.state = "standRight" -- then he is standing right --
    	elseif player.state == "runLeft" then -- same as above --
    		player.state = "standLeft"
    	end
    end
    
    -- draw animation --
    if player.state == "runRight" then
         runright:blit(player.x, player.y, 50)
    elseif player.state == "standRight" then
         standright:blit(player.x, player.y, 50)
    elseif player.state == "runLeft" then
         runleft:blit(player.x, player.y, 50)
    elseif player.state == "standLeft" then
         standleft:blit(player.x, player.y, 50)
    end
    
    screen.waitVblankStart()
    screen.flip()
    end
    --------------------------------------------------------------------------------------

  29. #6689
    QJ Gamer Blue
    Points: 3.689, Level: 38
    Level completed: 26%, Points required for next Level: 111
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    168
    Points
    3.689
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    now it doesn't move but i get the idea thanks

  30. #6690
    QJ Gamer Blue
    Points: 4.561, Level: 43
    Level completed: 6%, Points required for next Level: 189
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    224
    Points
    4.561
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    Wait a minute, Controls:buttons() returns the C variable of the pad?
    I shoulda guessed that, since there is no "total buttons" variable. So yeah, I guess you can use bitmasks in lua for buttons
    whats a bitmask?


 

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

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