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; SG57 Now what could it be wrong this time ? Lua player load my index with out any error but ...
-
04-28-2006, 01:10 PM #1861
SG57
Now what could it be wrong this time ? Lua player load my index with out any error but with the eboot and changing system.lua to load mine it gives error, it dosent load my index but it dose load airhockey index
i added the luasplash and and comp.wav to my index it loads but when its time to load the program it gives error ???? and with luaplayer it dosent ?????? am i missing a code?
Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 01:34 PM #1862QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Hey what does this error mean?
Code:stack overflow
-
04-28-2006, 01:38 PM #1863
- Registriert seit
- Jan 2006
- Beiträge
- 41
- Points
- 4.325
- Level
- 41
- Downloads
- 0
- Uploads
- 0
hey guys,
what im trying to do is create a moving allow/launcher for a homebrew game.
i loaded the image, then i want it to move to the left when you press up.
so this is the code i used
the problem i have is when you press up - the original launcher/arrow doesnt clear - so you cant see the second launcher (which is slightly aimed more towards the left)Code:--[[ launcher loaded in default position) ]] screen:blit(20,98,launcher7) screen:flip() pad = Controls.read() if pad:cross() then break end end if pad:up() then launcher7.clear() screen:blit(20,98,launcher6) screen:flip()
can anyone help me with this
or
is there an easier way of moving the laucher/arrow
thanks for all your help
RL
{Edit}
so now i got it to do something - by moving the "end" after
if pad:cross() then break end
but i get the error
image:clear([color]) zero or one arguement
-
04-28-2006, 01:44 PM #1864Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
I think it means something could not be found like a file maybe? But i'm only guessing here!
Zitat von montrob
-
04-28-2006, 01:46 PM #1865
aaaa donno what is wrong but i m rebuiding the paint program again
learning this things is almost making me downgrade again >.< and i dont feal comfortable doing it =/Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 01:47 PM #1866Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
You have described launcher6 and 7 haven't you, it's just it doesn't say it there.oh, is that the image, i guess it is.
Zitat von Raven_lif
How about adding waitVblankstart() or something?
-
04-28-2006, 01:57 PM #1867Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
are u even ALLOWED to do launch7.claer()??
Zitat von Raven_lif
--------------------------------------------------------------------------------------
-
04-28-2006, 02:08 PM #1868
this is just an example. there are more codes inCode:usbin = System.usbDiskModeActivate while true do screen:clear() pad = Controls.read() if pad:l() then usbin = true end if pad:select() then break end screen.flip() screen.waitVblankStart() end
Guys i put into the script. but usb dosnt show up. how can I make it work ?
( i have firmware 2.0 though)Geändert von natan333 (04-28-2006 um 02:10 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 02:31 PM #1869
- Registriert seit
- Jan 2006
- Beiträge
- 41
- Points
- 4.325
- Level
- 41
- Downloads
- 0
- Uploads
- 0
yes i defined launcher6 and 7 amognst others
ill try
waitVblankstart()
but doesnt that make the screen pause?
well i assume so - its just a code to clear the image isn't it? launch7 being the imageare u even ALLOWED to do launch7.claer()??
but anyway it doesnt work - because it just dies and gives the error i mentioned
-
04-28-2006, 02:35 PM #1870QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
You need spaces between the "=" signs for all variables.
Zitat von PSPduh
example
What you have:
black=Color.new(0, 0, 0)
Should be:
black = Color.new(0, 0, 0) <--space out the words from the equal (=) sign.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 02:44 PM #1871
guys wasnt this supposed to work ?. already put CursorsDimensionY and X before while true do
Code:if letterPosy < 0 then letterPosy = 0 else if letterPosy > 272 - CursorsDimensionY then letterPosy = 272 - CursorsDimensionY else if letterPosx < 0 then letterPosx = 0 else if letterPosx > 480 - CursorsDimensionX then 480 - CursorsDimensionX end end
Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 02:45 PM #1872QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
yes. thats what "screen.waitVblankStart() " does. it stops the screen at leaving whatever is blitted right where it is for eternity, unless its used in a "while true do" loop.
Zitat von Raven_lif
you missed an "end" for that last "if" loop.Code:--[[ launcher loaded in default position) ]] screen:blit(20,98,launche r7) screen:flip() <-- whats this here for? I only see a need for one "screen.flip()", and thats placed at the bottom of the script just before "screen.waitVblanStart()". pad = Controls.read() if pad:cross() then break end end if pad:up() then launcher7.clear() screen:blit(20,98,launche r6) screen:flip() end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 02:47 PM #1873QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
only one "end" is necessary.
Zitat von natan333
thats whats good about using "elseif".[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 02:52 PM #1874QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
damn...I just realized I'm making too many posts..oh well.
Code:if pad:up() then launcher7.clear() -- just use a normal "screen.clear()" screen:blit(20,98,launche r6) screen:flip() end
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 02:53 PM #1875
- Registriert seit
- Jan 2006
- Beiträge
- 41
- Points
- 4.325
- Level
- 41
- Downloads
- 0
- Uploads
- 0
the end is there was just on the next line downyou missed an "end" for that last "if" loop.
becuase its loading ht elauncher - as well as some other images - that i dont have a problem with - which is why they are not included in the codescreen:blit(20,98,launche r7)
screen:flip() <-- whats this here for? I only see a need for one "screen.flip()", and thats placed at the bottom of the script just before "screen.waitVblanStar t
also a screen:clear()
doesnt do anything
oh........godGeändert von Raven_lif (04-28-2006 um 02:57 PM Uhr)
-
04-28-2006, 02:56 PM #1876QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
ah.
Zitat von Raven_lif
i think you should post a little more coding next time around so people avoid confusion.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 02:58 PM #1877
- Registriert seit
- Jan 2006
- Beiträge
- 41
- Points
- 4.325
- Level
- 41
- Downloads
- 0
- Uploads
- 0
XD..... sorry
Geändert von Raven_lif (04-29-2006 um 05:34 AM Uhr)
-
04-28-2006, 03:16 PM #1878QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Thanks EminentJonFrost, but it still creates a stackdump file. I spaced out everything that was cramped on the equal sign; the new code:
And the stackdump file: (not sure if it changed)Code:red = Color.new(255,0,0) green = Color.new(0,255,0) blue = Color.new(0,0,255) white = Color.new(255,255,255) duh = Image.load("duh.png") counter = Timer.new() counter:start() screen:blit(50,50,duh) while true do pad = Controls.read() if pad:up() then duh.y = duh.y + 2 end if pad:down() then duh.y = duh.y - 2 end if pad:right() then duh.x = duh.x + 2 end if pad:left() then duh.x = duh.x - 2 end currentTime = counter:time() screen:clear(blue) screen:print(10,10,"Counter Time: " .. currentTime, white) if currentTime > 2500 and currentTime < 5000 then screen:clear(red) end if currentTime > 5001 then counter:reset(0) counter:start() end
Thanks in advance!Code:Stack trace: Frame Function Args 7C8107FD 7C81084D (32000000, 907C83AB, 90909090, FC489D39) 322869 [sig] luaplayer 2956 handle_threadlist_exception: handle_threadlist_exception called with threadlist_ix -1 339374 [sig] luaplayer 2956 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION Exception: STATUS_ACCESS_VIOLATION at eip=61015E82 eax=00FFFFFF ebx=610E7ECC ecx=00000000 edx=FF001CC6 esi=00000001 edi=00000001 ebp=00A2E6E8 esp=00A2E6E4 program=C:\Documents and Settings\FattyMcFat\Desktop\luaplayerwindows\luaplayer.exe, pid 2956, thread sig cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023 Stack trace: Frame Function Args 00A2E6E8 61015E82 (610E7ECC, 6110BA74, FC489D39, 00000000) 00A2E708 61015FAC (00000001, 00A2E760, 00000000, 00000000) 00A2EA58 610179AB (000006F4, 00A2EED0, 000000A4, 00A2EE9C) 00A2EF98 6108A497 (610E6D18, 00000000, 00000F84, 00000000) 00A2EFC8 6100327F (610E6D18, 00A2F000, 61003160, 00000000) 00A2EFF8 61003E94 (00000000, 00000000, 00000000, 00000000) 00A2FF98 61003EDA (00000000, 00000000, 00000000, 00000000) End of stack trace
Geändert von PSPduh (04-28-2006 um 03:18 PM Uhr)
-
04-28-2006, 04:08 PM #1879
hmm. that code was wrong for me
the code bellow worked with me like a charm =PP
Anyways, i dont know how will be for users bellow 2.0, is the lua windows eboot have a home button included ?Code:if letterPosy < 2 then letterPosy = 2 end if letterPosy > 269 then letterPosy = 269 end if letterPosx < 2 then letterPosx = 2 end if letterPosx > 477 then letterPosx = 477 end
and How can i take screenshot like
but to go to the root of the memory stick ?Code:if pad:l() and pad:triangle() then screen:save("PortablePaint.tga") end
and by making it to change to portablepaint to like portablepaint02 if i pres l trigger and triangle twice and so on?Geändert von natan333 (04-28-2006 um 04:12 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 05:17 PM #1880words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
omg... Just look at the structure of the app and how it is loaded. Then replace it with your structurea dn stuff
Zitat von natan333

...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
-
04-28-2006, 05:28 PM #1881QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
hmm..I'm not sure. But my guess is that you change this:Thanks EminentJonFrost, but it still creates a stackdump file. I spaced out everything that was cramped on the equal sign; the new code:
And the stackdump file: (not sure if it changed)Code:red = Color.new(255,0,0) green = Color.new(0,255,0) blue = Color.new(0,0,255) white = Color.new(255,255,255) duh = Image.load("duh.png") counter = Timer.new() counter:start() screen:blit(50,50,duh) while true do pad = Controls.read() if pad:up() then duh.y = duh.y + 2 end if pad:down() then duh.y = duh.y - 2 end if pad:right() then duh.x = duh.x + 2 end if pad:left() then duh.x = duh.x - 2 end currentTime = counter:time() screen:clear(blue) screen:print(10,10,"Counter Time: " .. currentTime, white) if currentTime > 2500 and currentTime < 5000 then screen:clear(red) end if currentTime > 5001 then counter:reset(0) counter:start() end
Thanks in advance!Code:Stack trace: Frame Function Args 7C8107FD 7C81084D (32000000, 907C83AB, 90909090, FC489D39) 322869 [sig] luaplayer 2956 handle_threadlist_excepti on: handle_threadlist_excepti on called with threadlist_ix -1 339374 [sig] luaplayer 2956 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION Exception: STATUS_ACCESS_VIOLATION at eip=61015E82 eax=00FFFFFF ebx=610E7ECC ecx=00000000 edx=FF001CC6 esi=00000001 edi=00000001 ebp=00A2E6E8 esp=00A2E6E4 program=C:\Documents and Settings\FattyMcFat\Deskt op\luaplayerwindows\luapl ayer.exe, pid 2956, thread sig cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023 Stack trace: Frame Function Args 00A2E6E8 61015E82 (610E7ECC, 6110BA74, FC489D39, 00000000) 00A2E708 61015FAC (00000001, 00A2E760, 00000000, 00000000) 00A2EA58 610179AB (000006F4, 00A2EED0, 000000A4, 00A2EE9C) 00A2EF98 6108A497 (610E6D18, 00000000, 00000F84, 00000000) 00A2EFC8 6100327F (610E6D18, 00A2F000, 61003160, 00000000) 00A2EFF8 61003E94 (00000000, 00000000, 00000000, 00000000) 00A2FF98 61003EDA (00000000, 00000000, 00000000, 00000000) End of stack trace
To This:Code:screen:print(10,10,"Counter Time: " .. currentTime, white)
see if that works.Code:screen:print(10, 10, currentTime, white)
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
04-28-2006, 05:36 PM #1882QJ Gamer Bronze
- Registriert seit
- Jan 2006
- Ort
- Western Australia
- Beiträge
- 1.046
- Points
- 8.803
- Level
- 63
- Downloads
- 0
- Uploads
- 0
It'll only print the word currentTime.
-
04-28-2006, 06:01 PM #1883Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
here: try this:
Zitat von PopcOrn DeVil
problems in your original code:Code:red = Color.new(255,0,0) green = Color.new(0,255,0) blue = Color.new(0,0,255) white = Color.new(255,255,255) duhx = 50 duhy = 50 duh = Image.load("duh.png") counter = Timer.new() while true do screen:clear(blue) pad = Controls.read() screen:blit(duhx,duhy,duh) if pad:up() then duhy = duhy - 2 end if pad:down() then duhy = duhy + 2 end if pad:right() then duhx = duhx + 2 end if pad:left() then duhx = duhx - 2 end currentTime = counter:time() screen:print(10,10,"Counter Time: " .. currentTime, white) if currentTime > 2500 and currentTime < 5000 then screen:clear(red) end if currentTime > 5001 then counter:reset() counter:start() end screen.waitVblankStart() screen.flip() end
1.whenever you print OR blit something to the screen: it MUST be done inside a function, or a loop. you blitted "duh" in neither, so it appeared for only a bit, and then cleared.
2. at the end of your loop, you stated screen:clear(blue), and then printed the time. when you cleared, you ALSO cleared the picture, so it only showed you the time.
3. you did not give duhx and duhy a value. how is luaplayer supposed to know?
4. you did not end your loop.
5. there were more, but im too lazy right now.
bb! and good luck!
EDIT: @ EminentJonFrost, you DO NOT need spaces between your ='s, <'s, or >',s. although they do make your code easier to read.--------------------------------------------------------------------------------------
-
04-28-2006, 07:27 PM #1884QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
that wont work, but only for one simple reason. the screen:clear(red) near the bottom of the loop will clear the whole screen on top of the print command and the duh image, leaving a blank red screen until it goes back to blue.
Doing ALL your screen clearing at the top is a better approach, try this one.
Code:red = Color.new(255,0,0) green = Color.new(0,255,0) blue = Color.new(0,0,255) white = Color.new(255,255,255) duhx = 50 duhy = 50 duh = Image.load("duh.png") counter = Timer.new() while true do currentTime = counter:time() if currentTime > 2500 and currentTime < 5000 then screen:clear(red) else screen:clear(blue) end pad = Controls.read() screen:blit(duhx,duhy,duh ) if pad:up() then duhy = duhy - 2 end if pad:down() then duhy = duhy + 2 end if pad:right() then duhx = duhx + 2 end if pad:left() then duhx = duhx - 2 end screen:print(10,10,"Counter Time: " .. currentTime, white) if currentTime > 5001 then counter:reset() counter:start() end screen.waitVblankStart() screen.flip() endMy lua tutorials for PSP - www.evilmana.com/tutorials
PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/
-
04-28-2006, 07:30 PM #1885
I have an question: how can i make trigger R to do multiple, Triple Things like an example below
But i get error =/Code:if pad:r() and screen:blit(3,0, color) then screen:blit(3,50, color) end
Bequiet!!!
I'm learning cc©cc
-
04-28-2006, 07:33 PM #1886QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
try this
Zitat von natan333
Code:if pad:r() then screen:blit(3,0, color) and screen:blit(3,50, color) end end
-
04-28-2006, 07:35 PM #1887QJ Gamer Bronze
- Registriert seit
- Oct 2005
- Ort
- Alabama
- Beiträge
- 272
- Points
- 5.975
- Level
- 50
- Downloads
- 0
- Uploads
- 0
Yeah, that definitely would cause an error ;)
Zitat von natan333
What exactly do you want it to do?
If you want to blit 2 images at once in one if statement then do this:
There is not limit how many lines you can put in there.Code:if pad:r() then screen:blit(3,0, color) screen:blit(3,50,color) end
My lua tutorials for PSP - www.evilmana.com/tutorials
PSP Lua CodeBase - Add your own code examples to the codebase! - www.evilmana.com/tutorials/codebase/
-
04-28-2006, 08:17 PM #1888
thx so much.
Now there is only one thing that i really need to learn for further releases and etc's
The code bellow is part of the script
I dont know if you really going to get it.Code:if pad:cross() then canvas:drawLine(letterPosx, letterPosy, x1, y1, black) end x1 = letterPosx y1 = letterPosy screen:blit(0, 0, canvas, 0, 0, canvas:width(), canvas:height(), false) screen:blit(letterPosx,letterPosy, arrow) --------------------------------------------------- if pad:r() then screen:blit(3,0, color) end if pad:r() and pad:square() then if letterPosx >= 4 and letterPosx <= 16 and letterPosy >= 19 and letterPosy <= 30 then canvas:drawLine(letterPosx, letterPosy, x1, y1, red) end end
You can see that Holding Cross and moving the arrows will have black pixels.
The Code above the ----- line is the default color of the paint (Black).
The code bellow the ---- line is what i m trying to change the black pixel to become red. The thing i want to make it work is to hold R trigger to pop up an image of a bunch of colors then select the color and press square button to activate it to change black to the color that is selected.
The code bellowis showing the red color position. so when i press square in that place, it will change black pixels to red so then i can unhold R trigger and square and press Cross and move arround with red color .Code:letterPosx >= 4 and letterPosx <= 16 and letterPosy >= 19 and letterPosy <= 30
Can anyone help me with this one ?Geändert von natan333 (04-28-2006 um 08:26 PM Uhr)
-
04-29-2006, 03:42 AM #1889QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Thanks everybody for helping me! What I did to fix the code was I used the Image.createEmpty instead of loading the image. Then I put the 0 in counter:reset(0). Now it works like I want it to. Thanks!
-
04-29-2006, 04:35 AM #1890QJ Gamer Bronze
- Registriert seit
- Jan 2006
- Ort
- Western Australia
- Beiträge
- 1.046
- Points
- 8.803
- Level
- 63
- Downloads
- 0
- Uploads
- 0
Uhm it wasn't me who needed help. I was just saying that what he wrote will just display currentTime.
Zitat von Grimfate126


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