|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
TCL-Programs Reference ManualContents
Trigger CommandsRoomTrigger CommandThe roomtrigger command is defined as a separate command.
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 TypesTriggers 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_attackTrigger value:means of starting the fight. Currently one of: bash, dirtkick, trip, tail, kill, murder, backstab, rescue, attack, eyepoke, magicDefault 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 killTrigger 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 deathTrigger value:-Default character:Mob/char who died Fires whenever somebody dis in the room. Second char is the killer.
trigger enterTrigger value:The direction the character came fromDefault character:Person entering the room This trigger is called when a player enters a room.
trigger interpret_unknownTrigger 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_interpretTrigger 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_interpretTrigger 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_socialTrigger 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 socialTrigger 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.
trigger leaveTrigger value:The direction the character is going toDefault 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.
trigger canlockTrigger value:Direction being lockedDefault 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_lockTrigger value:Direction being lockedDefault 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 lockTrigger value:Direction being lockedDefault character:Person or mob who locks the door Called when the door has been locked.
trigger pre_look_edTrigger value:The extra description being looked atDefault 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_edTrigger value:The extra description being looked atDefault character:Person or mob going to look at the extra description Called when the extra description has been looked at.
trigger pre_recallTrigger 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 recallTrigger 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_toTrigger value:-Default character:The person who just recalled. This trigger is tested after a player successfully recalled.
trigger pre_resetTrigger value:-Default character:- Called before the room is resetted. If the trigger returns false, the room will not be resetted. trigger resetTrigger value:-Default character:- Called after the room is resetted.
trigger pre_speechTrigger value:The words saidDefault 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 speechTrigger value:The words saidDefault character:Person or mob who said the words Called when the words have been said.
trigger sunsetTrigger value:-Default character:- Happens after the message "the sun disappears in the west". trigger sunriseTrigger value:-Default character:- Happens after the message "the sun rises in the east". trigger end_dayTrigger value:-Default character:- Happens after the message "the night has begun." trigger start_dayTrigger value:-Default character:- Happens after the message "the day has begun."
trigger timerTrigger 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 hourTrigger value:time of dayDefault character:- This trigger is tested every hour in MUD time. trigger randomTrigger 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 delayTrigger 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_trapTrigger value:DirectionDefault 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 trapTrigger value:DirectionDefault character:Person or mob who triggered the trap Called when the trap has sprung.
trigger canunlockTrigger value:Direction being unlockedDefault 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_unlockTrigger value:Direction being unlockedDefault 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 unlockTrigger value:Direction being unlockedDefault character:Person or mob who unlocks the door Called when the door has been unlocked.
trigger weatherTrigger value:new_stateTrips every time the weather changes. State is one of 'cloudless', 'cloudy', 'raining', 'lightning'. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||