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 MaSt3r_ShAk3 Umm can someone help? It says 'then' expected near '=' (line 38) and the code is Code: ...
-
04-05-2006, 02:35 PM #1351Tha Sigerator

- Registriert seit
- Jul 2005
- Ort
- New Orleans, LA
- Beiträge
- 4.047
- Points
- 26.703
- Level
- 97
- Downloads
- 0
- Uploads
- 0
i think it should either be
Zitat von MaSt3r_ShAk3
orCode:if life == 0 then
Code:if life = 0 then
- - - - Somewhere Lurking in THA SHADOWS - - - -
-
04-05-2006, 02:35 PM #1352Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
put another = sign with the = so
if life==0 then
-
04-05-2006, 02:38 PM #1353Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
Yeah nvrmind i edited the post with my new error that is EVILLLL

--XBL Gamertag: PhenoM904--
-
04-05-2006, 02:40 PM #1354Tha Sigerator

- Registriert seit
- Jul 2005
- Ort
- New Orleans, LA
- Beiträge
- 4.047
- Points
- 26.703
- Level
- 97
- Downloads
- 0
- Uploads
- 0
Zitat von MaSt3r_ShAk3
try wit spacesCode:if stick.x > 480 then
- - - - Somewhere Lurking in THA SHADOWS - - - -
-
04-05-2006, 02:45 PM #1355Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
No dice...
black = Color.new(0, 0, 0)
life = 1
coll = 0
stick = Image.load("stick.png")
spike = Image.load("spike.png")
background = Image.load("background.pn g")
death = Image.load("death.png")
player = {}
player[1] = { x=240, y=200, life=1, stick=player[1] }
Okay look at the bold parts. is this possible? this might be the cause of my problemsGeändert von Mast3r_Shak3 (04-05-2006 um 02:50 PM Uhr)

--XBL Gamertag: PhenoM904--
-
04-05-2006, 03:06 PM #1356
No that is not possible. You say that player[1].stick=player[1]. You cant assign something to itself.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-05-2006, 03:11 PM #1357
Ok i understand, but again, what exactly is your problem? I just dont get your post where you state your problem. Because i think you left out a "t" after the "can", or am i wrong? Please say it again. (maybe im just being really stupid :o )
Zitat von cools
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-05-2006, 03:31 PM #1358
Sorry, I forgot to mention it...
Well whenever i try to play that along the with the game, it only plays the music and doesnt let you play the game.
It will play along side game if i only tell it to playback one of the music files.
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
04-05-2006, 05:29 PM #1359Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
I was told to do this buit it says the waitVblank thibg is wrong. help pleaseCode:frame_1 = Image.load("frame_1.png") frame_2 = Image.load("frame_2.png") frame_3 = Image.load("frame_3.png") screen:clear() while (true) do --Put image to memory and flip it to screen screen:blit(0, 0, frame_1) screen.flip() --Keep frame showing for 8 milliseconds screen.WaitVblankStart(8) --Clear screen to start over screen:clear() screen:blit(0, 0, frame_2) screen.flip() screen.WaitVblankStart(8) screen:clear() screen:blit(0, 0, frame_3) screen.flip() screen.WaitVblankStart(8) screen:clear() end
-
04-05-2006, 05:36 PM #1360<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
can you have functions within functions?
-
04-05-2006, 05:46 PM #1361Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
yes you can.
Zitat von Sousanator
Zitat von Noriko
-
04-05-2006, 06:12 PM #1362Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
yeah. It says something like "attempt to call WaitVblankStart (nil value) help please!
Zitat von Greenskull
EDIT: aha! The "w" was capitalized. im good now
but how do I make my animation loop over and over until I press X again?
Geändert von Greenskull (04-05-2006 um 06:16 PM Uhr)
-
04-05-2006, 07:09 PM #1363
try this:
Zitat von Greenskull
Code:white = Color.new(255, 255, 255) frame_1 = Image.load("frame_1.png") frame_2 = Image.load("frame_2.png") frame_3 = Image.load("frame_3.png") showAnimation = true timer = Timer.new() while true do pad = Controls.read() timer:start() screen:clear() if showAnimation then if timer:time() >= 0 and timer:time() <= 135 then screen:blit(0, 0, frame_1) elseif timer:time() > 135 and timer:time() <= 270 then screen:blit(0, 0, frame_2) elseif timer:time() > 270 and timer:time() <= 405 then screen:blit(0, 0, frame_3) elseif timer:time() > 405 then timer:stop() timer:reset() end else screen:print(0, 0, "Paused!", white) end if pad:cross() and pad ~= oldpad then if showAnimation then showAnimation = false else showAnimation = true end end oldpad = pad screen.flip() screen.waitVblankStart(6) end
-
04-05-2006, 09:32 PM #1364
here's the updated version of your deal or no deal script.it should work... it only takes each prize value once. from $0 to $1,000,000. The reason you had so many repeats is you had a couple prize values the same. This also displays the prize value in $0.00 format.
Zitat von Grimfate126
-
04-06-2006, 01:14 AM #1365QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Ok, the blipping stopped, but the highlighter doesn't move at all now. Which is fairly logic, because if right() is pressed, both pad and oldpad would be right(), so the if value would not be true.Code:pad = Controls.read() oldpad = Controls.read() if pad:right() and pad ~= oldpad then x = x + 10 oldpad = pad elseif pad:left() and pad ~= oldpad then x = x - 10 oldpad = pad end if pad:start() then break end
-
04-06-2006, 01:48 AM #1366
Ah yeah thats what i thought. Its because you pause the loop by using the waitVblanck's. So what you have to do is make a timer and if the timer is at a specific value (the length of your music) then you play the other musicfile.
Zitat von cools
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-06-2006, 01:50 AM #1367
@SjaakRake
I dont know why people use that code, but i know this works:With this it puts the value of pad in oldpad after everything is done, so when it does a new loop then it has the value of the last loop and that is what you want.Code:pad = Controls.read() if pad:right() and pad ~= oldpad then x = x + 10 oldpad = pad elseif pad:left() and pad ~= oldpad then x = x - 10 oldpad = pad end if pad:start() then break end oldpad=padLUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-06-2006, 03:50 AM #1368QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Haha, thanks, I'm so damn stupid, pretty logic.
PS. As you might have guessed, I'm dutch too, if you're interested in contacting me. PM me.
-
04-06-2006, 03:52 AM #1369
Ok, so it was the screen.waitVblank's that were messing up the code and I only need to change it to a timer. Thanks Altair!
Zitat von Altair
PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????
Quote of the Week
-
04-06-2006, 04:42 AM #1370
no problem at all. Im looking forward to playing monopoly on my PSP!
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-06-2006, 06:38 AM #1371QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
How would I make a string containing "? Can this be done through the hex value? If yes, how?
Blegh, I ask too much.
-
04-06-2006, 06:50 AM #1372is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
ok yea well done altair - how retarded of me, soz that was off the top of my head Sjaakrake
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-06-2006, 11:08 AM #1373Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
How do you compile a LUA app/game to an eboot.pbp so you dont have to run it with Luaplayer? I have Cygwin installed and the psptoolchain installed. What else do I need to do?
-
04-06-2006, 03:31 PM #1374Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
I am very confused about this "oldpad" thing. How do you make it so when you press X it starts and when you press it again it stops etc.?
Zitat von califrag
Geändert von Greenskull (04-06-2006 um 03:33 PM Uhr)
-
04-06-2006, 05:39 PM #1375
Use this: \"
Zitat von SjaakRake
This has to be in the quotations of the string itself. So say you want to put "hello" in a variable but with the quotations, you have to do this:
text="\"hello\""
[Dutch]Ja dat dacht ik al ja. "Sjaak" kom je niet zo vaak tegen in het buitenland
.[/Dutch]
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-06-2006, 05:50 PM #1376
Everybody has its "off"-days (is that how you say it?) and thx
Zitat von Glynnder- PSPro
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-07-2006, 01:25 AM #1377QJ Gamer Platinum
Awards:
- Registriert seit
- Jan 2006
- Ort
- stevens bumhole
- Beiträge
- 10.308
- Points
- 87.718
- Level
- 100
- Downloads
- 0
- Uploads
- 0
hi!
how do you repeat a sound so when it ends it start at the begining again? please help! thanks! :) btw, its a wav file if that helps.
-
04-07-2006, 01:28 AM #1378QJ Gamer Platinum
Awards:
- Registriert seit
- Jan 2006
- Ort
- stevens bumhole
- Beiträge
- 10.308
- Points
- 87.718
- Level
- 100
- Downloads
- 0
- Uploads
- 0
and how big should the wav file be so the lua player duzent hangs?? thanks
-
04-07-2006, 02:44 AM #1379
I dont know if there's a limit to the length or size, but i know it needs to be mono sound.
Here's the command and its argument:
So if you want it to loop then you say:Code:Sound.load(filename, [bool loop])
This site is really usefull: http://wiki.ps2dev.org/psp:lua_player:functionsCode:Sound.load(filename, true)
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
04-07-2006, 03:04 AM #1380QJ Gamer Platinum
Awards:
- Registriert seit
- Jan 2006
- Ort
- stevens bumhole
- Beiträge
- 10.308
- Points
- 87.718
- Level
- 100
- Downloads
- 0
- Uploads
- 0
need help again!
ive made a menu. everything works exept that the intro song repeats it self from the moment it starts!
wtf is wrong? help! please! :) here:
finalizar=1
while finalizar>0 do
screen:blit (0,0,menu)
music
lay()
Music.volume(128)
screen
rint (420,10,"v 0.1",negro)
screen
rint (421,261,"MADSOUL",Color. new(80,80,math.random (1 , 255)))
screen
rint (420,260,"MADSOUL",Color. new(255,255,math.random (1 , 255)))
screen
rint (120,5,"This is your",rojo)
screen
rint (177,15,"last Score",rojo)
screen
rint (270,10,puntos,Color.new (math.random (1 , 255),math.random (1 , 245),math.random (1 , 255)))
screen.waitVblankStart()
screen.flip()
pad = Controls.read()
if pad:cross() then
juego()
end
if pad:start() then
finalizar=0
end
end


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