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; i don't know if i should ask this here, but i will anyway: i am getting ready to release my ...
-
01-23-2007, 12:23 PM #5221
i don't know if i should ask this here, but i will anyway:
i am getting ready to release my game now, but i want to know how to change the icons that are displayed on the psp when you make your game an eboot. Because right now it looks like it is luaplayer right now.
-
01-23-2007, 12:23 PM #5222QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Thank you so, so much. That helps more than you would ever imagine...
Zitat von TacticalPinguin
-
01-23-2007, 12:25 PM #5223
lol, yea. i hate that like in your case it will detect the whole while loop when the error is really an if statement. With bigger code it is hard to find the error.
Zitat von GuitarGod1134
-
01-23-2007, 01:08 PM #5224QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Does anyone know if I declare a variable as local, then put it through a if...then thing and change it's value will it still be local? for example
will x still be local?Code:local x=4 if x==4 then x=3 end
And I need some way to save memory because I have a lot of images to load, and the program can't get through half of them
-
01-23-2007, 01:24 PM #5225QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Yes it will be local but will save you **** all memory in relative to images.
Zitat von PSPhakkor
You need to load images that you need to use and unload the ones you don't.[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]
-
01-23-2007, 02:30 PM #5226QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
That's pretty smart... Nice logic lol. The game actually runs pretty nicely now
Zitat von yaustar
-
01-24-2007, 06:33 AM #5227QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
whats the problem with this? o_O
error:attempt to index global "read" (a nil value)Code:read = io.open("flash1:/registry/system.dreg","r") read:seek("set", 0x2380) line = read:read() read:close()
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-24-2007, 07:56 AM #5228QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It couldn't open the file.
Zitat von myschoo
[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]
-
01-24-2007, 07:59 AM #5229QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
thats strange...i will have a look
edit:
this is xmODs src code of Pass Retriever:
and it works ...Code:file = io.open("system.dreg","r") file:seek("set", 0x2de0) line = file:read(4) file:close()[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-24-2007, 11:45 AM #5230QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I'm really just throwing this out there, but maybe either lua can't read from flash1, or the prefix isn't "flash1:\" maybe "f1:\" or something different
-
01-24-2007, 11:48 AM #5231QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
strange is he didnt even use prefix... o_O
edit. strange, i probably did a mistake, it works...
its like this:
("flash1:/registry/system.dreg","r")[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-24-2007, 12:19 PM #5232QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Does anyone know how to completely end a program? I can't use "break" because then the psp starts running the code that's outside of the structure that I "broke" out of. Lua doesn't have a "main" function like C++, does it?
-
01-24-2007, 12:30 PM #5233QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
um not that i know of...PSPhakkor. there is a function called 'os.exit()' that does that, but its only usable in one of the modded luaplayers. cools' third mod, i think.
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
01-24-2007, 12:33 PM #5234QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
nah... thats System.Quit() ;) not os.exit()
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-24-2007, 01:34 PM #5235
can anyone answer my question before? i need to know how to change the pictures shown for a game when you see them in the game folder, actually seen on your psp.
i used the actual luaplayer, and put my game in it so that it would load my game, but when you go to look for it on your psp it will still show the luaplayer icons, and say luaplayer.
does anyone know how to change this? because many of you who have released games know i guess, and i need to do this. Any help is appreciated.
-= Double Post =-
and after reading my post, it sounds confusing, so i want to tell everyone that i am trying to make it a standalone eboot, instead of having my game loaded from lua player.Geändert von emericaska8r (01-24-2007 um 01:34 PM Uhr) Grund: Automerged Doublepost
-
01-24-2007, 01:39 PM #5236QJ Gamer Blue
- Registriert seit
- Jul 2006
- Beiträge
- 72
- Points
- 4.209
- Level
- 41
- Downloads
- 0
- Uploads
- 0
You're supposed to be able to do that with a program called PSpbrew, but I found it so confusing so I just got one of my beta testers do do it for me
Zitat von emericaska8r
You can google a tutroial
Thanks, guys, for answering my question. I got it working
-
01-24-2007, 05:31 PM #5237QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
i have a quick question: is it possible to wrap text (on the psp screen) in lua, so i dont have to screen:fontPrint 6 times to fit my words in?
If so, what function is used? Thanks for your help!
-
01-24-2007, 06:47 PM #5238
@: parm289
I had the same problem with my lua app. and the only solution i found to be the easiest and fastest was to make a transparent png and write your text in a program like gimp or photoshop. Save it and then load it and then blitted to the screen if u want an example or any further help i would be glad to help you just send me a pm.
@: emericaska8r
Read Your PMs'
-
01-24-2007, 07:04 PM #5239QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
yeah, thats a good idea - i just used a lot of screen:fontPrints to do the job. doesnt look too snazzy, but it'll do the job for an faq page.
-
01-24-2007, 07:10 PM #5240
Im glad it helped
-
01-24-2007, 07:21 PM #5241QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
no problem, another noob question though:
i have a variable a, and the value of it constantly changes as the user presses the l and r buttons. i.e.:
that's not the real code, but i think you will get the idea. Now, the value of this variable is going to be displayed on the screen for the duration of a "while true do" loop. However, i can't seem to print the variable's value to the screen. I tried this:Code:if pad:l() then a = a+1 end if pad:r() then a = a-1 end
.....but it didn't work. How can i get the valua of a variable as a string, so i can print it to the screen? Thanks for your help.Code:screen:fontPrint(comic,0,0,a,white) screen:flip() screen.waitVblankStart(300) end
-
01-24-2007, 07:25 PM #5242QJ Gamer Bronze
- Registriert seit
- Aug 2006
- Ort
- Washington
- Beiträge
- 759
- Points
- 9.999
- Level
- 66
- Downloads
- 0
- Uploads
- 0
im trying to make a platform game and cuz im a dumb**** i dont know how to start, like i need to be able to have a flat image just move along all the time as the player does the image stuff is easy for me just the code.....
(´・ω・‘)ノシ
-
01-24-2007, 07:35 PM #5243
@: parm289
Did you establish the value of your variable before your while true do loop
Some sample code and an error message would be a lot better to help you.
-= Double Post =-
@: Jomann
I believe your problem is scrolling, so you might want to look for some scrolling tutorials. I have the feeling scrolling has been covered in this thread before. If I find a link that can help you with the scrolling I'll post it later.Geändert von Dr.Gringo (01-24-2007 um 07:35 PM Uhr) Grund: Automerged Doublepost
-
01-24-2007, 07:41 PM #5244QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
yes, i did establish the variable a, as a = 0. Here's some sample code:
Code:while true do local pad = Controls.read() if pad:select() then faq() end if pad:start( ) then screen:clear( ) countForm( ) screen:fontPrint(comic,0,0,a,white) screen.flip( ) screen.waitVblankStart(300) end screen:blit(0, 0, bg2) screen:fontPrint(comic,115,20,"Welcome to Parm's Card Counting app.",white) screen:fontPrint(comic,130,40,"For help and FAQs, press Select.",white) screen:fontPrint(comic,138,60,"To start counting, press Start.",white) screen.flip() endHowever, running this code, i do not get an error message, just a blank (black) screen, with no text. I'm pretty sure this is because i need to somehow obtain the string (which is just a one or two digit number) from the variable a. I'm guessing it only takes a small portion of code to do this, but searched wikis and google, and found nothing....Code:function countForm() a = 0 if pad:r( ) then a = a+1 end if pad:l( ) then a = a-1 end while true do screen:print(a) screen.flip( ) screen.waitVblankStart(300) end end
Thanks for your almost-immediate replies
EDIT: I added the function countForm into this post, so you can check out the way i declared the variable.
-
01-24-2007, 07:43 PM #5245QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- Missouri
- Beiträge
- 451
- Points
- 6.041
- Level
- 50
- Downloads
- 0
- Uploads
- 0
How do I get it so it waits for one animation blit to be over untill it blits another image? I know i'm not supposed to do this but what else can I do.
Ex.
They load correctly, but they just go over eachother, and yes i know if I put screen:clear() between them it would clear the screen for the "screen" image but it won't show the animation.. In time that is..Code:while true do logo:advancedBlit(0,0,500,1) screen:blit(0,0,screen) screen:waitVblankStart() screen.flip() end
-
01-24-2007, 08:46 PM #5246Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von Cheez Pirate
try this: (not sure itll work however):
remember, animlib depends on states.Code:state = anim while true do if state == anim then logo:advancedBlit(0,0,500,1) state = other end if state == other then screen:blit(0,0,screen) end screen:waitVblankStart() screen.flip() end
--------------------------------------------------------------------------------------
-
01-24-2007, 09:01 PM #5247
@: Cheez Pirate
If you want to create an animation I believe using a timer would be the best. If you are a total noob at timers try going to EvilMana for some tutorials.
-= Double Post =-
@: parm289
I have a feeling a should equal 1 when you declare the value but since im doing some really hard homework right now i dont really have time to look for some solutions... I'll be here tomorrow at 6:00 P.M. If you need some more help.
Wait... you should establish the value of "a" outside the while true do loop and outside your functions so you can access it trough the font print. Go and try it. Report what you get.
Ohh and one more thing. What are all those waitVblanks for???Geändert von Dr.Gringo (01-24-2007 um 09:04 PM Uhr) Grund: Automerged Doublepost
-
01-25-2007, 08:41 AM #5248QJ Gamer Blue
- Registriert seit
- Dec 2006
- Beiträge
- 347
- Points
- 5.056
- Level
- 45
- Downloads
- 0
- Uploads
- 0
dr gringo: i tried both of your solutions, but i did not get to test them because of another small problem...i cannot get the app to detect the start button when it's being pressed. there is no official error message returned by luaplayer, but at the main menu, the start button doesnt work.
heres the code that the error is located in:
I'm sorry for being noobish, but this is my first lua app, so be patient. Thanks for your help.Code:while true do local pad = Controls.read() if pad:select() then faq() end if Controls.read():start() then screen:clear( ) countForm( ) screen:fontPrint(comic,0,0,a,white) screen.flip( ) screen.waitVblankStart(300) end screen:blit(0, 0, bg2) screen:fontPrint(comic,115,20,"Welcome to Parm's Card Counting app.",white) screen:fontPrint(comic,130,40,"For help and FAQs, press Select.",white) screen:fontPrint(comic,138,60,"To start counting, press Start.",white) screen.flip() end
EDIT: gringo: i'm guessing you downloaded the game package from my other thread, which is outdated...but anyway, the waitvblanks are for the loading and splash screens at the launch of the app.
-
01-25-2007, 08:43 AM #5249QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
whats the exact error and which line?
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
01-25-2007, 08:51 AM #5250Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Yeah you have to be more specific if you want us to help you out


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