Script Command Trigger

The Script Command Trigger enables to start or stop a behavior by returning true when the MEL or Python command returns a value different than 0. 

Creation

  • Behavior Editor / Trigger Library: 
  • Golaem Menu: Crowd Triggers / Triggers / CrowdTri Script Node
  • MEL command: glmCrowdTriScriptCmd;

Configuration

A Script Trigger defines the following specific attributes. For common attributes see Trigger Common Attributes.

Script Attributes

Script The script command to execute.
Script Language MEL or Python.

Example

The following MEL command counts and returns the number of entities in a circle of radius 2 Maya units, located at the center of the scene. The trigger will return true if this number is not 0:

spatialRequest -center 0 0 0 -radius 2 -type count;

This trigger can be useful when dealing with complex conditions or to execute a specific MEL or Python code during the simulation. The script command may contain special tags such as #pid#, #ps# or #gid# to interact with particles (see Technical Documentation ).

For example, if the user defines the function:

global proc int startBehavior(string $particleSystem, int $particleId)

To call this function with the current particle, the MEL command to use is: startBehavior("#ps#", #pid#);