Schedule

Category: Script
Since engine version: 1.0 OC

Description

Executes a specified script command after a specified delay.

Syntax

bool Schedule(object obj, string script, int delay, int repeat);

Parameters

obj:
Object in which the call is to be made. Can be nil for no object context.
script:
Script to be executed.
delay:
Delay after which the first call is made. If repeat is greather than 1, this is also the delay inbetween subsequent calls.
repeat:
Number of calls. If 0 or not specified, the call is made exactly once.

Remarks

This function is implemented in System.ocg using the effect "IntSchedule" in function eval.
Accordingly, the specified script can be a single command only. It may not contain multiple commands separated by ";".

Examples

Schedule(FindObject(Find_ID(Clonk)), "Explode(50)", 1000);
Makes a clonk explode after 1000 ticks delay.
Schedule(nil, "DoWealth(GetPlayerByIndex(0), 1)", 1, 100);
Gives one unit of money per frame to the first player for 100 frames. Notice that if the first player is eliminated, the donations will continue for the next (first) player, since the receiving player is determined anew in each execution.
See also: ScheduleCall
PeterW, 2005-08