« Back to Product

Documentation

IPS_SetEventScript

 bool IPS_SetEventScript (int $EventID, string $EventScript) 

Parameters

EventID

ID of the event to be changed

EventScript

PHP code without PHP tags (<? ... ?>)

Returns

If the function succeeds, it returns TRUE, otherwise FALSE.

Description

The executed Action of the Event is set to "Execute PHP Code" and the code to EventScript. The PHP code will be given directly without the PHP tags (<? ...?>).

The list of the System Variables shows what specific variables are available.

If EventScript is empty and the parent object is a script, the action "Run Automation" is set instead, which executes the parent script.

Example

//Assign the script content to the event        
IPS_SetEventScript($EventID, "echo 'Linked object: ' . \$_IPS['TARGET'];");
Any questions?