Valarin
DGScripts: Triggers
T R I G G E R S

A trigger consists the type, information on when to execute it, a list of commands, and a list of variables. Each class of game object (mobiles, objects, and rooms) have their own set of triggers. The trigger types are explained in the following format:

 

Type
Description: This describes the event the trigger reacts to.
Argument: This is the argument of the trigger, used for determining if a trigger is to be run. It is one or more words.
Numeric Argument: This is the numerical argument, used to determine if a trigger is run. It must be a number.
Return value: This explains what effects a return statement can have.
Variables: This is a list of variables which may be set by the game when the trigger is run.

The following is a list of trigger types. More can be added by request.

M O B   T R I G G E R S
Global
Description: This is not a trigger by itself, but is used with another trigger type. A trigger which is global is checked even if there are no PCs in the same zone as the mob.
Argument: Not used.
Numeric Argument: Not used.
Return value: Not used.
Variables: None.
Random
Description: This trigger is checked periodically (about every thirteen seconds). The trigger is not checked if there is no PC in the same zone as the mob, unless it is also a Global trigger (see above).
Argument: Not used.
Numeric Argument: The chance this trigger will be run when it is checked.
Return value: Not used.
Variables: None.
Command
Description: This trigger is checked whenever a character types a command. If the command typed is a substring of the argument, the trigger is called.
Argument: The command name.
Numeric Argument: Not used.
Return value: If 0 is returned by the trigger, the character will receive the same message as if the trigger did not exist, and any other command triggers will be checked.
Variables:
actor is set to the character typing the command.
arg is set to the argument of the command.
cmd is set to the command of the command.
arg1_ch is set to the first located mob or character that matches the first word in arg
arg2_ch is set to the first located mob or character that matches the second word in arg
arg1_obj is set to the first located object that matches the first word in arg
arg2_obj is set to the first located object that matches the second word in arg
Speech
Description: This trigger is checked whenever someone says something around a mob with this trigger. If the numeric argument is 0, the trigger checks to see if Argument is a substring of what was said. If the numeric argument is 1, the trigger checks to see if any word in Argument matches a word of what was said to see if the trigger should be called.
Argument: The phrase or word list to be matched
Numeric Argument: If this is 0, Argument is a phrase. If it is 1, Argument is a word list.
Return value: Not used.
Variables:
actor is set to the character speaking.
speech is set to the entire text spoken.
Act
Description: This trigger is runs when Argument is a substring of a string of text that a mob sees. The text can come only come from certain output (those generated by the act() function of the game). This includes most messages, such as socials, damage messages, and skill messages. Text from players, such as echo, emote, say, and tell, are not checked. If you have a specific question whether a message is checked, ask an implementor.
Argument: The phrase or word list to be matched
Numeric Argument: If this is 0, Argument is a phrase. If it is 1, Argument is a word list.
Return value: Not used.
Variables: Not all the variables will be set. Which ones are set and to what depends on the message. If you have trouble, ask an implementor. The variables will be set to the right character or object, even if 'someone' or 'something' is used instead of the name.
actor is set to the primary character in the text.
victim is set to the secondary character in the text.
object is set to the primary object of the text.
target is set to the secondary object of the text.
arg is set to the variable string portion of the text, such as a door name.
Death
Description: This trigger is checked when the mobile dies.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If the return value is 0, the mob's death cry (such as 'Your blood freezes as you hear the beastly fido's death cry.') will not be heard. For any other value, the normal death cry will be heard.
Variables:
actor will be set to the killer, if there is one.
Greet
Description: This trigger is checked when someone enters the room, and the mob with the trigger can see the person entering.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: Not used.
Variables:
actor is set to be the character entering the room.
direction is set to the name of the direction the actor entered from. (More accurately, to the direction opposite the direction the actor walked in.)
Greet-All
Description: This trigger is the same as the Greet trigger, except that it is checked even if the mob can not see the actor.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: Not used.
Variables:
actor is set to be the character entering the room.
direction is set to the name of the direction the actor entered from. (More accurately, to the direction opposite the direction the actor walked in.)
Entry
Description: This trigger is checked every time the mobile enters a room.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: Not used.
Variables: None.
Receive
Description: This trigger is checked when an object is given to the mob.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If 0 is returned, the object will not be transferred to the mob. For any other number, the normal result will occur.
Variables:
actor is set to the character giving the mob the object.
object is set to the object being given.
Fight
Description: This trigger is checked every round the mob is fighting, after all mob has had its attacks.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: Not used.
Variables:
actor is the character the mob is fighting.
Hitprcnt
Description: This trigger is checked during combat when the mob's hit points drop below the percentage specified by the numeric argument.
Argument: Not used.
Numeric Argument: This is the percentage of hit points a mob must drop below for the trigger to be checked.
Return value: Not used.
Variables:
actor is set the the character fighting the mob.
Bribe
Description: This trigger is checked when coins are given to a mob.
Argument: Not used.
Numeric Argument: This is the minimum number of coins that must be given to the mob for the trigger to be run.
Return value: Not used.
Variables:
actor is set to be the character giving the mob the coins.
amount is the number of coins given to the mob.

I T E M   T R I G G E R S
Global
Description: This is not a trigger by itself, but is to be used with the random trigger. A trigger which is global is checked even if there are no PCs in the same zone as the object. (This trigger is not yet implemented.)
Argument: Not used.
Numeric Argument: Not used.
Return value: Not used.
Variables: None.
Random
Description: This trigger is checked periodically (currently every thirteen seconds).
Argument: Not used.
Numeric Argument: The chance this trigger will be run when it is checked.
Return value: Not used.
Variables: None.
Command
Description: This trigger is checked whenever a character types a command. If the command typed is a substring of the argument, the trigger is called.
Argument: The command name.
Numeric Argument: This determines where the item must be for the trigger to be run. A 1 means the item must be in the character's equipment for it to be used. A 2 means the item must be in the character's inventory. A 4 means the item must be in the same room as the character. These can be added together so the item can be in more than one place. For example, if the numeric argument was 3, the trigger would work if the item was in the character's inventory or equipment. A 7 would mean the trigger would work in the character's inventory, equipment, or in the room.
Return value: If 0 is returned by the trigger, the character will receive the same message as if the trigger did not exist, and any other command triggers in the room will be checked.
Variables:
actor is set to the character typing the command.
arg is set to the argument of the command.
cmd is set to the command of the command.
arg1_ch is set to the first located mob or character that matches the first word in arg
arg2_ch is set to the first located mob or character that matches the second word in arg
arg1_obj is set to the first located object that matches the first word in arg
arg2_obj is set to the first located object that matches the second word in arg
Put
Description: This trigger is checked whenever the item is put in another item or an item is put in it.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If 0 is returned, the object is not picked up. For any other value, the object will go to the character's inventory as normal.
Variables:
actor is set to the mob that does the putting.
object is set to the object put in or the object being put into, whichever is appropriate
Get
Description: This trigger is checked whenever the item is picked up.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If 0 is returned, the object is not picked up. For any other value, the object will go to the character's inventory as normal.
Variables:
actor is set to the mob that picks up the object.
Drop
Description: This trigger is checked when a character attempts to drop an object with a Drop trigger.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If 0 is returned, the object is not dropped. For any other value, the object will go to the room as normal.
Variables:
actor is set to the character attempting to drop the item.
Give
Description: This trigger is checked whenever someone attempts to give away the object.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If the return value is 0, the object will not be given to the victim. For any other return value, the give will occur normally.
Variables:
actor is the character giving the object.
victim is the character receiving the object.
Wear
Description: This trigger is checked whenever a mob attempts to wear the item.
Argument: Not used.
Numeric Argument: Not used.
Return value: If 0 is returned, the item is not worn.
Variables:
actor is set to the mob that is attempting to wear the object.

W O R L D   T R I G G E R S
Global
Description: This is not a trigger by itself, but is used with another trigger type. A trigger which is Global is checked even if there are no PCs in the zone.
Argument: Not used.
Numeric Argument: Not used.
Return value: Not used.
Variables: None.
Random
Description: This trigger is checked periodically (every 13 seconds). The trigger is not checked if there is no PC in the same zone as the room, unless it is also a Global trigger (see above).
Argument: Not used.
Numeric Argument: The chance this trigger will run when it is checked.
Return value: Not used.
Variables: None.
Reset
Description: This trigger is called each time the zone of the room it is attached to is reset.
Argument: Not used.
Numeric Argument: The chance this trigger will run when it is checked.
Return value: Not used.
Variables: None.
Command
Description: This trigger is checked whenever a character types a command. If the command typed is a substring of the argument, the trigger is called.
Argument: The command name.
Numeric Argument: Not used.
Return value: If 0 is returned by the trigger, the character will receive the same message as if the trigger did not exist, and any other command triggers will be checked.
Variables:
actor is set to the character typing the command.
arg is set to the argument of the command.
cmd is set to the command of the command.
arg1_ch is set to the first located mob or character that matches the first word in arg
arg2_ch is set to the first located mob or character that matches the second word in arg
arg1_obj is set to the first located object that matches the first word in arg
arg2_obj is set to the first located object that matches the second word in arg
Speech
Description: This trigger is checked whenever someone says something in the room. If the numeric argument is 0, the trigger checks to see if Argument is a substring of what was said. If the numeric argument is 1, the trigger checks to see if any word in Argument matches a word of what was said to see if the trigger should be called.
Argument: The phrase or word list to be matched
Numeric Argument: If this is 0, Argument is a phrase. If it is 1, Argument is a word list.
Return value: Not used.
Variables:
actor is set to the character speaking.
speech is set to the entire text spoken.
Enter
Description: This trigger is checked whenever someone enters the room. This trigger is checked just before the character enters the room, so if you want the action to occur in the room the character is entering, you must use a wait, or teleport the character. (See Script Commands for more information on wait and teleport.)
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when checked.
Return value: If the return value is 0, the character will not enter the the room. For any other return value, the character enters the room as normal.
Variables:
actor is set to the character that entered the room.
direction is set to the name of the direction the actor entered from. (More accurately, to the direction opposite the direction the actor walked in.)
Drop
Description: This trigger is checked with a character attempts to drop something in the room. This trigger is checked just before the character actually drops the item.
Argument: Not used.
Numeric Argument: This is the percent chance that the trigger will be run when it is checked.
Return value: If 0 is returned, the item will not be dropped. Otherwise, the item is dropped as normal.
Variables:
actor is set to the character dropping the item.
object is set to the item being dropped.

Table of Contents, Previous Chapter, Next Chapter
Builder's Information | Home