TCL-Programs Reference Manual

Room Triggers

RoomTrigger Command

The roomtrigger command is defined as a separate command.

roomtrigger <name> <type> <call> [<trigger>]

Adds a trigger to the room. 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. Type is the trigger type, like “look”, “enter” and so on. 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.

room triggers Command Reference

trigger pre_attack

Value: means of starting the fight. Currently one of: bash, dirtkick, trip, tail, kill, murder, backstab, rescue, attack, eyepoke, magic
Default Char: The person trying to start a fight.

The trigger fires when somebody is trying to start a fight. If the trigger returns false, a fight will NOT break out. Take care, for the opposite is not true: returning true will not guarantee a fight!

trigger kill

Value: -
Default Char: The person who attacked.

This trigger is checked whenever a PC attacks the mobile. The check occurs only ONCE, in the beginning of combat. Useful for summoning assistance etc. (See room mload).

trigger death

Value: -
Default Char: Mob/char who died

Fires whenever somebody dis in the room. Second char is the killer.

trigger enter

Value: The direction the character came from
Default Char: Person entering the room

This trigger is called when a player enters a room.

trigger interpret_unknown

Value: The command given by the player.
Default Char: The person who gave the command.

This trigger is tested every time a character has entered a command which wasn't recognized as a valid command.

NOTE: Both mobs and players can trigger this trigger.

trigger pre_interpret

Value: The command given by the player.
Default Char: The person who gave the command.

This trigger is tested when a character is going to execute a valid command but the command hasn't been executed yet. If the procedure returns a TRUE, the command is blocked.

NOTE: Both mobs and players can trigger this trigger.

trigger post_interpret

Value: The command given by the player.
Default Char: The person who gave the command.

This trigger is tested every time a character a valid command is executed.

NOTE: Both mobs and players can trigger this trigger.

trigger pre_social

Value: The social given by the player.
Default Char: The person who gave the command.

This trigger is tested when a character is going to execute a social but the social hasn't been executed yet. If the procedure returns a TRUE, the social is blocked.

NOTE: Both mobs and players can trigger this trigger.

trigger social

Value: The command given by the player.
Default Char: The person who gave the command.

This trigger is tested every time a character a social is executed.

NOTE: Both mobs and players can trigger this trigger.

trigger leave

Value: The direction the character is going to
Default Char: Person leaving the room

This trigger is called when a player tries to leave a room. If it returns FALSE, the leaving is prevented. If it returns TRUE, the person leaves the room.

trigger canlock

Value: Direction being locked
Default Char: Person or mob going to lock the door

Called before the door is locked. If it returns a FALSE, the door will not be be locked. This trigger REPLACES the check for a valid key. The exit flag 'tcl_lock' is required on the exit for this trigger to fire.

trigger pre_lock

Value: Direction being locked
Default Char: Person or mob going to lock the door

Called before the door is locked. If it returns a FALSE, the door will not be be locked.

trigger lock

Value: Direction being locked
Default Char: Person or mob who locks the door

Called when the door has been locked.

trigger pre_look_ed

Value: The extra description being looked at
Default Char: Person or mob going to look at the extra description

Called before the extra description is being looked at. If it returns FALSE, the extra description will not be shown.

trigger look_ed

Value: The extra description being looked at
Default Char: Person or mob going to look at the extra description

Called when the extra description has been looked at.

trigger pre_recall

Value: -
Default Char: The person who is going to recall.

This trigger is tested before a player is going to recall. If it returns FALSE, the recall will not continue.

trigger recall

Value: -
Default Char: The person who has recalled out of a room.

This trigger is tested just before the player is disappearing from the room.

trigger recall_to

Value: -
Default Char: The person who just recalled.

This trigger is tested after a player successfully recalled.

trigger pre_reset

Value: -
Default Char: -

Called before the room is resetted. If the trigger returns false, the room will not be resetted.

trigger reset

Value: -
Default Char: -

Called after the room is resetted.

trigger pre_speech

Value: The words said
Default Char: Person or mob going to say the words

Called before the words are said. If it returns a FALSE, the words will not be be said.

trigger speech

Value: The words said
Default Char: Person or mob who said the words

Called when the words have been said.

trigger sunset

Value: -
Default Char: -

Happens after the message "the sun disappears in the west".

trigger sunrise

Value: -
Default Char: -

Happens after the message "the sun rises in the east".

trigger end_day

Value: -
Default Char: -

Happens after the message "the night has begun."

trigger start_day

Value: -
Default Char: -

Happens after the message "the day has begun."

trigger timer

Value: -
Default Char: -

Every room has a timer, this timer can be started with the room timer command. Normally you issue an room 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

Value: time of day
Default Char: -

This trigger is tested every hour in MUD time.

trigger random

Value: -
Default Char: -

NOTE: This trigger is checked each PULSE_TICK, even if there are no players in the room 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

Value: -
Default Char: -

NOTE: This trigger is checked every PULSE_TICK and activates when the delay of a room (set with the room delay command) expires. This trigger can be used to create staged object behavior. See also room remember. An room can have several delay triggers, but every time the delay timer expires, all the triggers are checked and the first successful one executed.

trigger pre_trap

Value: Direction
Default Char: Person or mob triggering the trap

Called before the trap is sprung. If it returns a FALSE, the trap will not function. The mud will not report this, the progs need to take care of this if desired.

trigger trap

Value: Direction
Default Char: Person or mob who triggered the trap

Called when the trap has sprung.

trigger canunlock

Value: Direction being unlocked
Default Char: Person or mob going to unlock the door

Called before the door is unlocked. If it returns a FALSE, the door will not be be unlocked. This trigger REPLACES the check for a valid key. The exit flag 'tcl_lock' is required on the exit for this trigger to fire.

trigger pre_unlock

Value: Direction being unlocked
Default Char: Person or mob going to unlock the door

Called before the door is unlocked. If it returns a FALSE, the door will not be be unlocked.

trigger unlock

Value: Direction being unlocked
Default Char: Person or mob who unlocks the door

Called when the door has been unlocked.

trigger weather

Value: new_state <SP> old_state

Trips every time the weather changes. State is one of 'cloudless', 'cloudy', 'raining', 'lightning'.