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; does anyone know how to use the System.irda() functions? i'm trying to use it in my app but whenever i ...
-
06-22-2009, 09:03 PM #9961QJ Gamer Green
- Registriert seit
- Nov 2008
- Beiträge
- 35
- Points
- 2.236
- Level
- 28
- Downloads
- 0
- Uploads
- 0
does anyone know how to use the System.irda() functions?
i'm trying to use it in my app but whenever i press on the function nothing happens. can someone help me?
-
06-23-2009, 03:40 AM #9962QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
06-23-2009, 04:25 AM #9963QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[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-23-2009, 04:39 AM #9964Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
As a little note, from what the docs said, you can't play multiple .ogg files at one time. I think your using it just as a backing track but just incase. Your better opinion would be .wav for sound effects e.g attacks, damage noise etc.
Also would it be possible to use .ogv? .OGV is the ogg video format, the files are very small & would be great for HM. I don't know what lib HM uses, i think its libvorbis? Has that got the support (i know this is C related more than Lua but it crosses over ;) )
-
06-23-2009, 08:54 AM #9965QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Is there amount of max images you can load cause i get error when I load more then ?? amount of images then it gives
Image.load:error loading image
-
06-23-2009, 09:37 AM #9966
I haven't coded in a while. How would I check collision based on color?
pixel:color = black ?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-23-2009, 10:31 AM #9967QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 11:10 AM #9968Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 11:34 AM #9969Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
or the psp ran out of ram to store x ammount of images.
anyway onto my question anyone got a link to the latest release of pge luaplayer plz.------ 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-23-2009, 12:07 PM #9970Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 12:09 PM #9971QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 12:16 PM #9972Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
so you just skipped over my post then, why are you loading so many images, what for as there may be a solution to reduce the ammount of images that need to be loaded or displayed.
p.s. thanks dan------ 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-23-2009, 01:18 PM #9973QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 05:46 PM #9974QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
You don't have to load them all at the same time.
-
06-23-2009, 06:08 PM #9975QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 06:27 PM #9976QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
06-23-2009, 06:28 PM #9977QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
06-23-2009, 06:54 PM #9978QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
I even double checked dude,
I did this:
Removed the Image.load("Image/Some_Image.png") With error
and added a Image.load("Image/Some_Image.png") which had no error on the same line and i had still a image load blabla error
-=Double Post Merge =-
Well how then?? Like loading them in a while loop?
I tried and still the error at one lineGeändert von Predricted (06-23-2009 um 06:54 PM Uhr) Grund: Automerged Doublepost
-
06-23-2009, 09:15 PM #9979QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
06-24-2009, 12:19 AM #9980QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
06-24-2009, 01:25 AM #9981QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
-
06-24-2009, 02:57 AM #9982Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
In which way do you mean it causes slow down, if you unload an image and load another in its place im pretty sure that the psp would not have a noticable swap time if any at all
true true, why do people even argue with others that they know are better at coding than them and usually have more experience, atleast it seems like Xteaph-N doesnt know that much about this subject but is arguing just for the sake of it o_O.
p.s. it is because he is loading too many images and the psp runs out of ram, i have experienced the same problem a long time ago when i began coding in lua so you might aswel stop arguing now but thats up to you.------ 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-24-2009, 03:40 AM #9983Developer
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 71
- Points
- 13.989
- Level
- 76
- Downloads
- 0
- Uploads
- 0
Okay, the way your calling it to check if it's the end of the song is wrong. i figured it out myself on why that doesn't work.
the way that you call it is like,
if Ogg.eos() then
Ogg.play(your song)
end
it is not
if Ogg.eos() == 1 then
that will not work
-=Double Post Merge =-
the reason why your music can't be played again after you stop it is because you have to reload the file to be played again. and if you want the ogg file to loop try this
for example:
I've tested that out myself and when you press Circle or when the song ends it restarts the song, and when you press Cross it stops the songCode:BG1 = Ogg.load("Music.ogg") music="true" while true do pad=Controls.read() if pad:circle() or Ogg.eos() then music="true" end if pad:cross() then music="false" end if music=="true" then Ogg.stop() BG1 = Ogg.load("Music.ogg") music="play" end if music=="play" then Ogg.play() end if music=="false" then Ogg.stop() end endGeändert von qwikrazor87 (06-24-2009 um 05:19 AM Uhr) Grund: Automerged Doublepost
-
06-24-2009, 06:19 AM #9984QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Directly from the readme:
If the readme is wrong then someone needs to update it.Ogg.eos() Returns 1 for EndOfSong and 0 for still playing.
-=Double Post Merge =-
The code doesn't continuously loop the music which is what the OP asked for:
Geändert von yaustar (06-24-2009 um 06:20 AM Uhr) Grund: Automerged Doublepost
[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, 06:25 AM #9985Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
in some coding routines true is sometimes a substitute for the value of 1, therefore is ogg.eos() returns 1 then both the if ogg.eos() and ogg.eos() == 1 then methods will work.
------ 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-24-2009, 12:09 PM #9986QJ Gamer Blue
Achievements:
- Registriert seit
- May 2009
- Ort
- California
- Beiträge
- 75
- Points
- 2.165
- Level
- 28
- Downloads
- 0
- Uploads
- 0
Um guys, the following all mean the same in lua:
Code:--True Statments if ogg.eos() then Ogg.play() end if ogg.eos() == true then Ogg.play() end if ogg.eos() == 1 then Ogg.play() end --False Statments if not ogg.eos() then Ogg.play() end if ogg.eos() == false then Ogg.play() end if ogg.eos() == 0 then Ogg.play() end
ogg.eos() returns boolean. You can handle it like any other function that returns boolean.
-
06-24-2009, 02:37 PM #9987QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
I know what X-teaph means I tried Dynamicly but really amateur way I did this:
But it didn't help it slowed the game and showed errors, but I composed the 480*272 cause I thought I would save hell of time with it but damn no...Code:while gamemod=="playing" do if player.x < 480 and player.x > -480 and player.y < 272 and player.y > -272 then bg1=Image.load(images/background/1.png) bg2=Image.load(images/background/2.png) bg3=Image.load(images/background/3.png) bg4=Image.load(images/background/4.png) end and so go on for the rest of the map end
Well then I'll make it tile based no problem
-
06-24-2009, 03:51 PM #9988Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ 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-24-2009, 04:04 PM #9989QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Is the readme wrong then? It explicitly says it returns 1 or 0 which implies an integer, not a boolean which is an important distinction because 'notting' a 0 does not return true (tested on Lua 5.1.2).
Nothing is printed.Code:foo = 0 if not foo then print("blah") end
As a side note, any non-zero integer in a expression is true but is not equal to the 'value' of true.
Output is "Blah".Code:foo = -1; if foo then print( "Blah") end
Nothing is printed.Code:foo = -1; if foo == true then print( "Blah") end
As I implied earlier, I wasn't sure how the function eos works under the hood in LuaPlayer and whether it only works if the music has been played at all. (HM really needs a IsPlaying function).
Try the following:
Code:BG1 = Ogg.load("Music.ogg"); Ogg.play(BG1); while true do if Ogg.eos() == 1 then Ogg.play(BG1); 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, 04:06 PM #9990Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
or switch to pge which is built for making games and just use a wav or mp3 as it directly has a function 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).


LinkBack URL
About LinkBacks
Mit Zitat antworten
do you want a medal

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum