Music Troubles
Displaying 1-6 of 6 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
TCL

I have in my introduction scenario, a piece of music, Both the music and a movie play, the movie ends and it enters the game, then either (depending on what code i use) the music will stop instantly, or The Music Will repeat...

How do i get my Music To stop playing after 32 seconds (to be precise)

So my desired effect would be....

Movie and Music Start.
Movie finishes playing.
Enters game.
2 seconds later the music (either changes or Stops).

Currently I have....
Movie And Music Start.
Movie Finishes playing.
Music Stops.
Enters Game.

please Help!!!!!

Posted on 2006-05-24 14:38:22

mcgrue

I'd probably set an in-code timer to auto-stop it.

Are you using the Sullycode as a base? There are plenty of examples of storing timer variables and waiting X seconds to do something in there.

Does anyone have some example code handy for TCL? I'm about to head back to work and so can't really make a real informative post at the moment.

Posted on 2006-05-24 14:45:13

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.

Posted on 2006-05-24 15:23:17

Overkill

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.

Posted on 2006-05-24 15:52:20

TCL

Ok...With a slight bit of editing....This has worked to perfection.....Thanks

Posted on 2006-06-07 11:47:18

Gayo

I think someone out there actually made a little lib for executing functions after a fixed time period, but I'm not sure where it got off to.

Posted on 2006-06-17 15:56:02


Displaying 1-6 of 6 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.