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; Tnx for the reply, but I found it already in someone else's script and now I'm testing it with a ...
-
02-27-2009, 04:29 AM #9691
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
Tnx for the reply, but I found it already in someone else's script and now I'm testing it with a simple recovery.prx flasher (to change colours of recovery menu)
New problem:Code:red = Color.new(255, 0, 0) background = Image.load("RecoveryMenu") done = false while true do pad = Controls.read() if pad:cross() and done == false then System.unassign("flash0:") System.assign("flash0:", "lflash0:0,0", "flashfat0:") System.copyFile("ms0:/PSP/GAME/Recovery_menu_flasher/recovery.prx","flash0:/vsh/module/recovery.prx",0) done = true end if done == false then screen:print(200, 130, "Press X to flash your new Recovery Menu", red) else screen:print(200, 261, "Done! Please shutdown the PSP...!", red) end
When I press up to activate USB, usb gets activated, but the 2 last lines on the screen (= the 2 lines you see here) start to flicker and the loop gets stuck, pressing home works, and the script still accepts button input when putting backlight back on, but is has no effect anyfurtherCode:if pad:up() and done == false then System.usbDiskModeActivate() done = true end if done == false then screen:print(100, 110, "Press up to activate USB", red) end if pad:down() and done == false then System.usbDiskModeDeactivate() done = true end if done == false then screen:print(100, 140, "Press down to deactivate USB", red) end
Geändert von Ben93 (02-27-2009 um 06:41 AM Uhr) Grund: new problem
-
02-27-2009, 10:01 AM #9692Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
instead of done == true/false you should just have
Code:if done then --would be true if 'done' is true. --OR if not done then --which would be if 'done' was false.
-
02-27-2009, 10:46 AM #9693
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
tnx, I'll give it a try
-
02-27-2009, 12:32 PM #9694QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
It's the same thing...
Zitat von dan369
-
02-27-2009, 12:46 PM #9695Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
02-27-2009, 08:13 PM #9696lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
You have to be using the eboot with the flash write/assign functions
-
02-28-2009, 09:27 AM #9697
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
-
03-08-2009, 09:15 PM #9698Developer
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 71
- Points
- 13.989
- Level
- 76
- Downloads
- 0
- Uploads
- 0
yes you can make two buttons function as one, just do this.
pad = Controls.read()
if pad:cross() and pad:square() then
break
end
-
03-11-2009, 01:23 PM #9699QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
If you didn't get it by now.
Code:done = false red = Color.new(255,0,0) while not done do if pad:up() then System.usbDiskModeActivate() done = true end if pad:down() then System.usbDiskModeDeactivate() done = true end if pad:circle() or pad:triangle() then break end screen:print(100,110,"Press up to activate USB.",red) screen:print(100,120,"Press down to deactivate USB.",red) screen:print(100,130,"Press circle or triangle to exit.",red) endAIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-11-2009, 05:22 PM #9700QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
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
-
03-11-2009, 05:31 PM #9701QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Your right here this is better.
Code:red = Color.new(255,0,0) while true do screen.clear() pad = Controls.read() if pad:up() then System.usbDiskModeActivate() end if pad:down() then System.usbDiskModeDeactivate() end if pad:circle() or pad:triangle() then break end screen:print(100,110,"Press up to activate USB.",red) screen:print(100,120,"Press down to deactivate USB.",red) screen:print(100,130,"Press circle or triangle to exit.",red) endGeändert von Digikid13 (03-12-2009 um 02:35 PM Uhr)
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-12-2009, 12:15 AM #9702Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
you forgot pad = Controls.read()........
-
03-12-2009, 02:34 PM #9703QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
.......
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-13-2009, 12:26 AM #9704xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Hey guys, looking into lua, i wanna see how to do some basic stuff.
This doesn't work though.
But i always prints/does what ever is in the X event even when i dont press it.Code:local green = pge.gfx.createcolor(255, 150, 0) local white = pge.gfx.createcolor(255, 255, 255) local black = pge.gfx.createcolor(0,0,0) local whitesemi = pge.gfx.createcolor(255, 255, 255, 50) local verdana9 = pge.font.load("verdana.ttf", 9, PGE_RAM) if not verdana9 then error("Failed to load font.") end local verdana12 = pge.font.load("verdana.ttf", 30, PGE_RAM) if not verdana12 then error("Failed to load font.") end local logo = pge.texture.load("background.png") if not logo then error("Failed to load logo.") end local index = 1 local basedir = pge.dir.getcwd() while pge.running() do pge.controls.update() pge.gfx.startdrawing() pge.gfx.clearscreen() logo:activate() logo:draweasy(0, 0) verdana12:activate() verdana12:printcenter(10, white, "TestGame") verdana12:printcenter(115, white, "TestGame2") verdana12:printcenter(200, black, "Press X to continue") verdana12:printcenter(235, black, "Press O to Quit.") if pge.controls.pressed(PGE_CONTROL_CROSS) then verdana12:printcenter(60, white, "X presses") end if pge.controls.presses(PGE_CONTROL_CIRCLE) then pge.exit() end pge.gfx.enddrawing() pge.gfx.swapbuffers() end
Any help?
-
03-13-2009, 12:08 PM #9705QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I'm not sure what is wrong with yours, but this works for me.
Code:local green = pge.gfx.createcolor(255, 150, 0) local white = pge.gfx.createcolor(255, 255, 255) local black = pge.gfx.createcolor(0,0,0) local verdana12 = pge.font.load("verdana.ttf", 30, PGE_RAM) if not verdana12 then error("Failed to load font.") end local logo = pge.texture.load("background.png") if not logo then error("Failed to load logo.") end while pge.running() do pge.controls.update() pge.gfx.startdrawing() pge.gfx.clearscreen() logo:activate() logo:draweasy(0, 0) verdana12:activate() verdana12:printcenter(10, white, "TestGame") verdana12:printcenter(115, white, "TestGame2") verdana12:printcenter(200, white, "Press X to continue") verdana12:printcenter(235, white, "Press O to Quit.") if pge.controls.pressed(PGE_CTRL_CROSS) then verdana12:printcenter(60, white, "X pressed") end if pge.controls.pressed(PGE_CTRL_CIRCLE) then pge.exit() end pge.gfx.enddrawing() pge.gfx.swapbuffers() endGeändert von Digikid13 (03-15-2009 um 12:31 PM Uhr)
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-15-2009, 07:33 AM #9706
Achievements:
- Registriert seit
- Mar 2009
- Beiträge
- 1
- Points
- 1.886
- Level
- 25
- Downloads
- 0
- Uploads
- 0
Hello! newbie here
Is there a LIBCURL like function for LUA? or any function/snippet that can download a file from http/ftp and save it to the memory stick?
thanks in advance! ^^
-
03-18-2009, 02:38 PM #9707QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- GA, USA
- Beiträge
- 243
- Points
- 9.319
- Level
- 64
- Downloads
- 0
- Uploads
- 0
Ok, I have finally decided to post to get some help with my script. I need to get this to work on LPHMv2.
I need to load "icon.png" from all folder under "resource". My folder structure is:
App Folder
/\
resource
/\
folder a | folder b | folder c | etc. etc.
I need to load "icon.png" from folders a,b,c...
I am trying to load them with:
I keep having it crash when I remove "break" from the function. I have been trying to fix this most of today. I am trying to load all the images before I start my main loop so they will be ready to blit.Code:icon = {} function get_icons() for i=3,listnum do if System.doesFileExist("resource/" ..list[i].name .."/icon.PNG") == 1 then icon[i-3] = {img = Image.load("resource/" ..list[i].name .."/icon.PNG")} else error_message = "Error: Get Icons Failed." System.message("Information: \n" ..error_message .."\nError Message: 001HP \nWe apologize for any inconvenience.","0") error = 1 break end end endMy Anime List || My Homepage- Keep up with my projects || Userbar
Projects:
Unamed RPG- In Progress
Lua File Manager & Extraction GUI
PSP Soundboard
-
03-22-2009, 04:58 AM #9708QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I'm not really sure what the problem is, it should work.......
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-26-2009, 01:26 PM #9709
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
-
03-29-2009, 01:32 PM #9710QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Yes but I forgot something.
Code:red = Color.new(255,0,0) while true do screen.clear() pad = Controls.read() if pad:up() then System.usbDiskModeActivate() end if pad:down() then System.usbDiskModeDeactivate() end if pad:circle() or pad:triangle() then System.usbDiskModeDeactivate() --<---This break end screen:print(100,110,"Press up to activate USB.",red) screen:print(100,120,"Press down to deactivate USB.",red) screen:print(100,130,"Press circle or triangle to exit.",red) endAIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
04-04-2009, 02:30 AM #9711
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
tnx again!
But what do i have to do if i want to implement the drivers in my brew.
Somebody told me it have to be something like this, but it doesn't work
This on the first line:
And this after pad = Controls.read()Code:doesLPHMDriversExist = System.doesFileExist("ms0:/seplugins/load.pbp")
load.pbp is in seplugins, but i dont know anymore how it got there, was it installed with the drivers? (I deleted them from flash1 for testing the install function now in my brew)Code:if doesLPHMDriversExist==0 then System.message("The LPHM Drivers don't seem to be installed, please press Yes to install them now.",1) button = System.buttonPressed(1) if button == "yes" then dofile("ms0:/PSP/GAME/Recovery_prx_flasher/drivers/installDrivers2.lua") end
-
04-04-2009, 11:28 AM #9712QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
It might have, I'm going to find out.
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
04-04-2009, 02:43 PM #9713
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
There just has to be a way to use some lua functions, whitout having the drivers installed, because, the drivers are just for some functions as ISO etc, don't they?
Whatever i try, I keep getting the message "luahmdrivers aren't installed....."
Maybe it works if I do System.runeboot with an eboot - I made of the script for the drivers - for installing the drivers instead of doing dofile for the script to install?
EDIT: doesn't work eitherGeändert von Ben93 (04-04-2009 um 03:02 PM Uhr)
-
04-04-2009, 02:46 PM #9714Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
What HM version you using?
-
04-04-2009, 02:57 PM #9715
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
uuuhm, the drivers are from luaplayer hm8 and I make my eboot with mirolua 2.6
-
04-04-2009, 04:44 PM #9716Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Why don't you just use HMv2? The drivers are bulit in & its much faster than HM8
-
04-05-2009, 01:45 AM #9717
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
So, you are saying that I don't have to make my eboot with mirolua, but that I have to use my script with the eboot from lua hm v2 so that I don't have to install the drivers?
It's working now, because i just put whole my script after the script for installing the drivers, and use the same eboot for installing the drivers, wich have to be lua hmv2 if I get things right?
Sorry, pretty noobish
-
04-05-2009, 01:59 AM #9718Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
You don't 'have' to use it, but it comes with everything in the eboot(don't have to install drivers).
Though, there is slight changes in the API, so you'll need to read it's docs.
-
04-05-2009, 02:14 AM #9719
Achievements:
- Registriert seit
- Feb 2009
- Beiträge
- 17
- Points
- 1.973
- Level
- 26
- Downloads
- 0
- Uploads
- 0
tnx, I'll take a look at it. So i have to put my script.lua in the same directory as the eboot?
Another thing: does an mp3 file have to be in special bitrate or sample? because it won't load...
-
04-05-2009, 02:29 AM #9720Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Yeah, same directory. Yeah, i think so. I think HMv2 uses the actually PSP media code(to play music), & some mp3 formats aren't support but these are very few, you'll have to ask someone else about the mp3 as i don't use HMv2.


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