"Wait" function?
by Orion the Hunter · in Torque Game Builder · 01/01/2013 (10:23 am) · 5 replies
Hello,
does anyone have an idea for a wait function? I mean something like this:
I just want a non-messy alternative so I don't have to make new functions. I know Squirrel code has this... does torque script?
does anyone have an idea for a wait function? I mean something like this:
function eatIceCream()
{
playAnimation(Chomp);
Wait(3000); //Milliseconds
iceCream.safeDelete();
}
Rather than use a function like:
[code]function eatIceCream()
{
playAnimation(Chomp);
schedule(3000, "eatIceCreamPart2");
}
function eatIceCreamPart2()
{
iceCream.safeDelete();
}I just want a non-messy alternative so I don't have to make new functions. I know Squirrel code has this... does torque script?
#2
iceCream.safeDelete(30);
01/01/2013 (5:20 pm)
Thanks! How would I go about doing this in a schedule?iceCream.safeDelete(30);
#3
myObject.schedule(3000, someFunction, param1, param2, etc...);
01/01/2013 (5:50 pm)
What's the '30' being used for? You can pass in parameters to scheduled functions/methods like so: myObject.schedule(3000, someFunction, param1, param2, etc...);
#4
01/01/2013 (6:05 pm)
The thirty was a placeholder. It could determine the speed or something. I was using the whole "icecream" thing as an example.
#5
myObject.schedule(<timeInMs>, <functionToCall>, <param1>, <param2>, ...);
01/02/2013 (11:25 am)
Ah, gotcha. Then yep, use:myObject.schedule(<timeInMs>, <functionToCall>, <param1>, <param2>, ...);
Associate Chris Haigler
Jester Dance
iceCream.schedule(3000, "safeDelete");