Fatal Dimensions
 

TCL-Programs Reference Manual

Contents

Trigger Commands

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

combat leave recall sun/day unlock
enter lock reset time weather
interpret look_ed speech trap

trigger pre_attack

Trigger value:means of starting the fight. Currently one of: bash, dirtkick, trip, tail, kill, murder, backstab, rescue, attack, eyepoke, magic
Default character: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

Trigger value:-
Default character: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

Trigger value:-
Default character:Mob/char who died
Fires whenever somebody dis in the room. Second char is the killer.

trigger enter

Trigger value:The direction the character came from
Default character:Person entering the room
This trigger is called when a player enters a room.

trigger interpret_unknown

Trigger value:The command given by the player.
Default character: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

Trigger value:The command given by the player.
Default character: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

Trigger value:The command given by the player.
Default character: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

Trigger value:The social given by the player.
Default character: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

Trigger value:The command given by the player.
Default character: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.

User contributed notes: room_triggers interpret
jodocus@fataldimensions.nl.eu.org
Mar 25th 2001, 20:29
When using the interpret unknown trigger, the program should return false if it understood the command and true if it didn't understand it.
aggreviate@fataldimensions.org
Dec 7th 2001, 10:48
Note: For both pre_interpret and post_interpret triggers. If it returns false, the valid command is blocked. If it returns true, the valid command is executed. In both cases of returns, the procedure called up by the trigger will always be run.

trigger leave

Trigger value:The direction the character is going to
Default character: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.

User contributed notes: room_triggers leave
rocksy@fataldimensions.org
Dec 6th 2006, 21:08
Use [trig] in the proc to return the direction the char is trying to walk.
[trig] returns 0, 1, 2, 3, 4 or 5 for n, e, s, w, u or d, respectively.

trigger canlock

Trigger value:Direction being locked
Default character: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

Trigger value:Direction being locked
Default character: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

Trigger value:Direction being locked
Default character:Person or mob who locks the door
Called when the door has been locked.

trigger pre_look_ed

Trigger value:The extra description being looked at
Default character: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

Trigger value:The extra description being looked at
Default character:Person or mob going to look at the extra description
Called when the extra description has been looked at.

trigger pre_recall

Trigger value:-
Default character: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

Trigger value:-
Default character: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

Trigger value:-
Default character:The person who just recalled.
This trigger is tested after a player successfully recalled.

trigger pre_reset

Trigger value:-
Default character:-
Called before the room is resetted. If the trigger returns false, the room will not be resetted.

trigger reset

Trigger value:-
Default character:-
Called after the room is resetted.

trigger pre_speech

Trigger value:The words said
Default character: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

Trigger value:The words said
Default character:Person or mob who said the words
Called when the words have been said.

trigger sunset

Trigger value:-
Default character:-
Happens after the message "the sun disappears in the west".

trigger sunrise

Trigger value:-
Default character:-
Happens after the message "the sun rises in the east".

trigger end_day

Trigger value:-
Default character:-
Happens after the message "the night has begun."

trigger start_day

Trigger value:-
Default character:-
Happens after the message "the day has begun."

trigger timer

Trigger value:-
Default character:-
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

Trigger value:time of day
Default character:-
This trigger is tested every hour in MUD time.

trigger random

Trigger value:-
Default character:-
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

Trigger value:-
Default character:-
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

Trigger value:Direction
Default character: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

Trigger value:Direction
Default character:Person or mob who triggered the trap
Called when the trap has sprung.

trigger canunlock

Trigger value:Direction being unlocked
Default character: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

Trigger value:Direction being unlocked
Default character: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

Trigger value:Direction being unlocked
Default character:Person or mob who unlocks the door
Called when the door has been unlocked.

trigger weather

Trigger value:new_state old_state
Trips every time the weather changes. State is one of 'cloudless', 'cloudy', 'raining', 'lightning'.