Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Run function after X miliseconds
Run function after X miliseconds [message #417956] Mon, 18 January 2010 10:35 Go to previous message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma:
General (1 Star)
I currently have a piece of code that will run Function A on level loaded

This function initiates Function B a little later.
In Function B im getting the length of an MP3 file (in miliseconds)
After this, Function B has to run again after that time, while any other code still runs.

Problem is i cant use Sleep(); or w/e to wait that long because all other code must continue running.
Afaik i cant make it a script either (so i can use Start_Timer + Timer_Expired) that will be attached to a player because it'll will then restart the whole code after every die (AKA object change)

void FunctionA()
{
	//Code here; read file containing sounds
	

	FunctionB();
}

void FunctionB()
{
	if(runnow)
	{
		//Pick a random song from the file
		//Play the song

		fsystem->update();
		{
			//Set Volume

			//Get song length (in miliseconds)
		}
		FunctionB(); //This should run after 'song length' above
	}
//More code; should still run and not only after X miliseconds as Sleep(); would do
}


If needed i'll upload the whole file

EDIT:
i believe in Javascript you have something like setInterval() that does what i want Razz

EDIT2:
Oh and if anyone knows how to get the music volume settings from renegade, please tell ^^


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Mon, 18 January 2010 10:42]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Hud Help
Next Topic: Islands gmax files?
Goto Forum:
  


Current Time: Thu Nov 28 18:47:12 MST 2024

Total time taken to generate the page: 0.00645 seconds