Area Triggers
AreaTrigger Command
The areatrigger command is defined as a separate command.
areatrigger <name> <type> <call> [<trigger>]
Adds a trigger to the area. Use <name> to give the trigger an unique name. Non-unique names will be rejected. Also numbers are allowed names. This name can be used to delete the trigger later. Trigger types are described later. <call> is an TCL-script that should be executed. Normally this will be the name of a procedure to execute. The <trigger> gives the trigger condition. This should be a TCL command (or script) that returns a boolean. If the boolean is true, the <call> script will be executed. If no trigger condition is given, the call script will always be executed.
The <trigger>-script may generate variables that then can be used in the <call> script. The <trigger> script has also access to all other functionality you would normally have in a TCL-mobprog.
Trigger Types
Triggers are fairly easy to add, but this basic list should hold for most needs. Their names, argument list syntaxes, and translation into more articulate English are given below. Some triggers generate a trigger value. This value can be accessed with the [trig] command or trough the $::t variable. The trig command has a lot of routines for easy access to these trigger values.
area triggers Command Reference
trigger leave
Trips right before a PC moves from one area to another by mortal or tcl means.
trigger enter
Trips right after a PC moves from one area to another by mortal or tcl means.
trigger pre_reset
Called before the area is resetted. If the trigger returns false, the area will not be resetted.
trigger reset
Called after the area is resetted.
trigger sunset
Happens after the message "the sun disappears in the west".
trigger sunrise
Happens after the message "the sun rises in the east".
trigger end_day
Happens after the message "the night has begun."
trigger start_day
Happens after the message "the day has begun."
trigger timer
Every object has a timer, this timer can be started with the obj timer command. Normally you issue an obj timer 0 command to let the timer start counting from 0. Every PULSE_TICK the timer trigger is called. You can use trig compare to check the trigger value.
trigger hour
This trigger is tested every hour in MUD time.
trigger random
NOTE: This trigger is checked each PULSE_TICK, even if there are no players in the area but there are in the area. If you want this event to be triggered always, you must set the ACT_UPDATE_ALWAYS flag of the mobile.
trigger delay
NOTE: This trigger is checked every PULSE_TICK and activates when the delay of a object (set with the obj delay command) expires. This trigger can be used to create staged object behavior. See also obj remember. An object can have several delay triggers, but every time the delay timer expires, all the triggers are checked and the first successful one executed.
trigger weather
Trips every time the weather changes. State is one of 'cloudless', 'cloudy', 'raining', 'lightning'.