Quote:
Originally posted by CrazyAznGamer
I'll be willing to give it a shot.
Ok, so I'm assuming you're in a map and you have the music playing, and then, you could do something like:
int msc_timestamp;
void init() //whatever function is called whenever map is loaded
{
//blablablamusiccode w/e
//ok, so you have it playing
WaitStopMusic(32);
}
void WaitStopMusic(int t)
{
msc_timestamp = systemtime + t;
HookRetrace("MscRetraceHook");
}
void MscRetraceHook()
{
if(systemtime >= msc_timestamp)
{
StopMusic();
HookRetrace(""); //unhook this, haha
}
}
Yeah, I don't use the Music API often, so feel free to correct me. Translating it into something Song-related shouldn't be too hard either.
One small logical mistake caught, but I felt the urge to modify the formatting slightly to use actual tabs and ovk-personalized comments!
int msc_timestamp;
void Init() // You know, whatever function is called whenever map is loaded. Yeah, that one.
{
// Music code, whatever. Get troupe to do your music.
// Okay, so you have it playing.
WaitStopMusic(32 * 100); // Overkill: Now in seconds as opposed to centiseconds!
}
void WaitStopMusic(int t)
{
msc_timestamp = systemtime + t;
HookRetrace("MscRetraceHook");
}
void MscRetraceHook()
{
// The desired time has been elapsed.
if(systemtime >= msc_timestamp)
{
StopMusic();
HookRetrace(""); // We can totally unhook this this
}
}
Sidenote: I don't know if I'd use hookretrace for something as this, but whatever. Well, if I did, I'd likely put the code in one MainHook() function that never requires unhooking.