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; No, the filenames are correct, I'm sure about that, because, otherwise, it wouldn't load on the PSP too, would it? ...
-
04-04-2006, 11:17 AM #1321QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
No, the filenames are correct, I'm sure about that, because, otherwise, it wouldn't load on the PSP too, would it?
And as soon as I convert the pictures to png files, they won't work at all, not at the psp, nor at the box.
-
04-04-2006, 11:25 AM #1322Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
And you're sure you changed the code so it know it is a png file
-
04-04-2006, 11:33 AM #1323QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Zitat von SjaakRake
I guess that you got a to old luaplayer to load .jpg files.
Get the newest version at: http://luaplayer.org
Make also sure that your extention in the string is the same as the file you are loading.Geändert von HaxxBlaster (04-04-2006 um 11:36 AM Uhr)
[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]
-
04-04-2006, 11:35 AM #1324QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Yes, totally sure. I get the following errors:
On psp:
*something* IDAT: CRC Error.
After which luaplayer shuts off
And on the computer I get the same 'Error loading image' error.
-
04-04-2006, 11:38 AM #1325QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Your first picture works, then the other picture don't when you load it, and you don't have written the wrong namne.
Then i guess that the file don't even exist.[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]
-
04-04-2006, 11:40 AM #1326QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Yes, it does exist. I just don't get it. It seems like something is ****ing up all my .png files.
-
04-04-2006, 11:41 AM #1327Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
If you add me to msn: [email protected] il.com i will have a look over for you.
-
04-04-2006, 11:44 AM #1328QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Thanks, done, I'll stop chatting now in this topic now ^_^.
-
04-04-2006, 01:14 PM #1329Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
thx!!
Zitat von califrag
dude, u REALLY want above and beyond the call of duty. thx so much! if i were premium, id give u all my points(which is not that much)
thx again!--------------------------------------------------------------------------------------
-
04-04-2006, 01:15 PM #1330QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i think you guys may have missed my question can some1 help me out?
Zitat von slicer4ever
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
-
04-04-2006, 01:28 PM #1331Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Which bit exactly are you having problems with?
Zitat von slicer4ever
Have you checked out the tutorials at www.evilmana.com
-
04-04-2006, 01:32 PM #1332QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i need the line of duplicating my thing to happen with more than one person if youve played aotm then you know that the angry faces fire bullets at the same time so can someone help me with makeing it fire with more then one person
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
-
04-04-2006, 01:37 PM #1333Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Erm, You would put create the image 4 times in different positions, tell it to randomly move the images, put a timer in. Then you tell it them to fire in random directions, or the same? I don't know how yuo woulld go about it, but that's how i assume. I know what you mean though with AOTM. good game.
-
04-04-2006, 01:43 PM #1334QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
well i guess i'll have to do it that way then(sighs)
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
-
04-04-2006, 02:30 PM #1335Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hi all, im havin another prob.

here is my code:
itworks, but the value of caseValue[1], instead of being random, just goes higher all the time. the values of caseValue[2] and caseValue[20] work fine. when. caseValue[1] goes over 1000000, luaplayer give me an error: index.lua:33: bad argument #2 to 'print' (string expected, got nil)Code:white = Color.new(0, 0, 0) System.usbDiskModeActivate() screen:clear() caseMoney = { 100000, 750000, 500000, 400000, 300000, 200000, 100000, 50000, 25000, 10000, 50000, 1000, 750, 500, 400, 300, 200, 100, 75, 50, 25, 10, 5, 1, .01 } math.randomseed(os.time()) math.random() math.random() math.random() function startNewGame() caseValue = { caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)], caseMoney[math.random(26)] } end startNewGame() while true do pad = Controls.read() screen:print(150, 100, caseValue[1], white) screen:print(150, 140, caseValue[2], white) screen:print(150, 180, caseValue[20], white) if pad:start() then break end screen.flip() screen.waitVblankStart() end
press start to restart
pls help. thx
EDIT: how can i make it so that the maht.random(26) doesnt take the same value twice??Geändert von Grimfate126 (04-04-2006 um 02:32 PM Uhr)
--------------------------------------------------------------------------------------
-
04-04-2006, 02:46 PM #1336
I need some help... I got some music files to loop forever and it works, the only problem is that I can run it along side my game. Ill post the code for the music, but not the code ( as it is HUGE )
Song Code:
Code:Song = {} Song[1] = ("Songs/Why.it") Song[2] = ("Songs/monopoly2.it") Song[3] = ("Songs/compare1.it") pad = Controls.read() for i=1, 9999 do if i==1 then Music.playFile(Song[i]) Music.volume(128) screen.waitVblankStart(9540) i=i+1 end if i==2 then Music.playFile(Song[i]) Music.volume(128) screen.waitVblankStart(11460) i=i+1 end if i==3 then Music.playFile(Song[i]) Music.volume(128) screen.waitVblankStart(13500) i=i-2 end end
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-04-2006, 04:06 PM #1337
Zitat von Grimfate126
hmmm... basically you took the code I gave you... deconstructed it... and made it do exactly what you don't want it to do...
You should try using my code again.. it does exactly what you want...
-
04-04-2006, 05:54 PM #1338Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
no, this for another game. ;) (same names, but im change it later, im lazy)
Zitat von califrag
and BTW about ur code, can u make it possible to assign EACH case a different money amount, the code u gave me only does it for ur case. thx(again)--------------------------------------------------------------------------------------
-
04-05-2006, 03:16 AM #1339
- Registriert seit
- Aug 2005
- Beiträge
- 3
- Points
- 4.497
- Level
- 42
- Downloads
- 0
- Uploads
- 0
I don't know where else to ask this.
When running lua programs, how do I quit them? Get out of them back to the Lua loader screen.
Surely there has to be a way to do this. So far I've run quite a few, but have been unable to quit any of them.
-
04-05-2006, 03:52 AM #1340is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
well normally its the start button or select.
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-05-2006, 04:41 AM #1341
So what exactly is your problem? That you cant run it along side your game? Also i dont understand your code. You make it loop 9999 times eventhough there are only three songs. And you make them play right aftereachother. And also you pause the game while you play your music. So i assume this is the begin screen where you show who made it and stuff?
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, 11:31 AM #1342QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
I've encountered a little problem. As you can see in my code, I want the 'highlight.png' image to slide or hop to the left and right by using the left and right buttons. The only problem is, I only want the picture to go to the next 'state' upon pressing the key, but not sliding. So if I press the button once, I want it to go shift 10 pixxels, and when I press it again, it has to do another step.
Thanks in advanceCode:highlight = Image.load("images/highlight.png") background = Image.load("images/background.png") x = 4 y = 87 while true do screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false) screen:blit(x,y,highlight,0,0, highlight:width(), highlight:height(), true) screen.waitVblankStart() screen.flip() pad = Controls.read() if pad:right() then x = x + 10 elseif pad:left() then x = x - 10 end end
-
04-05-2006, 11:43 AM #1343Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
You're not telling the image to move, you're just telling to make x a bigger number...
I'm not quite sure how you would put it though...
-
04-05-2006, 11:47 AM #1344QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Actually, the picture does move, hence the line:
screen:blit(x,y,highlight ,0,0, highlight:width(), highlight:height(), true)
-
04-05-2006, 11:50 AM #1345is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
first eliminate the screen wait vblanks start and put that at the end preceeded by a screen flip, then put oldpad = controls.read just after your pad = controls.read thing
say something like this:
while true do
screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
screen:blit(x,y,highlight ,0,0, highlight:width(), highlight:height(), true)
screen.flip()
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
screen.waitVblankStart()
screen.flip()
endWhat did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
04-05-2006, 12:02 PM #1346QJ Gamer Blue
- Registriert seit
- Mar 2006
- Ort
- 127.0.0.1
- Beiträge
- 75
- Points
- 4.510
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Hmm, that one doesn't seem to work. It's doesn't shift and the screen flashes like a madman. I guess the pad and oldpad variables are colliding.
-
04-05-2006, 12:11 PM #1347
The songs play right after each other without the loop. The loop is there so the songs will play [one after another] 9999 times ( so for a long time ). There is no need to have it pause in game, it needs to be playing as soon as the game starts, but not in the menus.
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-05-2006, 12:11 PM #1348QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
or if you find a button you don't have to use and youve tried everything to quit do this:
go into the script and put the following code at the bottom before the last end:
if pad:triangle() then break
end
thats it although if it isn't triangle then heres all the buttons possible:
pad:cross()
pad:triangle()
pad:circle()
pad:square()
pad:r()
pad:l()
pad:left()
pad:right()
pad:up()
pad:down()
i believe thats all of them
edit: opps on last page was answering discofever's question1. 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
-
04-05-2006, 12:32 PM #1349
get rid of the first screen.flip(), so its like this:
screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
screen:blit(x,y,highlight ,0,0, highlight:width(), highlight:height(), true)
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
screen.waitVblankStart()
screen.flip()
endD:
-
04-05-2006, 02:34 PM #1350Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
NVRMIND but at line 30 i get that retarded "loop in gettable' error. This is the line of the error.
Code:if stick.x>480 then
Geändert von Mast3r_Shak3 (04-05-2006 um 02:37 PM Uhr)

--XBL Gamertag: PhenoM904--


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