AddEffect

Category: Effects
Since engine version: 4.9.5.0 CE

Description

Creates an effect. Returns the effect index if successful or 0 if not (e.g. because the effect was rejected). If the effect was accepted by another effect which is deleting itself within the same call, the return value is -2.

Syntax

int AddEffect (string szEffectName, object pTarget, int iPrio, int iTimerIntervall, object pCmdTarget, id  idCmdTarget, any var1, any var2, any var3, any var4);

Parameters

szEffectName:
Name of the effect without prepended 'Fx'.
pTarget:
[opt] Target object for the effect. If 0, a global effect is created.
iPrio:
Effect priority. Must be greater than zero!
iTimerIntervall:
[opt] Interval for the timer calls. With 0, no timer calls are made and the effect stays on permanently until it is deleted by other calls.
pCmdTarget:
[opt] Command target. If specified, all callbacks are executed in this object. Otherwise the callbacks are made without any object context. If the command target object is deleted, all effects belonging to this object are deleted without any further callbacks. If the target object changes its definition, belonging effects should reassign their callback functions using ChangeEffect.
idCmdTarget:
[opt] Definition in which callbacks are to be executed if no command target object is specified. If both pCmdTarget and idCmdTarget are 0, callbacks are made globally. For this, the Fx* must also be declared globally or they must be engine functions.
var1:
[opt] First extra parameter to be passed to Fx*Start and Fx*Effect callbacks
var2:
[opt] Second extra parameter to be passed to Fx*Start and Fx*Effect callbacks
var3:
[opt] Third extra parameter to be passed to Fx*Start and Fx*Effect callbacks
var4:
[opt] Fourth extra parameter to be passed to Fx*Start and Fx*Effect callbacks

Remark

For examples and more information see the effects documentation.
See also: ChangeEffect, CheckEffect, EffectCall, EffectVar, Effects Documentation, GetEffect, GetEffectCount, RemoveEffect
Sven2, März 2004