Hey. I'm having a bit of trouble getting this function to work. I've got an mp3 playing, I want something to happen at 7 seconds so - in the 'repeatedly execute' part I've got the code:
if (GetMP3PosMillis () == 7000) {
//do something
}
But nothing happens. I've played the mp3 with PlayMp3File() . Its probably something really simple but any one got any ideas?
At first, I'd check a returned value:
repeatedly_execute:
Display("Position: %d", GetMP3PosMillis ());
What does it display? (EDIT: ps you need to press a key to retrace if it's changed at all - just hold down the enter or something)
Yeah, got a returned value and it changes. I've managed to get it to work by putting in one of the numbers I saw displayed. It works if I put 7288 instead of 7000.
Hmm.. I don't remember reading in the documentation that it has to be in multiples of something. Thanks for the help, Scorpious.
Oh, yeah it's maybe (not sure) related to the technical side of mp3 format. EDIT: Another thing is that repeatedly_execute is called each 1/GetGameSpeed() of a second while mp3 file is continously being played by AGS in the background. That is why there is "GetMP3PosMillis greater than value" comparison example in the manual. :P
~Cheers
Yeah, exactly - for your comparison to work, your script would have to be executed at that exact millisecond. Therefore, you should always use a greater-than-or-equal-to test, not just equals, with this function.