Seite 216 von 342 ErsteErste ... 116 166 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 266 316 ... LetzteLetzte
Zeige Ergebnis 6.451 bis 6.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; Zitat von superbatxs Sorry, i have to be honest. I wasn't thinking properly....just typing while i was doing my math ...

  
  1. #6451
    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 superbatxs
    Sorry, i have to be honest. I wasn't thinking properly....just typing while i was doing my math homework (or was I.....?). Honestly, i do use "else if" in my menu code in C.
    if you say so. But your excuse seems a little shabby. bah.


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

  2. #6452
    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 Anti-QJ
    I just didn't like how he said " "if" is less code then "elseif" "
    That just seems like something a nub would say.

    BTW, Doesn't this look nice?
    Code:
    if x == 2 then
    	blah
    		end
    			elseif x == 3 then
    	blah	
    		end
    			elseif x == 4 then
    	blah
    end
    Why in the world did i say that?
    Because i think super should learn how to indent.
    Uhm, i hope you realize you have like 5 indeitations for the if statement, than 2 for the code to execure, then 1 for hte end... That is quite random (to me) and will be unreadable in any semi-large project.

    Personally, my indentations are 2-5 spaces.
    Code:
    int main() {
       for(;;) {
          if(condtion is true) { 
             break;
          }
       }
       return 0;
    }

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


  3. #6453
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Uhm, i hope you realize you have like 5 indeitations for the if statement, than 2 for the code to execure, then 1 for hte end... That is quite random (to me) and will be unreadable in any semi-large project.

    Personally, my indentations are 2-5 spaces.
    Code:
    int main() {
       for(;;) {
          if(condtion is true) { 
             break;
          }
       }
       return 0;
    }
    Yea, the code that you just posted ( for(;;) { ) is exactly what i am using for the G-Pack's credit loading screens. It works very very well, and i greatly thank psp-programming for that. Lol, i didn't know they had that in lua because i never actually coded in lua well enough to use it.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  4. #6454
    QJ Gamer Blue
    Points: 3.749, Level: 38
    Level completed: 66%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    140
    Points
    3.749
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Hi... I am a noob at LUA and just beginning to learn it...

    Could someone tell me how to make a program wait for a certain amount of time?

  5. #6455
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von blotus21
    Hi... I am a noob at LUA and just beginning to learn it...

    Could someone tell me how to make a program wait for a certain amount of time?
    Either make your own timer or use this:

    Code:
    screen.waitVblankStart(60)
    I put 60 there, which is a second. Every 60 is a second. For example, if i use 300 instead, it would be 5 seconds.

    Use this to learn lua in an easy way:

    http://www.psp-programming.com/tutor...a/lesson02.htm
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  6. #6456
    QJ Gamer Blue
    Points: 3.749, Level: 38
    Level completed: 66%, Points required for next Level: 51
    Overall activity: 0%

    Registriert seit
    Mar 2007
    Beiträge
    140
    Points
    3.749
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    ah, thanks very much... I'll try to do it that way ^_^

  7. #6457
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Uhm, i hope you realize you have like 5 indeitations for the if statement, than 2 for the code to execure, then 1 for hte end... That is quite random (to me) and will be unreadable in any semi-large project.

    Personally, my indentations are 2-5 spaces.
    Code:
    int main() {
       for(;;) {
          if(condtion is true) { 
             break;
          }
       }
       return 0;
    }
    To ME its real easy to read, When i have alot of lines of code, Its still easy for ME, I guess people just shave different preferences.

  8. #6458
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    if x == 2 then
    	blah
    		end
    			elseif x == 3 then
    	blah	
    		end
    			elseif x == 4 then
    	blah
    end
    That is definitely non-standard.

    Code:
    if x == 2 then
    	blah
    elseif x == 3 then
    	blah	
    elseif x == 4 then
    	blah
    end
    This is more common place.

    http://astyle.sourceforge.net/

  9. #6459
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    How would I rotate an image? For example, to be able to turn an image (or twist, I guess) in order to shoot different things all around you? Thanks.

  10. #6460
    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 andyauff
    How would I rotate an image? For example, to be able to turn an image (or twist, I guess) in order to shoot different things all around you? Thanks.
    use the GU.
    --------------------------------------------------------------------------------------

  11. #6461
    QJ Gamer Blue
    Points: 7.014, Level: 55
    Level completed: 32%, Points required for next Level: 136
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Ort
    U.S.
    Beiträge
    405
    Points
    7.014
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    How would i do that? I thought it was for 3d. Sorry if I'm wrong, just trying to figure things out.

  12. #6462
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von superbatxs
    Either make your own timer or use this:

    Code:
    screen.waitVblankStart(60)
    I put 60 there, which is a second. Every 60 is a second. For example, if i use 300 instead, it would be 5 seconds.

    Use this to learn lua in an easy way:

    http://www.psp-programming.com/tutor...a/lesson02.htm
    I thought it was a millasecond timer. and arent thier 100 milliseconds in a second?

    EDIT_____!!!!
    NVM its vblanks and there are 60 vblanks in a second. so ur right.
    If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
    Gold donations are highly appreciated!

  13. #6463
    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 andyauff
    How would i do that? I thought it was for 3d. Sorry if I'm wrong, just trying to figure things out.
    everything software wise is based on the GU. (on the PSP) tactical penguin wrote a tutorial here:

    http://forums.qj.net/f-psp-developme...ive-89527.html
    --------------------------------------------------------------------------------------

  14. #6464
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    how do you add a thing so if you are at the main menu and you press credits it goes to credits what is the code for that and i would like it to be x that selects it

  15. #6465
    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

    if pad:cross() then

    btw, pspdude10594 = pspdude 10/5/94 = pspdude October 5th, 1994?
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  16. #6466
    QJ Gamer Blue
    Points: 3.642, Level: 37
    Level completed: 95%, Points required for next Level: 8
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    99
    Points
    3.642
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    if pad:cross() then

    btw, pspdude10594 = pspdude 10/5/94 = pspdude October 5th, 1994?
    Haha.......lol. Youresam, you are my hero....:ROFL:

  17. #6467
    QJ Gamer Blue
    Points: 4.633, Level: 43
    Level completed: 42%, Points required for next Level: 117
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    250
    Points
    4.633
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    if pad:cross() then

    btw, pspdude10594 = pspdude 10/5/94 = pspdude October 5th, 1994?
    sure whatever you want to think

  18. #6468
    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 pspdude10594
    sure whatever you want to think
    Uh, ok? Im assuming it was just random pounding on the keyboard. Nevermind then.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  19. #6469
    QJ Gamer Blue
    Points: 5.860, Level: 49
    Level completed: 55%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Beiträge
    201
    Points
    5.860
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    How come os.exit( ) freezes my PSP when I use it? I used the same method as the tutorial. It was something along the lines of this:

    I'm looking to return to the XMB from an EBOOT compiled in Game Maker.

    Code:
    if pressing X then
         do nothing
    elseif pressing O then
         os.exit( )
    end

  20. #6470
    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

    The command is slightly different in different versions of the player. Try using System.Quit() and see if that works

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

    yeah System.Quit() works in Cools mod

  22. #6472
    Points: 3.532, Level: 37
    Level completed: 22%, Points required for next Level: 118
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Beiträge
    1
    Points
    3.532
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    when I use this piece of code:

    for line in songindex:lines() do

    song[songlineread] = line
    songlineread = songlineread + 1

    end

    It always adds a weird character (i'm assuming its a line end) to the end of each line, any way of removing it or stopping it from happening?

    Thanks

  23. #6473
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Hey guys i am learning lua right now and i did some tutorials. Now i am trying to combine some to make a simple game like AOTM. Can you tell me why my guy won't shoot. It encounters an error everytime u try to shoot.
    Code:
    green=Color.new(0,255,0)
    grass=Image.load("grass.png")
    player=Image.load("player.png")
    tree=Image.load("tree.png")
    bullet = Image.createEmpty(4,4)
    bullet:clear(green)
    
    screenwidth=480-player:width()
    screenheight=272-player:width()
    
    Player={}
    Player[1]={x=200, y=50}
    
    oldpad = Controls.read()
    currentBullet = 0
    direction = "right"
    
    BulletInfo = {}
    for a = 1,800 do
    	BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player[1].x + 32, 
    	y = Player[1].y + 16 }
    end
    
    function bulletSetup()
    	if currentBullet < 800 then
    		currentBullet = currentBullet + 1
    	else
    		currentBullet = 1
    	end
    if direction == "left" then 
    BulletInfo[currentBullet].x = Player[1].x 
    BulletInfo[currentBullet].y = Player[1].y + 16
    end
    if direction == "right" then 
    BulletInfo[currentBullet].x = Player[1].x + 32 
    BulletInfo[currentBullet].y = Player[1].y + 16 
    end
    if direction == "up" then 
    BulletInfo[currentBullet].x = Player[1].x + 16 
    BulletInfo[currentBullet].y = Player[1].y 
    end
    if direction == "down" then 
    BulletInfo[currentBullet].x = Player[1].x + 16
    BulletInfo[currentBullet].y = Player[1].y + 32 
    end
    BulletInfo[currentBullet].direction = direction
    BulletInfo[currentBullet].firing = false
    end
    function bulletFire()
    	for i = 1,800 do
    		if BulletInfo[i].firing == true then
    			screen:blit(BulletInfo[i].x,BulletInfo[i].y,BulletInfo[i].pic)
    		end
    		if BulletInfo[i].x < 0 or BulletInfo[i].x > 480 or BulletInfo[i].y < 0 or BulletInfo[i].y > 272 then 
    			BulletInfo[i].firing = false 
    		end
    	end
    end
    
    while true do
    	pad=Controls.read()
    	screen:clear()
    
    	bulletSetup()
    
    	for a=0, 14 do
    		for b=0, 8 do
    			screen:blit(32 * a, 32 * b, grass)
    		end
    	end
    
    	screen:blit(100,100,tree)
    	screen:blit(300,220,tree)
    	screen:blit(87,46,tree)
    	screen:blit(400,150,tree)
    	screen:blit(Player[1].x,Player[1].y,player)
    
    	if pad:left() and Player[1].x>0 then
    		Player[1].x=Player[1].x-3
    	end
    
    	if pad:right() and Player[1].x<screenwidth then
    		Player[1].x=Player[1].x+3
    	end
    
    	if pad:up() and Player[1].y>0 then
    		Player[1].y=Player[1].y-3
    	end
    
    	if pad:down() and Player[1].y<screenheight then 
    		Player[1].y=Player[1].y+3
    	end
    
    	if pad:triangle() then
    		if BulletInfo[i].direction == "up" then 
    			BulletInfo[i].y = BulletInfo[i].y - 10 
    		end
    	end
    	if pad:circle() then
    		if BulletInfo[i].direction == "right" then 
    			BulletInfo[i].x = BulletInfo[i].x + 10 
    		end
    	end
    	if pad:cross() then
    		if BulletInfo[i].direction == "down" then 
    			BulletInfo[i].y = BulletInfo[i].y + 10 
    		end
    	end
    	if pad:square() then
    		if BulletInfo[i].direction == "left" then 
    			BulletInfo[i].x = BulletInfo[i].x - 10 
    		end
    	end
    
    	bulletFire()
    
    	screen.waitVblankStart()
    	screen.flip()
    end

  24. #6474
    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

    post your error please
    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

  25. #6475
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    GAME.LUA:105:attempt to index field '?' (a nil value)

    There you go. Not sure what is wrong.
    Thanks

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

    screenwidth=480-player:width()
    screenheight=272-player:width()

    shouldn't it be:
    screenwidth=480-Player:width()
    screenheight=272-Player:width()

  27. #6477
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Not sure but the error is in line 105
    -= Double Post =-
    It has to do with something when i hit the button to shoot it encounters that error. I need this because next i am going to add enemies and collision hopefully.

    Thanks to anyone that helps me out.
    Geändert von Bob Hoil (03-31-2007 um 04:57 PM Uhr) Grund: Automerged Doublepost

  28. #6478
    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

    well in

    Code:
    BulletInfo = {}
    for a = 1,800 do
    	BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player[1].x + 32, 
    	y = Player[1].y + 16 }
    end
    you stated direction="right" but right above that line you stated direction="right"

    maybe that has something to do with it, also dont blame me when i say this cause im new at Lua also, but where did "right" come from?

  29. #6479
    QJ Gamer Blue
    Points: 5.344, Level: 46
    Level completed: 97%, Points required for next Level: 6
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    347
    Points
    5.344
    Level
    46
    Downloads
    0
    Uploads
    0

    Standard

    Well i just started so to start i am combing tutorials to make my first game then will write my next game from my head. In the bullet one it said to shoot right.

  30. #6480
    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

    so tha character moves right? not right in the direction i mean right is in right


 

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 .