Game Development Community

Delay command in a script?

by Stefan Lundmark · in Torque Game Engine · 02/10/2004 (4:36 pm) · 6 replies

All I want to do is put a "pause" inside my script, and then let it continue along the script as usual. Is this possible?

Note: Schedule does not do that.

#1
02/10/2004 (4:38 pm)
So you want to pause the entire engine?
#2
02/10/2004 (4:49 pm)
No. For instance, I want to start my animation.
Then, give 10000 milliseconds, and I want to pause it.

Using scripts.
Any thoughts?
#3
02/10/2004 (8:03 pm)
Scheduling stopThread() for 10k MS won't work?
#4
02/11/2004 (1:45 am)
I have seen something like an object schedule that requires three parameters that I don't understand at all.

Is that the same? Could you explain a bit more? :)
#5
02/11/2004 (2:42 am)
I think schedule() does what you want ;)
Use it like this...

%myObject.playThread(0, "myAnimation");

// start some function after 10 secs
schedule(10000,0, StopAnimation,%myObject);

// param1 would be the object
function StopAnimation(%param1)
{
   %param1.stopThread(0);
}
Another way to use schedule is this:
datablock StaticShapeData(FooObject)
{
   category = "Misc";
   shapeFile = "~/data/shapes/foo/bar.dts";
   isPlaying = 0;
};
...

%myFooObject.schedule(10000, stopAnimation);

function FooObject::stopAnimation(%this, %obj)
{
   %obj.stopThread(0);
}
Please not that I haven't tested anything of this, but it should give you the idea...
#6
02/11/2004 (4:09 am)
Thanks alot mate!