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; Code: white = Color.new(255,255,255) red = Color.new(255,0,0) blue = Color.new(0,0,255) orange = Color.new(255, 102, 0) background = Image.load("images/begin.jpg") oldpad = ...
-
12-23-2007, 05:26 AM #8191.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
You need the right variable name :SCode:white = Color.new(255,255,255) red = Color.new(255,0,0) blue = Color.new(0,0,255) orange = Color.new(255, 102, 0) background = Image.load("images/begin.jpg") oldpad = Controls.read() while true do pad = Controls.read() screen:clear() screen:blit(0,0,begin) if pad:cross() then dofile("./game.lua") end screen.waitVblankStart() screen.flip() end
-
12-23-2007, 06:07 AM #8192QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
OMFG xD
How the f*** did'nt I see that ? xD
Thx Yongobongo
-
12-23-2007, 06:10 AM #8193
Thanks alot QuickJay! ^_^
-
12-23-2007, 06:45 AM #8194QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I've completed the game (almost :P ) , now I want a music file playing in the main-menu. I tried everything but it says : "cant open sound at ......... " or "error loading sound" . I tried both formats ( .xm & .wav ) , but it keeps giving me the same error :s
EDIT : I figured it out and i dont get any errors. But how does it come that I dont hear any sound of the song ??Geändert von Muhie (12-23-2007 um 06:59 AM Uhr)
-
12-23-2007, 07:05 AM #8195Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
the first error you mentioned means an incorrect file path and the second is probably because you need to have a popper .wav file not just take an .mp3 for example and change the extension to .wav as this is still an mp3 file which cannot be played with sound:play()
and the answer to your edit
TURN THE VOLUME UP !!!!!!!!!!!!!------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-23-2007, 07:30 AM #8196QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Alright thx !
Zitat von FaT3oYCG
BTW : Lol, the volume was already turned up.
EDIT : Last question : The song lags when it starts to play , why ??
-
12-23-2007, 07:54 AM #8197Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
it depends what your program is doing at the time it starts playing increasing the cpu speed will allow the song to play without lagging so either get the lua player with cpu speed functions or tell me what version you want and i will make you one with cpu functions and an example
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-23-2007, 10:51 AM #8198QJ Gamer Blue
- Registriert seit
- Jun 2007
- Ort
- Melfi PZ
- Beiträge
- 76
- Points
- 4.074
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Simple request
how i can see if a file exists?
-
12-23-2007, 11:56 AM #8199Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
are you blind a quote from me - reference post 8177
Zitat von FaT3oYCG
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-23-2007, 05:23 PM #8200QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Unfortunately, not everyone has the time to read through the entire thread. This results in many, many duplicate questions.
You may want to post snippets like that in the scripts/examples forum as well, as long as it hasn't already been posted there.
-
12-24-2007, 01:51 AM #8201QJ Gamer Blue
- Registriert seit
- Jun 2007
- Ort
- Melfi PZ
- Beiträge
- 76
- Points
- 4.074
- Level
- 40
- Downloads
- 0
- Uploads
- 0
oh sorry!

btw thx!
-
12-24-2007, 03:00 AM #8202Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
just make sure you search the threads first a good way is to use the search button on the top of the main psp development section page or to find a phrase on the current page use ctrl & f and it will bring up a search box
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-24-2007, 03:44 PM #8203QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I was working on a Pong game and i finished it now.. it looks good (for a beginner xD ) but thx anway 4 ya help !
Zitat von FaT3oYCG
I'm now working on a Snake (or something like that) game which I hopefully release in a few days :)
Cheerz
-
12-25-2007, 05:04 AM #8204QJ Gamer Blue
- Registriert seit
- Jun 2007
- Ort
- Melfi PZ
- Beiträge
- 76
- Points
- 4.074
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Hi, i have another problem, in luaplaer for windows (i don't tryed on psp yet) why when i use listDirectory the name and size are correctly and directory gotalways false? or are folder or are files i got always arent folder...
-
12-25-2007, 03:03 PM #8205QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I'm working on a game called Mario Road . Now I get an error ; "'then'" expected near '=' .
But I can't find where i made that mistake it should be here somewhere :
Hope you guys can help me !--Punten
if Player.x == star.x and Player.y == star.y then
score = score + 1
end
if Player.x == star.x and Player.y == star.y then
score = score + 1
end
if (Player.x > Enemy.x) and (Player.x < Enemy.x) and (Player.y > Enemy.y) and (Player.y < Enemy.y) then
dofile("./lose.lua")
end
if (Player.x > star.x) and (Player.x < star.x) and (Player.y > star.y) and (Player.y < star.y) then
score = score + 1
star.x = math.random
star.y = math.random
end
if score = 10 then
dofile("./index.lua")
end
-
12-25-2007, 06:36 PM #8206
if score = 10 then
Zitat von Muhie
You forgot one. ;)[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
12-26-2007, 02:03 AM #8207Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
you missed an end so it wants you to replace the eqals with a thenCode:--Punten if Player.x == star.x and Player.y == star.y then score = score + 1 end if Player.x == star.x and Player.y == star.y then score = score + 1 end if (Player.x > Enemy.x) and (Player.x < Enemy.x) and (Player.y > Enemy.y) and (Player.y < Enemy.y) then dofile("./lose.lua") end if (Player.x > star.x) and (Player.x < star.x) and (Player.y > star.y) and (Player.y < star.y) then score = score + 1 end star.x = math.random star.y = math.random end if score = 10 then dofile("./index.lua") end
also looking at your clisions they are slightly wrong
try this
and the same for the starCode:if (Player.x + Player.width() > Enemy.x) and (Player.x < Enemy.x + Enemy.width()) and (Player.y + Player.height() > Enemy.y) and (Player.y < Enemy.y + Enemy.height()) then dofile("./lose.lua") end
to save yourself time you could make a function that checks colisionsif you need some help with that then just ask------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-26-2007, 02:09 AM #8208QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Zitat von FaT3oYCG
No, then there would be an extra end (In cases like this, indenting helps)
All you need to change:
Code:if score == 10 then
-
12-26-2007, 02:20 AM #8209Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
oh sorry didnt spot that one but his collisions wont work fully either
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-26-2007, 05:14 AM #8210QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Thx guys , you really helped me with this one ! :)
The game is now running pretty good, but I only got 1 level and I need at least 3 levels for a public release. I also need to make some graphical changes , I REALLY suck at photoshopping ,
Cuz I see a white 'box' around my sprite when he's moving xD --->
so if someone wants to help me out with that.. just PM me (or if you want to finish this project together with me, you can do the same ;) )
-
12-26-2007, 05:46 AM #8211QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
if its a png, just delete the outside of him because png's use RGBA
-
12-26-2007, 06:39 AM #8212Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
on photoshop either use the magic eraser - third option on the eraser tool or paint bucket the outside with with the alpha chanel which is underneath your two currnt selections and looks lie a white box with a red line through it diagonally top left to bottom right
hope that helps------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-26-2007, 06:55 AM #8213QJ Gamer Blue
- Registriert seit
- Apr 2007
- Ort
- The Netherlands
- Beiträge
- 104
- Points
- 3.617
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Thx Xsjado7 & FaT30YCG !
I'll give it a shot , hope it works ! :)
I love this thread .. you guys really help me out with every problem I have . Keep up the good work ! ;)
-= Double Post =-
Yaaayyy ! I got the game running without those stupid white boxes around my sprites
, thanks to you guys !
The last thing that I want to add is some backgroundmusic , but it doesnt work for me
, it keeps saying : error loading sound .
What the heck am I doing wrong ??Geändert von Muhie (12-26-2007 um 10:16 AM Uhr) Grund: Automerged Doublepost
-
12-27-2007, 07:50 PM #8214
For some reason, whenever I try to find out if a file on my listdirectory is a directory, it always returns false. (even when it is a directory)
Example:
Everything returns false, regardless. Any idea why? (I am using the windows LUAPlayer, rather than the PSP LUAPlayer)Code:files = System.listDirectory("Games") for i=1, table.getn(files) do print(files[i].directory) end
-
12-27-2007, 08:06 PM #8215QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
'What' in that code you have given returns false? Is the function System.listDirectory returning false?
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
12-27-2007, 08:17 PM #8216
files[i].directory (which is supposed to return true if the file is a directory)
-
12-27-2007, 09:16 PM #8217QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Considering it is LuaPlayer specific, it could just be a bug on the PC version. Try it on the PSP and post up the results.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
12-27-2007, 09:22 PM #8218
I wish I could, but I don't have a miniUSB on hand. XD Could someone else try it in my stead?
Edit: Nevermind, my dad had one on hand. It turns out it is just a Windows LUAPlayer error. Thanks anyway. ^_^
-
12-27-2007, 09:33 PM #8219
- Registriert seit
- Dec 2007
- Beiträge
- 2
- Points
- 2.775
- Level
- 32
- Downloads
- 0
- Uploads
- 0
i just got a psp it has homebrew 3.7 something like that. i need to know all this stuff an got lots of dumb questions. first of all would converting this psp to homebrew cause the sound not to work, i bought it as is with no sound. if posible i would like to fix the sound. then i got questions about games on the memory stick , can that be done? i found lots of psp games to download , but can't get them to load up. thanks sorry for the dumb questions
-
12-28-2007, 11:06 AM #8220QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Just dropping by to show you guys some art i made in LUA.

[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]


LinkBack URL
About LinkBacks
Mit Zitat antworten
lay()

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