Documentation
IPS_SetEventScript
 boolean IPS_SetEventScript (int $EventID, string $EventScript) 
  Parameters
| EventID | ID of the event to be changed  | 
      
| EventScript | PHP code without PHP tags (<? ... ?>)  | 
      
Returns
If the command 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.
Example
//Assign the script content to the event        
IPS_SetEventScript($EventID, "echo linked object: ".$_IPS['TARGET']);