SetPersonScript
From Spheriki
Sets code to execute when a person triggers a special event.
The five events are:
SCRIPT_ON_CREATE
SCRIPT_ON_DESTROY
SCRIPT_ON_ACTIVATE_TOUCH
SCRIPT_ON_ACTIVATE_TALK
SCRIPT_COMMAND_GENERATOR (will be called when the command queue for the person runs out (for random movement thingies, etc))
Contents |
Usage
- name identifies the person to set a script for.
- which identifies the event type. See above list. This value is NOT a string.
- script sets the code to be evaluated when the event is triggered. This value IS a string because Sphere uses eval() to evaluate the string code as actual code.
Examples
Face south when the person is created:
SetPersonScript("Bob", SCRIPT_ON_CREATE, 'SetPersonDirection("Bob", "south");');
Add 1 to variable 'score' when the person is destroyed.
SetPersonScript("Bob", SCRIPT_ON_DESTROY, "score++;");
Notes
See also
- CallPersonScript(name, which)
- SetPersonDirection(name, direction)