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 Yongobongo Anyone know whats wrong with this? Code: housey < packy + pack:width() Using width for a y ...
-
12-06-2006, 11:29 AM #4531QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Zitat von Yongobongo
Using width for a y axis check? Should be height.Code:housey < packy + pack:width()
-
12-06-2006, 03:07 PM #4532QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
For a racing game and a speed variable, something like:
Theres a basis for ya. Just dont forget to make a reverse!Code:player = { x = 0, y = 0, img = Image.load("player.png"), d = u } speed = 0 if pad:cross() and speed > maxspeed then speed = speed+1 elseif pad:square() and speed > 0 then speed = speed - 3 end if speed < 0 then speed = 0 end if player.x > 472 - player.img:width() and player.d == r then player.x = player.x + speed end if player.x > 472 - player.img:width() then player.x = 472 - player.img:width()
-
12-06-2006, 03:44 PM #4533Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
ok thanks its late right now but ill look into that tomorrow il... put u in the credits or something lol.
EDIT: nvm i dont feel like doing spanish 2 homework right now lol.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!
-
12-06-2006, 06:37 PM #4534.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
Ok, my game is nearly done, yay! But I want to be able to fire something more then once, like so if i fire eg. a bullet it doesnt just get rid of it and fire another on from the starting point?
-
12-06-2006, 11:15 PM #4535QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- BEHIND YOU!!
- Beiträge
- 1.061
- Points
- 6.453
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Yongobongo, what are you trying to say?
[url=http://xs.to][img]http://xs313.xs.to/xs313/07106/wmnp8z.png[/img][/url]
What's a recovery.elf
[QUOTE=iball]
He's the one that fixes Santa's sleigh when it breaks down[/QUOTE]
[QUOTE=Deturbanator]why are we allowed to see the whole flesh and being of the boob but we MUST blur out the tit?[/QUOTE]
[PRE][B]sg57 i love you for turning on the light of homebrew when i was in the darkness of sony[/b][/pre]
-
12-07-2006, 01:11 AM #4536.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
How can I fire multiple bullets, basically :)
-
12-07-2006, 03:59 AM #4537I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
http://www.evilmana.com/tutorials/lu...et_bullets.php
Zitat von Yongobongo
That should work. If not, I can probably help you.
-
12-07-2006, 05:50 AM #4538QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yep and if 5 isnt enough just edit it a little to have more, but keep it to as few as possible.
-
12-07-2006, 06:14 AM #4539QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
i need to know how to clear up RAM. my game switches between scripts alot and i just got to the point where i now need to load...alot of stuff and need more space cause i dont want for it to lag...
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-07-2006, 06:17 AM #4540QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
imageyouloadedbeforethaty ounolongerneed = nil
asnotherimageyoupreviousl yloadedthatyounolongernee d = nil
imagethatyounowneed = Image.load("image.png")
Also, make sure your code isn't wasting your PSP's cpu or anything, just go through it and check for better ways of doing things and unneccessary things.
-
12-07-2006, 06:30 AM #4541QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
just calling them "nil" does that?
that just sounds too easy...ok![CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
12-07-2006, 06:43 AM #4542QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yea just make sure there arent multiple vcalues usin the same image. Making the m nil just redefines them as undefined and with an image sitting undefined and unused in the ram, it gets dumped out.
-
12-07-2006, 03:03 PM #4543QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
is there a site that says what all teh lua error messages mean so i can understand where i made my error?
-
12-07-2006, 03:18 PM #4544QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
That is what the line number in the error messages are for. Most of the errors are straight forward, others will require you to mentally step though the code to find your error. I also find that with scripts in general (weakly typed and usually with no debuggers) Hungarian Notation helps a lot especially during code maintenance and expansion.
Zitat von cheese the psp
-
12-07-2006, 04:50 PM #4545QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
great now i got rid of the errors and now it just freezes the psp
what can cause that to happen?
-
12-07-2006, 04:56 PM #4546QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Overflowing the stack, infinite loops are the immediate two that comes to mind.
-
12-07-2006, 05:33 PM #4547QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
waht does <eof> mean?
-
12-07-2006, 05:36 PM #4548QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
End of file. Generally it means you need to go through and check that you ended all of your loops and ifthens.
-
12-07-2006, 05:37 PM #4549QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- BEHIND YOU!!
- Beiträge
- 1.061
- Points
- 6.453
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I used to get that message all the time until I realized that my pc took longer than 2 seconds to transfer over the files. First you will see the memstick light blink then about 10 seconds later it will blink again, then you can disconnect it.
[url=http://xs.to][img]http://xs313.xs.to/xs313/07106/wmnp8z.png[/img][/url]
What's a recovery.elf
[QUOTE=iball]
He's the one that fixes Santa's sleigh when it breaks down[/QUOTE]
[QUOTE=Deturbanator]why are we allowed to see the whole flesh and being of the boob but we MUST blur out the tit?[/QUOTE]
[PRE][B]sg57 i love you for turning on the light of homebrew when i was in the darkness of sony[/b][/pre]
-
12-07-2006, 06:27 PM #4550QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
i cant seem to get this to work
Zitat von code
this is teh menu
-
12-07-2006, 06:31 PM #4551I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
You need to put all your screen
Zitat von cheese the psp
rints and screen:blits inside your main loop, since you have a screen:clear() in your main loop. If you put them before the loop, they will just get wiped away by the screen:clear().

-
12-07-2006, 06:54 PM #4552QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
there...
Zitat von code
now it just freezes with loading on the screen
-
12-07-2006, 07:01 PM #4553Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von cheese the psp
you dont have a "while true do". try this:
Code:System.usbDiskModeActivat e() black = Color.new(0,0,0) green = Color.new(0,255,0) white = Color.new(255,255,255) screenrint(120,140,"loa ding...",white) screen:flip() bg = Image.load("background.pn g") current = 1 while true do pad = Controls.read() screen:clear() if current == 1 and pad:cross() then do file("game.lua") end if current == 2 and pad:cross() then dofile("help.lua") end if current == 3 and pad:cross() then dofile("credits.lua") end screen:blit(0,0,bg) screenrint(120,140,"pla y game",black) screenrint(120,150,"Con trols",black) screenrint(120,160,"Cre dits",black) screen:flip() if current == 1 then screenrint(120,140,"pla y game",green) end if current == 2 then screenrint(120,150,"Con trols",green) end if current == 3 then screenrint(120,160,"Cre dits",green) end if pad:up() and oldpad:up() ~= pad:up() then current = current - 1 end if pad:down() and oldpad:down() ~= pad:down() then current = current + 1 end if current == 4 then current = 1 end if current == 0 then current = 3 end screen.waitvblankStart() screen.flip() oldpad = pad end--------------------------------------------------------------------------------------
-
12-07-2006, 07:09 PM #4554QJ Gamer Silver
- Registriert seit
- Oct 2006
- Ort
- 貴方
- Beiträge
- 1.159
- Points
- 7.371
- Level
- 57
- Downloads
- 0
- Uploads
- 0
then i get an error message saying i need an end for teh 'while'
in "while true do"
where would i put this end?
btw thanks for all your help
-
12-07-2006, 07:33 PM #4555lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
I believe since you have a main loop, You have to put the end to end your loop, Or else it will just keep repeating the loop, I think thats right???
-
12-07-2006, 07:55 PM #4556Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
the point of a loop IS to repeat. the "end" just puts limits on HOW MUCH you want to repeat every frame.
Zitat von pspgamer81
--------------------------------------------------------------------------------------
-
12-07-2006, 08:01 PM #4557lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Ah, Yea ok!



-
12-07-2006, 11:37 PM #4558lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Stickied!
-
12-08-2006, 02:10 AM #4559QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
God... now i finnaly got the ball to work with collosion in my ping pong game, thanks to Guitargod..
BUT! (Damm, there's always a but) At the start of the game, the ball is just blitted, and signed as an object, but i need it to move when the game starts!
(Yeah, i know nothing... *sniff*) So what should i write before the game loop, and what do i have to write?
I think my grammer is pretty wrong in this post. Oh well.My PSP Projects:
___________________
None.
-
12-08-2006, 06:05 AM #4560QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Just setup the direction system like I showed you and make the ball start out with a direction and then move the ball based on its direction.


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum