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; can someone please help me make a file browser for LuaPlayer HMv2? i've tried a bunch of times but i ...
-
06-24-2009, 05:15 PM #9991QJ Gamer Green
- Registriert seit
- Nov 2008
- Beiträge
- 35
- Points
- 2.236
- Level
- 28
- Downloads
- 0
- Uploads
- 0
can someone please help me make a file browser for LuaPlayer HMv2?
i've tried a bunch of times but i can't figure out to make it work.
please help
ps. i've already tried the code from evilmana.com codebase and it doesn't work in LuaPlayer HMv2.
-
06-24-2009, 06:21 PM #9992QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
06-24-2009, 07:28 PM #9993QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
In Lua, true is equalivent to one and false is equalivent to zero. The point I am making (and you are missing) is that using 1 and 0 with the boolean operator 'not' does not give the same result as using booleans, therefore it is important to know whether a function is returning a boolean or an integer to use it 100% correctly.
Doesn't work in what way? Does the music play at all? Does it not loop? Did you use the EXACT code?Also I've already tried the method you've provided, it doesn't work.[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]
-
06-24-2009, 07:44 PM #9994QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
06-24-2009, 08:35 PM #9995QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
So eos doesn't work as advertised? If that is the case then the only real alternative is to either ask the author to fix it, use another LuaPlayer (like PGE) or use a timer and play the music every X seconds where X is the length of the song.
OT: But after reading the readme again, the syntax correct version of the code I used should be:
Unlikely to make a difference in the behaviour though.Code:Ogg.load("Music.ogg"); Ogg.play(); while true do if Ogg.eos() == 1 then Ogg.play(); end end[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]
-
06-24-2009, 08:47 PM #9996QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
Oh no, it works 100% as advertised. The following will work properly:
This will print text at the end of the song's duration. The problem is in the player itself as I've previously stated. But as also previously stated it is no longer a problem. I also contacted the dev of the player well before I posted in this thread.Code:Ogg.load("Music.ogg"); Ogg.play(); while true do if Ogg.eos() == 1 then screen:print(0,0,"Blah",0) end end
-
06-25-2009, 02:12 AM #9997Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
oh yeah i forgot to mention i havent spoken to hm for a while but there is a problem with the sound functions.
you can only play a sound once and not loop it because they are set up wrong and the system.sound() function or whatever it is that enables some of the other sound functions some do not work and im pretty sure that if you use them they lock up your psp.
if only i would have told you sooner
silly me eh.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
06-25-2009, 03:53 AM #9998Developer
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 71
- Points
- 13.989
- Level
- 76
- Downloads
- 0
- Uploads
- 0
you can loop a sound or song with LPHM v2, i've done it many times myself. the reason why you can't get it to loop is because you have to reload the sound/song file before playing it again.
for ex.
if you want a code that you can use to try for yourself i can give you one. you can loop your sounds and songs. i've done it myself already.Code:if foo.eos() then foo.load("foo.song") foo.play() end
-
06-25-2009, 07:28 AM #9999Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i said that you could only play a sound once and not loop it i did not say however that there was no way at all to loop a sound.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
06-25-2009, 08:28 AM #10000Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
10,000th post
-
06-25-2009, 09:13 AM #10001QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
06-25-2009, 09:22 AM #10002Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
XD i told him to get it for a laf i would have got it myself but you just cant doubble post, look on the bright side you have the 10000th post if you look on the dev forum lol as it doesnt include the posters post XD.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
06-25-2009, 09:33 AM #10003Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
06-25-2009, 01:41 PM #10004Banned from QJ for LIFE
- Registriert seit
- Jul 2006
- Beiträge
- 1.557
- Points
- 10.957
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol shall i delete dans post? :P
-
06-25-2009, 04:00 PM #10005Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i vote no but your the mod lol.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
06-26-2009, 09:54 AM #10006QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Okay I got 2 question,
First Whats the best luaplayer for games,
PGELUA
Luaplayer HM
Luaplayer Euphoria
Second question, I want to add alpha colors to my game does anyone know how to do that?
-
06-26-2009, 10:17 AM #10007Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
1. PGE
2. Read PGE's docs, its all there.
-
06-26-2009, 10:25 AM #10008Banned from QJ for LIFE
- Registriert seit
- Jul 2006
- Beiträge
- 1.557
- Points
- 10.957
- Level
- 69
- Downloads
- 0
- Uploads
- 0
-
06-26-2009, 10:29 AM #10009QJ Gamer Green
- Registriert seit
- Nov 2008
- Beiträge
- 35
- Points
- 2.236
- Level
- 28
- Downloads
- 0
- Uploads
- 0
i need some help please, im trying to make an mp3 player in LuaPlayer HMv2. i've already got the music browser working but when you click a mp3 it freezes. here's my code:
the browser's kinda wierd too, i still gotta fix it so if you can also help with the y position that'd be great.System.currentDirectory(" ms0:/MUSIC")
kristen = Font.load("ms0:/PSP/GAME/Zero+ v1/KristenITC.TTF", 10)
red = Color.new(255, 0, 0, 255)
green = Color.new(0, 255, 0, 255)
blue = Color.new(0, 0, 255, 255)
white = Color.new(255, 255, 255, 255)
black = Color.new(0, 0, 0, 0)
nickname = System.nickName()
battery = System.powerGetBatteryLif ePercent()
life = System.powerGetBatteryLif eTime()
cfw = System.cfwVersion()
year = System.getDate(1)
month = System.getDate(2)
day = System.getDate(3)
hour = System.getTime(1)
minute = System.getTime(2)
second = System.getTime(3)
millisecond = System.getTime(4)
model = System.getModel(1)
volume = System.getVolume()
brightness = System.getBrightness()
mc = {s = 1, fl = System.listDirectory("ms0 :/MUSIC/"), ls = 1, sp = 10}
mc.nf = table.getn(mc.fl)
oldpad = Controls.read()
function runmc()
for i = ((mc.ls-1)*mc.sp)+1, mc.ls*mc.sp do
if mc.nf >= i then
screen.startDraw()
screen.clear(0)
screen.print(5,((i-((mc.ls-1)*mc.sp))*10)-10, mc.fl[i].name, 1, white, white, 1)
screen.print(5,((mc.s-((mc.ls-1)*mc.sp))*10)-10, mc.fl[mc.s].name, 1, red, white, 1)
Font.print(kristen, 0, 10, "Welcome " .. nickname .. "", red)
Font.print(kristen, 0, 20, "Your Custom Firmware is " .. cfw .. "", red)
Font.print(kristen, 0, 30, "You Have A PSP: " .. model .. "", red)
Font.print(kristen, 380, 10, "" .. month .."/" .. day .. "/" .. year .. "", red)
Font.print(kristen, 380, 20, "" .. hour .. ":" .. minute .. ":" .. second .. ":" .. millisecond .. "", red)
Font.print(kristen, 380, 30, "" .. battery .. "%", red)
Font.print(kristen, 380, 40, "" .. life .. " Min.", red)
Font.print(kristen, 380, 50, "Brightness: " .. brightness .. "", red)
Font.print(kristen, 380, 60, "Volume: " .. volume .. "", red)
Font.print(kristen, 5, 220, "Created by ZeroorDie559", red)
Font.print(kristen, 5, 230, "************************ ************************* ************************* *****", red)
screen.flipscreen()
screen.endDraw()
screen.flipscreen()
elseif mc.nf < i then break end
end
if pad:down() and not oldpad:down() then mc.s = mc.s + 1 end
if pad:up() and not oldpad:up() then mc.s = mc.s - 1 end
if mc.s > mc.nf then mc.s = mc.nf elseif mc.s < 1 then mc.s = 1 end
if mc.s > mc.sp*mc.ls then mc.ls = mc.ls + 1
elseif mc.s < ((mc.ls-1) * mc.sp)+1 then mc.ls = mc.ls - 1 mc.s = (mc.ls)*mc.sp end
if pad:cross() and not oldpad:cross() then
if not mc.fl[mc.s].directory then
if string.lower(string.sub(m c.fl[mc.s].name, -4)) == ".mp3" then
mp3 = Mp3me.load("mc.fl[mc.s].name")
Mp3me.play("" .. mp3 .. "")
elseif string.lower(string.sub(m c.fl[mc.s].name, -4)) == ".wma" then
wma = ALL.load("mc.fl[mc.s].name")
ALL.play("" .. wma .. "")
end
elseif mc.fl[mc.s].directory then
System.currentDirectory(m c.fl[mc.s].name)
mc.s = 1
mc.fl=System.listDirector y()
mc.nf=table.getn(mc.fl)
mc.ls = 1
end
elseif pad:triangle() and not oldpad:triangle() then
if System.currentDirectory ~= "ms0:/MUSIC" then
System.currentDirectory(" ./..")
mc.s = 1
mc.fl=System.listDirector y()
mc.nf=table.getn(mc.fl)
mc.ls = 1
end
end
end
analog_X = pad:analogX()
analog_Y = pad:analogY()
mode = {x = System.getBrightness(), y = System.getVolume()}
if analog_X > 50 then
if mode.x < 95 then
mode.x = mode.x + 2
end
elseif analog_X < -50 then
if mode.x > 0 then
mode.x = mode.x - 2
end
end
if mode.x ~= System.getBrightness() then
System.setBrightness(mode .x)
end
if analog_Y < -50 then
if mode.y < 30 then
mode.y = mode.y + 1
end
elseif analog_Y > 50 then
if mode.y > 0 then
mode.y = mode.y - 1
end
end
if mode.y ~= System.getVolume() then
System.setVolume(mode.y)
end
if pad:select() then
screenshot = System.startOSK("Screensh ot.jpg", "ms0:/PSP/PHOTO/Zero+ Screenshots/")
screen.save("" .. screenshot .. "")
end
while true do
pad = Controls.read()
screen.clear(0)
runmc()
screen.waitVblankStart()
screen.flipscreen()
oldpad = pad
if pad:start() then break end
end
-
06-26-2009, 11:35 AM #10010
Could someone please tell me how to check collision based on colour. I have checked but found nothing.
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
06-26-2009, 01:55 PM #10011QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
I tried to convert my code to PGELua but it seems very different it don't uses screen.waitVblankstart and screen.flip and more of those kinda things..
Can you tell me how to make an alpha color in luaplayerHM?
-=Double Post Merge =-
I used luaplayerHMv2 also but it seems that MP3 function is bugged.. But try luaplayerHM7 RC1 Mp3 function there worked for me..Geändert von Predricted (06-26-2009 um 01:57 PM Uhr) Grund: Automerged Doublepost
-
06-26-2009, 02:40 PM #10012Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
ColourObject = Color.new(red, green, blue, alpha)
--IN pge
ColourObject = pge.gfx.createcolor(red, green, blue, alpha)
-
06-26-2009, 03:06 PM #10013QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-26-2009, 04:28 PM #10014Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Are you sure? Which HM you using the latest one?
-
06-26-2009, 08:49 PM #10015QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Beiträge
- 69
- Points
- 2.018
- Level
- 27
- Downloads
- 0
- Uploads
- 0
does luaplayer hmv2 support normal lua code?(i coded it for luaplayer 0.2 but need a hm function)
-
06-27-2009, 04:31 AM #10016QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
LPHMv2 supports most of the lua code, but there are diffrent (modified) functions.
eg:is in LPHMv2:Code:screen:print(x,y,text,color)
Code:screen.print(x,y,text,size,color,glow color, pgf font from 0-7)
That epic dude.
-
06-27-2009, 08:05 AM #10017QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-27-2009, 08:33 AM #10018Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I don't think it works in HM7.
-
06-27-2009, 08:47 AM #10019QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-29-2009, 09:41 AM #10020Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
pge can use alpha colours and i dont think any of the other playes could it was either 255 or 0 atleast that is what i found i think it may have been a bug.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).


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