Seite 333 von 342 ErsteErste ... 233 283 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 LetzteLetzte
Zeige Ergebnis 9.961 bis 9.990 von 10238

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 ...

  
  1. #9961
    QJ Gamer Green
    Points: 2.236, Level: 28
    Level completed: 58%, Points required for next Level: 64
    Overall activity: 0%

    Registriert seit
    Nov 2008
    Beiträge
    35
    Points
    2.236
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    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?



  2. #9962
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von gamikzone Beitrag anzeigen
    ty again
    Post count whoring much?

  3. #9963
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    Well I'm completely stumped by this. How do I make music loop in the latest Luaplayer HM. I tired all sorts of techniques but nothing is working.Let me give you situation.
    Not 100% sure how Ogg.eos() actually works especially if the music hasn't been played yet but you get the gist of what I am trying to do here:
    Code:
    BG1 = Ogg.load("Music.ogg");
    
    while true do	
    	if Ogg.eos() == 1 then
    		Ogg.play(BG1);
    	end
    end

  4. #9964
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    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 ;) )

  5. #9965
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    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

  6. #9966
    QJ Gamer Green
    Points: 4.034, Level: 40
    Level completed: 43%, Points required for next Level: 116
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Beiträge
    467
    Points
    4.034
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    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]

  7. #9967
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Predricted Beitrag anzeigen
    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
    Depending on the player your using you can have up to 10MB of space for images. Other then the memory limit I don't believe there are others.



    Zitat Zitat von yaustar Beitrag anzeigen
    Not 100% sure how Ogg.eos() actually works especially if the music hasn't been played yet but you get the gist of what I am trying to do here:
    Code:
    BG1 = Ogg.load("Music.ogg");
    
    while true do	
    	if Ogg.eos() == 1 then
    		Ogg.play(BG1);
    	end
    end

    Yes your calling out Ogg.eos() properly, and no I tried that method before; it didn't work.

  8. #9968
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Predricted Beitrag anzeigen
    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
    OR could be an invalid filepath.

  9. #9969
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    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).

  10. #9970
    Lua guy
    Points: 11.690, Level: 71
    Level completed: 10%, Points required for next Level: 360
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    Wales, cardiff
    Beiträge
    1.442
    Points
    11.690
    Level
    71
    My Mood
    Blah
    Downloads
    0
    Uploads
    0

  11. #9971
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von dan369 Beitrag anzeigen
    OR could be an invalid filepath.
    Nope damn sure it isn't cause when i use the same file path but then with less lines with image.load then there is no error loading image.

  12. #9972
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    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).

  13. #9973
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    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
    All those images got a size of 480*272 and they are a part of a map that I made with a program where you can make a map and then it saves automaticly your map in a few images with the width and height you want.. all those images together are 1 big map

  14. #9974
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    You don't have to load them all at the same time.

  15. #9975
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    You don't have to load them all at the same time.
    What do you mean?
    I load all images at begin of script

  16. #9976
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Predricted Beitrag anzeigen
    Nope damn sure it isn't cause when i use the same file path but then with less lines with image.load then there is no error loading image.
    Nah, i think dan hit the nail on the head. Check that it's path is being declared in quotation marks et cetra.

    Example Model:

    Something = Image.load("Image/Some_Image.png")

  17. #9977
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Predricted Beitrag anzeigen
    I load all images at begin of script
    Don't.

  18. #9978
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    Nah, i think dan hit the nail on the head. Check that it's path is being declared in quotation marks et cetra.

    Example Model:

    Something = Image.load("Image/Some_Image.png")
    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 =-
    Zitat Zitat von Nielkie Beitrag anzeigen
    Don't.
    Well how then?? Like loading them in a while loop?
    I tried and still the error at one line
    Geändert von Predricted (06-23-2009 um 06:54 PM Uhr) Grund: Automerged Doublepost

  19. #9979
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Predricted Beitrag anzeigen
    Well how then?? Like loading them in a while loop?
    Dynamically load and unload them as needed.

  20. #9980
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    Dynamically load and unload them as needed.
    That causes slow down.

  21. #9981
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    That causes slow down.
    What, so he shouldn't make the game at all?

    He shouldn't be composing his map as 480x272 images, but dynamically loading resources /is/ how one overcomes memory constraints...

  22. #9982
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    That causes slow down.
    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

    Zitat Zitat von Nielkie Beitrag anzeigen
    What, so he shouldn't make the game at all?

    He shouldn't be composing his map as 480x272 images, but dynamically loading resources /is/ how one overcomes memory constraints...
    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).

  23. #9983
    Developer
    Points: 13.989, Level: 76
    Level completed: 85%, Points required for next Level: 61
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    Nov 2008
    Beiträge
    71
    Points
    13.989
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen

    Yes your calling out Ogg.eos() properly, and no I tried that method before; it didn't work.
    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 =-
    Zitat Zitat von Xteaph-N Beitrag anzeigen
    Well I'm completely stumped by this. How do I make music loop in the latest Luaplayer HM. I tired all sorts of techniques but nothing is working.Let me give you situation.

    I load an Ogg then I play it in my main loop. Then I try to stop the music near the end and re-play the music. This is pretty much the gist of how I'm trying to do it:

    Code:
    BG1 = Ogg.load("Music.ogg")
    
    music = true
    
    while true do
    pad = Controls.read()
    
    if music == true then
    Ogg.play(BG1)
    end
    if music == false then
    Ogg.stop(BG1)
    end
    
    if pad:circle() then
    music = true
    end
    
    if pad:cross() then
    music = false
    end
    end
    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:

    Code:
    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
    
    end
    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 song
    Geändert von qwikrazor87 (06-24-2009 um 05:19 AM Uhr) Grund: Automerged Doublepost

  24. #9984
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von qwikrazor87 Beitrag anzeigen
    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
    Directly from the readme:
    Ogg.eos() Returns 1 for EndOfSong and 0 for still playing.
    If the readme is wrong then someone needs to update it.
    -=Double Post Merge =-
    Zitat Zitat von qwikrazor87 Beitrag anzeigen
    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:

    Code:
    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
    
    end
    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 song
    The code doesn't continuously loop the music which is what the OP asked for:
    Zitat Zitat von Xteaph-N Beitrag anzeigen
    Well I'm completely stumped by this. How do I make music loop in the latest Luaplayer HM. I tired all sorts of techniques but nothing is working.Let me give you situation.
    Geändert von yaustar (06-24-2009 um 06:20 AM Uhr) Grund: Automerged Doublepost

  25. #9985
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    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).

  26. #9986
    QJ Gamer Blue
    Points: 2.165, Level: 28
    Level completed: 10%, Points required for next Level: 135
    Overall activity: 0%
    Achievements:
    First 1000 Experience Points

    Registriert seit
    May 2009
    Ort
    California
    Beiträge
    75
    Points
    2.165
    Level
    28
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FaT3oYCG Beitrag anzeigen
    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.
    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.

  27. #9987
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Nielkie Beitrag anzeigen
    What, so he shouldn't make the game at all?

    He shouldn't be composing his map as 480x272 images, but dynamically loading resources /is/ how one overcomes memory constraints...
    I know what X-teaph means I tried Dynamicly but really amateur way I did this:
    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
    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...
    Well then I'll make it tile based no problem

  28. #9988
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    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.
    do you want a medal

    Zitat Zitat von Predricted Beitrag anzeigen
    I know what X-teaph means I tried Dynamicly but really amateur way I did this:
    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
    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...
    Well then I'll make it tile based no problem
    yeah a tile engine / method is the best route to take, usually 16x16 pixel or 32x32 pixel images work best.
    ------ 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).

  29. #9989
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Xteaph-N Beitrag anzeigen
    ogg.eos() returns boolean. You can handle it like any other function that returns boolean.
    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).

    Code:
    foo = 0
    if not foo then
        print("blah")
    end
    Nothing is printed.

    As a side note, any non-zero integer in a expression is true but is not equal to the 'value' of true.

    Code:
    foo = -1;
    if foo then
        print( "Blah")
    end
    Output is "Blah".

    Code:
    foo = -1;
    if foo == true then
        print( "Blah")
    end
    Nothing is printed.

    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

  30. #9990
    Developer and Tutor.
    Points: 8.736, Level: 62
    Level completed: 96%, Points required for next Level: 14
    Overall activity: 0%

    Registriert seit
    Jul 2007
    Ort
    Widnes, England
    Beiträge
    1.649
    Points
    8.736
    Level
    62
    My Mood
    Happy
    Downloads
    0
    Uploads
    0

    Standard

    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).


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 08:58 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .