Your perceived knowledge makes me seriously doubt you're using the resources available to find answers. You need to start.
Printable View
Did you look on lua.org?
Im not familiar with pgelua, can someone who has worked with regular luaplayer and pge know if it may be possible to write out a script to maybe convert luaplayer files to pge compatible files.
Im aware that pge will have more functions, but id much rather look through an already converted lua file looking for ways to optimize my code, then it would be for me to totally rewrite the program.
I always seem to have trouble describing what i mean, please lemme know if i made my self clear hehe.
You have a terrible misconception on the difference between Lua and Luaplayer etc. Read more, it helps. And did you even click on my link?
sectioneight - while it would be possible, it would not be practical or take advantage of PGE's capabilities. I would recommend looking at PGE's samples and programs written with it and just relearning rather than trying to base off LP's API.
yeh ive read over the documentation that they have up and it seems like it would help me out alot, just on the gfx rendering stuff alone. the problem is i am far along in my project and it would sux majorly if i were to have to rewrite everything all over again. I guess im looking for an easy answer where there is none. The advantage would be a speed boost but in order to do that i am going to have to completely rewrite the code. There's no windows pge luaplayer and that would mean i lose my partner. I think ill just wait till they release a windows player .
It's not too hard to switch over to PGE. I did it while in mid project in about 3 hours.
Basically, you only need to rewrite the drawing functions, and texture handling.
Everything else is pretty much fine. PGE has it's own math functions, but Lua's are still there if you don't want to bother.
All I did was look at what the PGE's functions were for drawing and setting up the screen, "find and replace"'d the code, and a bit more tweaking, and I had it done.
Once you get used to, and learn OOP then it's all basically the same.
Hi guys
I bet this is asked so many times before, but how do you get flash0 access with lua?
This is a small piece of a simple menu with different options, including copying files to flash1.
What do i have to change to make this work with flash0???Code:if pad:cross() and not oldpad:cross() and ms == 1 then
System.removeFile("flash1:/new/test.txt")
end
if pad:cross() and not oldpad:cross() and ms == 2 then
afbeelding1 = Image.load("vc.png")
screen:blit(0, 0, afbeelding1, false)
screen.flip()
screen.waitVblankStart(300)
end
if pad:cross() and not oldpad:cross() and ms == 3 then
direxsist = System.doesDirExist("flash1:/new")
if direxsist == 1 then
else
System.createDirectory("flash1:/new")
screen.flip()
end
curdir = System.currentDirectory()
filexist = System.doesFileExist("flash1:/new/test.txt")
if filexist == 1 then
System.removeFile("flash1:/new/test.txt")
screen.flip()
end
System.copyFile(curdir.."/test1.txt","flash1:/new/test1.txt",0)
screen.flip()
end
tnx
SG57 made a LuaPlayer with flash write access.
You have to search for it. I remember you had to assign something to something then write a file to flash0.
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
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.
tnx, I'll give it a try
It's the same thing...Zitat:
Zitat von dan369
You have to be using the eboot with the flash write/assign functions
yes you can make two buttons function as one, just do this.
pad = Controls.read()
if pad:cross() and pad:square() then
break
end
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)
end
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)
end
you forgot pad = Controls.read()........
.......
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?
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()
end
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! ^^
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
end
I'm not really sure what the problem is, it should work.......
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)
end
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
It might have, I'm going to find out.
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 either
What HM version you using?
uuuhm, the drivers are from luaplayer hm8 and I make my eboot with mirolua 2.6
Why don't you just use HMv2? The drivers are bulit in & its much faster than HM8
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
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.
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...
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.