Author Topic: Delaying a command: Schedule?  (Read 1186 times)

I've read a couple examples but can't find anything that really shows me what I want to do.

http://forum.blockland.us/index.php?topic=44973.0
http://forum.blockland.us/index.php?topic=206721.0

All I want to do is make a simple ~3 second delay between two commands. In previous scripting languages I could do something as simple as Sleep, 3000 but I'm not finding anything on the web so far for how to do this in TS.

the schedule( ms , objID or 0, functionName, arg0, ... , argN ) function.

basically, if you wanted to delay this:

messageClient(16874, '', "moose");

by three seconds, you'd do this:

schedule(3000, 0, messageClient, 16874, '', "moose");


for objects, typically people do this:

%obj.schedule(3000, addVelocity, "5.66 23.3 0 255");

Code: [Select]
%obj.schedule(3000, addVelocity, "5.66 23.3 0 255");Thanks!

Hmm what if I wanted to use the 'talk' command?
Code: [Select]
schedule(1000, 0, "talk", "2");This is for a lift-off sequence.

Hmm what if I wanted to use the 'talk' command?
Code: [Select]
schedule(1000, 0, "talk", "2");This is for a lift-off sequence.
Perfect.

It was giving me a strange error that I think I might understand now.

I had a timer going off in 3 seconds and another one in 1 second. The one second timer was causing an error where schedule(##1##000, 0, talk, "3");. I don't know for sure but I don't think I'm allowed to have multiple timers going at the same time? I've got a simple timer working now:
Code: [Select]
function servercmdtest(%client)
{
schedule(1000, 0, talk, "3");
schedule(2000, 0, talk, "2");
schedule(3000, 0, talk, "1");
}
This code is a work in progress so mock me for it's simplicity.

You can have multiple schedules at the same time.

That indicates that you made a syntax error in your code. You can often find the error in the line above the one it marks.