Schedule

Category: Script
Since engine version: 4.9.5.0 CE

Description

Executes a specified script command after a specified delay.

Syntax

bool Schedule (string szScript, int iInterval, int iRepeat, object pObj);

Parameters

szScript:
Script to be executed
iInterval:
Delay after which the first call is made. If iRepeat is greather than 1, this is also the delay inbetween subsequent calls.
iRepeat:
Number of calls. If 0 or not specified, the call is made exactly once.
pObj:
Object in which the call is to be made. Can be 0 in local calls.

Remarks

This function is implemented in System.c4g 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("Explode(50)", 1000, 0, "FindObject(CLNK));
Makes a clonk explode after 1000 ticks delay.
Schedule("SetWealth(GetPlayerByIndex(0), GetWealth(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, August 2005