buddha/bin/
buddha/cnf/
buddha/lib/
buddha/lib/etc/boards/
buddha/lib/house/
buddha/lib/misc/
buddha/lib/plralias/ZZZ/
buddha/lib/plrfiles/
buddha/lib/plrfiles/ZZZ/
buddha/lib/plrobjs/
buddha/lib/plrobjs/ZZZ/
buddha/lib/world/
buddha/lib/world/gld/
buddha/src/
buddha/src/doc/
TRIGEDIT-TYPES TRIGGER-LIST TRIGGER-TYPES TRIG-TYPES
 
   Triggers are broken up into three types by what they are attached to:
 
|         ROOMS          |         OBJECTS         |            MOBS         |
=============================================================================
|  TRIGEDIT-ROOM-GLOBAL  |   TRIGEDIT-OBJ-GLOBAL   |  TRIGEDIT-MOB-GLOBAL    |
|  TRIGEDIT-ROOM-RANDOM  |   TRIGEDIT-OBJ-RANDOM   |  TRIGEDIT-MOB-RANDOM    |
|  TRIGEDIT-ROOM-COMMAND |   TRIGEDIT-OBJ-COMMAND  |  TRIGEDIT-MOB-COMMAND   |
|  TRIGEDIT-ROOM-SPEECH  |   TRIGEDIT-OBJ-TIMER    |  TRIGEDIT-MOB-SPEECH    |
|  TRIGEDIT-ROOM-ZONE    |   TRIGEDIT-OBJ-GET      |  TRIGEDIT-MOB-ACT       |
|  TRIGEDIT-ROOM-ENTER   |   TRIGEDIT-OBJ-DROP     |  TRIGEDIT-MOB-DEATH     |
|  TRIGEDIT-ROOM-DROP    |   TRIGEDIT-OBJ-GIVE     |  TRIGEDIT-MOB-GREET     |
|  TRIGEDIT-ROOM-CAST    |   TRIGEDIT-OBJ-WEAR     |  TRIGEDIT-MOB-GREET-ALL |
|  TRIGEDIT-ROOM-LEAVE   |   TRIGEDIT-OBJ-REMOVE   |  TRIGEDIT-MOB-ENTRY     |
|  TRIGEDIT-ROOM-DOOR    |   TRIGEDIT-OBJ-LOAD     |  TRIGEDIT-MOB-RECEIVE   |
 ========================|   TRIGEDIT-OBJ-CAST     |  TRIGEDIT-MOB-FIGHT     |
                         |   TRIGEDIT-OBJ-LEAVE    |  TRIGEDIT-MOB-HITPRCNT  |
                         |   TRIGEDIT-OBJ-CONSUME  |  TRIGEDIT-MOB-BRIBE     |
Further help can be       =========================|  TRIGEDIT-MOB-LOAD      |
accessed by typing:                                |  TRIGEDIT-MOB-MEMORY    |
@RHELP <TYPE>@n.                                       |  TRIGEDIT-MOB-CAST      |
i.e. @RHELP TRIGEDIT-MOB-ACT@n                         |  TRIGEDIT-MOB-LEAVE     |
                                                   |  TRIGEDIT-MOB-DOOR      |
See also: TRIG-COMMANDS, VARIABLES, EXPRESSIONS     =========================
#0
TRIGEDIT-COMMANDS TRIG-COMMANDS TRIGGER-COMMANDS TRIGEDIT-COMMANDLISTS
 
| Script Commands  |  Mobile Commands  |  Object Commands  |   Room Commands  |
 =============================================================================
|   * (comment)    |      %send%       |      %send%       |      %send%      |
|       nop        |      %echo%       |      %echo%       |      %echo%      |
|     attach       |   %echoaround%    |   %echoaround%    |   %echoaround%   |
|     global       |      %door%       |      %door%       |      %door%      |
|     context      |     %force%       |     %force%       |     %force%      |
|      eval        |      %load%       |      %load%       |      %load%      |
|       set        |     %purge%       |     %purge%       |     %purge%      |
|      unset       |    %teleport%     |    %teleport%     |    %teleport%    |
|     detach       |     %damage%      |     %damage%      |     %damage%     |
|     extract      |    %zoneecho%     |    %zoneecho%     |    %zoneecho%    |
|       if         |     %asound%      |     %asound%      |     %asound%     |
|      halt        |     dg_affect     |     dg_affect     |     dg_affect    |
       wait        |      dg_cast      |      dg_cast      |      dg_cast     |
|     makeuid      |       %at%        |       %at%        |       %at%       |
|     rdelete      |    %transform%    |    %transform%    |==================|
|      remote      |       mhunt       |      otimer       |
|      return      |     mremember     |     osetval       |
|      switch      |      mforget      |===================|
|       case       |       %goto%      |
|      break       |       mkill       |
|      done        |       %junk%      | Further help can be accessed by
|      while       |      %follow%     | typing: @RHELP <COMMAND>@n.
=======================================|
See also: TRIG-TYPES, VARIABLES, EXPRESSIONS
#0
%DAMAGE% ODAMAGE MDAMAGE WDAMAGE

%damage% %victim% amount

   Cause amount points of damage to victim. The amount can be negative, to 
create a healing effect.

%damage% %actor% -20          - cause 20 points of healing 
%damage% %actor% 20           - cause 20 points damage
%damage% %actor% %random.20%  - cause 1-20 points damage randomly

eval stunned %actor.hitp%     - evaluate all hitpoints and then damage
%damage% %actor% %stunned%    - leaving the player stunned, but will recover 

eval num_hitp %actor.hitp%/2  - calculate half of hitpoints and then damage
%damage% %actor% %num_hitp% 

Example: @RTSTAT 16
         TSTAT 3008@n

See Also: DEATH
#0
%DOOR% WDOOR ODOOR MDOOR TRIGEDIT-EXIT TRIG-EXIT 

%door% <vnum> < direction> < field> [value] 

  Used for adding, deleting, and modifying doors in room #vnum. Direction 
determines which door is being changed, and can be north, south, east, west, 
up, or down. If the door does not exist first, a new door will be created. 
Field is what property of the door is being changed. Valid fields are:

purge       - remove the exit in the direction specified - no value needed
description -  value will become the new exit description
flags       -  value will be the new door flags bitvector as defined here:
            a - Exit is a door that can be opened and closed. Default is open
            b - The door is closed. 
            c - The door is locked. 
            d - The door is pick-proof. 
key         - value is the vnum of the key to the door in this direction.
name        - value is the name of the door in the specified direction.
room        - value is the vnum of the room this direction leads to
 
Example: @RTSTAT 17@n
#0
%ECHO% %ECHOAROUND% %SEND% TRIG-SEND %ZONEECHO% ZONEECHO ZECHOAROUND ECHOAROUND OECHO WECHO MECHO OECHOAROUND WECHOAROUND MECHOAROUD OSEND WSEND MSEND ZONECHO

%echo% <message>
   Message is sent to all non-sleeping characters in the same room that this 
script is executing in.

%echoaround% <victim> <message>
   Message will be sent to all characters in the room with victim, except for 
the victim.

%send% <victim> <message>
   Message will be sent to the victim only.
  
%zoneecho% <room vnum> <message>
   Zoneecho echoes message to the entire zone. room vnum should be any vnum in 
   the zone you wish to echo around. 13400 would echo in zone 134.

NOTE: When used with mobs make sure the mobs can see the players. i.e not blind, set INFRA.
Example: @RTSTAT 18@n

See Also: %ASOUND%
#0
%FORCE% OFORCE WFORCE MFORCE TRIGEDIT-FORCE TRIG-FORCE

%force% <victim> <command>

   Force the victim to perform a particular command. Cannot be made to force 
level 32 and above.

   This little script teleports the actor to another place when he enters the
room. It then makes him look to see the description.

Trigger Intended Assignment: Rooms
Trigger Type: Enter , Numeric Arg: 100, Arg list: None
Commands:
wait 1 s
%echo% A powerful force drags you down.
%teleport% %actor% 3001
%force% %actor% look
#0

#0
%LOAD% OLOAD MLOAD WLOAD

%load% <obj|mob> <vnum> [name [position]]

   This command loads a mob or object into the game. No-take objects loaded to
a mob will load to the room.

load an object to room: %load% obj 1300
load a mob to room    : %load% mob 1300
load obj to player inv: %load% obj 1300 %actor% inv
equip obj to player   : %load% obj 1300 %actor% waist

See Also: POSITIONS, CHAR-VAR
#0
%PURGE% OPURGE MPURGE WPURGE

%purge% <victim>

   Purge removes objects or mobs from the game. If no argument is given, then
all objects and mobs in the room will be removed. If there is an argument,
only that mob or object will be  purged. Players can not be purged.

Examples: 
   %purge% %self%
   %purge% %actor.inventory(1300)%   
   %purge% %actor.eq(hold)%
 
Example: @RTSTAT 1375, 6300@n

See Also: POSITIONS
#0
%TELEPORT% WTELEPORT OTELEPORT MTELEPORT PORTALS

%teleport% <victim> <location>

   Teleport moves the victim to the target. The victim does not need to be in 
the same room as the mob. If the victim is 'all', all the characters in the 
room will be teleported to the target room. No messages are generated by this 
command.

%teleport% all 17401
%teleport% %actor% 1300

PORTAL EXAMPLES:
   OBJ:  @RTSTAT 100@n
   ROOM: @RTSTAT 101@n
   MOB:  @RTSTAT 102@n
#0
DG_CAST

dg_cast 'spellname' [target]

   This allows the holder of a trigger to cast spells. Spells will work for 
rooms and objects, as well as mobiles.

   This simple example allows the mob to cast poison 10% of the time while fighting.
Trigger Intended Assignment: Mobiles
Trigger Type: Fight , Numeric Arg: 10, Arg list: None
Commands:
dg_cast 'poison' %actor%

Example: @RTSTAT 132@n
See Also: SPELLS
#0
%ASOUND% OASOUND MASOUND WASOUND ASOUND

%asound% <message>
   
   The message is sent to all surrounding rooms.

Trigger Intended Assignment: Rooms
Trigger Type: Random , Numeric Arg: 10, Arg list: None
Commands:
   %asound% You hear a blood chilling howl from nearby.
#0
%AT% WAT MAT OAT

%at% <target> <command>

   Using %at% will perform the command in the room where target is found.

Example: @RTSTAT 19@n
         @RTSTAT 20@n
#0
MFORGET MREMEMBER %FORGET% %REMEMBER%

mremember <victim> [command]

   The victim is placed into this mobile's memory list. The next time the 
victim is seen by the mobile, the mobile will perform command if set, or 
execute the memory trigger if no command was provided. When the command is 
carried out or the script executed, the victim is forgotten.

NOTE: Any mob using the mremeber command MUST have a MEMORY trigger attached. 
It doesn't matter if the Memory trigger is never called (Narg 0).
Only Mobs may use mremember.

mforget <victim>
   Remove victim from this mobile's memory list. 

Example: @RTSTAT 74@n
         @RTSTAT 75@n
#0
MGOTO %GOTO%

%goto% <target>
   This command moves the mob to the given target. The target may be an object,
room, or  character, as long as it is not in a private room occupied with two 
or more characters, or god  room. No message is given. 

%goto% 1233
%goto% Rumble
%goto% fountain
#0
MJUNK %JUNK%

mjunk <object | all>
   
   The object in the mob's inventory specified is removed from the game. 
'Mjunk all' removes all of the objects in the mob's inventory. No message 
is sent by this command. Only mobs may use this command.
#0
%FOLLOW% TRIG-FOLLOW MFOLLOW

mfollow <victim>
   The mobile will begin following the victim without the revealing "starts
following you" message. A silent follow.

Examples: @RTSTAT 40, 39@n
#0 
MHUNT %HUNT% HUNT 

mhunt <victim>
   The mobile will begin to hunt for victim, and engage in combat upon finding 
them. Only Mobiles may use this command. Hunting mobs will walk through NOMOB
rooms.

*mobs do not currently engage upon finding, it is bugged.

Examples: @RTSTAT 41, 202, 19596, 19695@n
#0
%KILL% WKILL OKILL MKILL

mkill <victim>
mkill %actor%
   mkill causes the mob to hit the victim. It is the same as kill, except mkill 
works for low level mobs attacking PCs, where kill might not.
#0
%TRANSFORM% MTRANSFORM OTRANSFORM TRANSFORM

%transform% <vnum|-vnum>

   This command causes the executing mob or object to transform into another 
mob or object, based on the vnum argument supplied. The transformation is 
permanent, though additional transformations may be performed. No message 
regarding the transformation is sent to the room. The new mob or object will 
have the same script as the original, rather than any script normally assigned 
to the new, and no load trigger will be executed.

   Mobs - The hit points, max hit points, position, gold, and experience value 
will remain those of the original mob but all other statistics and descriptions 
will be those of the new mob. (The new mob can be made to have all of its normal 
statistics by using a negative vnum.) Only mobiles may use this command (naturally).

   Objects - Based on the vnum argument supplied. The four basic values will 
remain those of the original mob but all other statistics and descriptions will 
be those of the new object. The transformation is permanent, additional 
transformations may be performed. No message regarding the transformation is 
sent to the room. The new object will have the same script as the originating 
object, rather than any script normally assigned to the new object, and no 
load trigger will be executed.

Example: @RTSTAT 21, 1370@n
#0
OTIMER %TIMER% 

otimer <value>

   Set the countdown timer of this object to value. Useful for objects with 
timer triggers.
#0
OSETVAL %SETVAL%

osetval <position> <value>

   Osetval lets you alter the object values of an object. The meaning of the 
values depends on the object type (@RHELP OEDIT-VALUES@n).
#0
COMMENT * 

* This is an example of a comment in trigedit. Because of the *'s the lines 
* are not parsed, so the script still works even if it has a lot of 
* explanations built in. All triggers should be heavily commented.

* The below line sends the text 'Trigger firing' to the room.
%echo% Trigger firing

   Comments are useful in scripts to document what is happening, for future 
reference, and for others to see what the script does.

See also: REDIT-ROOM-FLAGS
#0
NOP

   Almost a no-operation. Certain variable/subfield combinations for characters 
change some attribute about the character. nop allows those changes to be used 
legally on lines that do not need to process the result.

* this will award the actor with 10 gold
nop %actor.gold(10)%
* this awards 10 experience
nop %actor.exp(10)%

Here is a workaround to use a variable:
  *nop workaround
  eval making %%self.gold(%coins%)%%
  nop %making%

#0
GLOBALS GLOBAL-VARIABLES GLOBAL-VARS GVARS

Usage: global variablename
* To make a variable 'reachable' from other scripts it has to be made 'global'. 
* In this case I make a local known var %has_bribed_guard% and make it global. 
* It's a good idea to use this in conjunction with context.
global has_bribed_guard

   Used to change a variable from local to global. If a global variable is 
modified, this command must be used to update the global contents as well.

Example: @RTSTAT 45@n

See Also: VARIABLES, CONTEXT
#0
CONTEXT

Usage: context number
* This little script will make sure one %has_said_hello% exist for each player.
context %actor.id%
set has_said_hello 1
global has_said_hello
* now only scripts running with context = %actor.id% can access this particular 
* variable. however - it's a better idea to use vars set on players: help remote.

   Changes the "context" of a script to this value. When first run, a script's 
context is 0. When a variable is made global, it is given the current context. 
When a variable is accessed, if it must be searched for globally, a "found" 
variable must either have context 0 or the current context. The net result of 
this is you may have many global variables in a single script, with the same 
name, differing only by context. Players may have variables; this mostly 
removes the need for variable context. Previously, a player's ID could be used 
as variable context to allow a script to service multiple players at once.

See Also: REMOTE
#0
EVAL

Usage: eval <variable> <expression>

* this example immediately evaluates the expression below and stores the result
* in %result%:
eval result %self.hitp% * 100 / %self.maxhitp% 
say My hitpoint percentage is %result%
* this result will not change after the evaluation even if %self.hitp% changes.

   The eval command is used to set (or create) the specified variable equal to 
the result of the immediate evaluation of the provided expression. There also 
exists a "set" command, with the same syntax. Set differs in that the expression
is not evaluated until the variable is accessed.

See Also: TRIG-SET
#0
TRIG-SET

Usage: set <variable> <value>

Set sets variable to value, without evaluating it. 
 Example: set foobar 15 - 5
 sets the variable foobar to the string "15 - 5"

* this example sets the value of result to '%self.hitp% * 100 / %self.maxhitp%'
set result %self.hitp% * 100 / %self.maxhitp% 
* The %result% var now works as a 'function' every time it's accessed.
say My hitpoint percentage is %result%
%damage% %self% 30
say My hitpoint percentage is %result%

   The set command is used to set (or create) the specified variable equal to 
the provided expression, which will be evaluated when the variable is accessed. 
There also exists an "eval" command, with the same syntax. Eval differs in that 
the expression is evaluated immediately.

See Also: EVAL
#0
UNSET

Usage: unset variable
* in this example we have a var %testvar% we no longer need:
set testvar hops happily along
%echo% %self.name% %testvar%
unset testvar
* please note - if we had made the var global, it'd be gone instead.

   Remove the variable from the global variables of this script, or if not 
found there, from the script.

See Also: SET, EVAL
#0
EXTRACT

Usage: extract to-variable word-number from-text
* could be used to do strange things to what people say:
extract testvar1 1 %speech%
extract testvar2 2 %speech%
extract testvar3 3 %speech%
extract testvar4 4 %speech%
say do you mean %testvar4% %testvar3% %testvar2% %testvar1% ?

   Place a specific word from the 'from-text' into a new or existing variable 
'to-variable'. Do not enclose the name of the to-variable in %'s.
#0
IF ELSEIF END

Usage: if (expression)
...
 elseif (expression)
...
 else
...
 end
   if (if %actor.vnum% == -1) 
     %echo% You are a player
   else 
     %echo% You are a mob.
   end

   An 'if' must occur before the other three. If expression evaluates to true 
(@RHELP EXPRESSIONS@n), the statements between the if statement and the next 
elseif, else, or end are executed. If it stopped at an elseif or else, it scans 
for the next end, and continues execution at that point. If the expression 
evaluated to false, it searches for the next elseif, else, or end. If it finds 
an elseif, it checks that expression. If it is true, it executes the statements 
between the elseif and the next elseif, else, or end, and then finds the end of
the block. If it is false, it continues searching in the same pattern, until a 
true elseif is found, an else is found, or an end is found. There may be 0 or 
1 else statements and 0 or many elseif statements in the block.

For anyone having trouble with the format of if/elseif/else/end blocks
@RTSTAT 22@n. Relsqui made this excellent example.

***EVERY IF NEEDS AN END: 2 IF'S NEEDS 2 ENDS....***

See Also: EXPRESSIONS, NESTED
#0
NESTED-IFS

   A nested if is an if statement contained within another if or if...else 
statement. Nested if's allow the creation of a decision tree or flow chart
of events with multiple conclusions. 
   Always use /f to format and indent your trigger. This will warn you if you
do not have the correct number of ifs to ends. @RWARNING:@n multiple unmatched
if/ends will crash us. Make sure everything lines up with /f before you test.
 
Example: @RTSTAT 1490, 41000@n
#0
HALT

Usage: halt

   Halt terminates the trigger execution.    

* This script attacks players of level 20 and above. The reason for the use of 
* halt and return 0 is to make sure other scripts are checked too.
if %actor.level% < 20
  return 0
  halt
end
  %echo% %self.name% yells a Battlecry and throws himself at you.
  mkill %actor%

   Terminates the trigger execution.
#0
MAKEUID VAREXISTS %VAREXISTS% %EXISTS% EXISTS

Usage: makeuid variable id
* We have one mob giving a quest. This mob sets the targets id as a global on 
* the player via the 'remote' command, like this:
eval quest_object %obj.id%
remote quest_object %actor.id%
* We then have another mob receiving the quest object, with the following script.
if !(%actor.varexists(quest_object)%)
  return 0
  halt
end
* now we know the player has a quest_object variable
makeuid obj %actor.quest_object%
say Have you brought me %obj.shortdesc%, %actor.name% ?
say You must bring it to me to complete your quest, you know.

   Creates a new variable with the name given, whose contents shall be suitable 
for referring to a character, object, or room whose id is provided.
#0
RDELETE

Usage: rdelete variable id
* This is used to remove a variable
say Thank you, %actor.name% - your quest is completed.
rdelete quest_object %actor.id%

   Delete a remote variable from the script referred to by the id of its owner.

See Also: VDELETE, REMOTE
#0
REMOTE

Usage: remote <variable> <id>

Remoting a variable saves that variable to the player file for future access. 
This is used heavily for quests to limit a player to only performing it once.
Here is a quick example from zone 14. The variable must first be set and then
saved to the players file via remote, like:
  * setting the variable to 1 means completed.
  set solved_example_quest_zone_14 1
  remote solved_example_quest_zone_14 %actor.id%
Then in future triggers it is checked if that variable already exists in the
player file. In this example, if it does the player is not allowed to continue.
<variable> should always be a unique name. I suggest always including zone #.
<id> can be any value or text you wish to use later.

   Create a global variable belonging to a character or player whose id is 
specified. The variable must first exist in the script that is running.

For more examples go through the trigedit hallway.
Examples: @RTSTAT 1409-1411, 23612-23614@n

See Also: RDELETE, VDELETE, TRIG-SET, CONTEXT
#0
TRIG-RETURN
 
Usage: return 0
 
   Return sets the return value of the trigger. Normally, a script will return
1, unless return 0 is specified. Unlike most computer languages, the return  
command does not end the trigger's execution. The value is returned after all 
the commands have been executed, or a wait or halt command is called. 

Example: @RTSTAT 1364@n

See Also: HALT, WAIT
#0
TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK

Usage: switch expression
    
switch %random.4%
  case 1
    emote sings a merry song about someone named Fulbert and Beatrice.
  break
  case 2
    emote booms out loudly, 'Heigh Ho! Heigh Ho! It's home from work we go!'
  break
  case 3
    emote tries to sing falsetto, but his voice doesn't agree.
  break
  default
    sing
  break
done

   Switch evaluates an expression and looks for a match amongst the case 
statements that follow. If none of the following case statements are a match, 
and a default statement exists, the default statement is considered a match. 
If a match is found, the commands that follow it, up until a break or done 
command, are executed. 
Break is used to terminate commands in a switch. 
Case is used to begin a new conditional group in a switch block.
Default is similiar to case but matches any condition not met. 
Done is used to terminate a while or switch block.

Examlpe: @RTSTAT 18@n
#0
WHILE DONE

Usage: while expression

   The while command starts a loop, running until the expression becomes zero 
or negative. This can make permanent loops - be careful. The switch block must 
be terminated by a done. While loops are disabled after looping 100 times.

Room example: @RTSTAT 24@n
Obj example:  @RTSTAT 23@n
#0
WAIT WAITUNTIL WAIT-UNTIL PAUSE TRIGEDIT-TIMING TIMING

Usage: wait <time> [s]
       wait until <mudtime>
* This script gives the actor 10 seconds to get out.
say GET OUT! NOW!
wait 10 s
mkill %actor%

   The wait statement is used to 'pause' the script execution for a period of 
time. When a script is being executed it will attempt to execute all commands 
right away. To get small breaks in, and perhaps give the players time to adjust, 
use the wait command.

* If you want to syncronise your script, you can use the 'wait until' feature.
* This script wakes the mob at dawn, and puts him to sleep at night.
wait until 8:00
wake
* wait # without seconds following it will wait 10 ticks, which is very quick.
wait 10 
yawn
wait 10
stand
* This one uses wait 10 seconds. Recommend you always use seconds
wait 10 sec
emote looks sleepy.
wait until 21:00
yawn
wait 10 s
rest
wait 10 s
sleep
#0
TRIGEDIT-VARIABLES VARIABLES TRIG-VARS TRIG-VARIABLES VARS 

Variables appear as a name surrounded by '%'s, such as %actor% 

Before a command is processed, the line is scanned and any variables are
replaced. First the list of local variables are checked to see if the variable
is there. If not, the global variables are checked. A proper global match must
have a zero context or the current context of the script. (When a script starts
running, its context is 0. The script context command may be used to change
context.) If a match is still not found, a list of 'built in' variables (ones
not declared by the script) are checked. If no match is found, the variable is
replaced with an empty string (the variable is removed from the line, and
nothing added in its place).

There are two types of variables, local and global. All local variables are
deleted when a trigger finishes executing, and can only be used by the trigger.
Global variables remain until removed with unset, or the script is removed. 

Global variables also have a context associated with them. By default, the
context is 0. Any global being referenced with a context of zero will be seen.
Through the 'context <value>' command, a script may set its context to any
integer; Globals created are always assigned the current script context. When a
global is referenced, if it's context is not 0 or the current context of the
script, it will not be seen. This technique allows, among other things, arrays
of globals to be created by using a series of contexts as indexes. Also, it
allows globals to be associated with a specific character, room, or object in
the game, by using the id of the target as the context. 

Variable Fields 

A field of a variable can also retrieved, based on their type. To get a field,
a notation of %variable.field% is used. The valid fields are listed in the help
files below. 

@RCHAR-VAR@n - Variables for characters.    @RTSTAT 27@n
@ROBJ-VAR@n  - Variables for objects.       @RTSTAT 28@n
@RROOM-VAR@n - Variables for rooms.         @RTSTAT 29@n
@RTEXT-VAR@n - Variables for text.          @RTSTAT 30@n
@RSPEC-VAR@n - Variables for special stuff. @RTSTAT 31@n

See Also: GLOBAL
#0
MUDCOMMAND CMD.MUDCOMMAND %CMD.MUDCOMMAND% %MUDCOMMAND%

   Used to match text to existing commands in the MUD. This will also match
any abbreviations.
 
* check for command sit with arg chair. Also matching any abbreviations. 
if %cmd.mudcommand% == sit && chair /= %arg% && %arg%

Examples: @RTSTAT 81
          TSTAT 52
          TSTAT 62@n
#0
TRIGEDIT-VARIABLES-TEXTS TEXT-VAR %ARG% .CDR .CAR ARG.CDR CMD.CDR ARG.CAR CMD.CAR %TEXT% PUSH CMD %CMD% %CDR% %CAR% %TRIM% TRIGEDIT-TEXT-VAR %STRLEN%

Text Variable Fields 

   These fields pertain to any variable that contains a string of text. These 
are often the variables, such as %speech%, which are provided to a script, but 
can also be variables that have been created by the script, such as 
%room.north% 

When using field - The variable returns
 
strlen     - Returns the number of characters in the string.
trim       - Returns the string without any leading or trailing whitespace. 
             This is used to trim extra spaces from the beginning or end of a 
             string.
car        - Returns the first word of the string. For %text%="this is the 
             string"; %text.car% will yield "this". @RTSTAT 53@n
cdr        - Returns all but the first word of the string, trimmed. For %text%=
             "this is the string"; %text.cdr% will yield "is the string". 
contains() - Subfield used for comparison.
mudcommand - Returns the mud command the string is shorthand for. Used to make 
             sure the command you react to is the one you want: For %text%="o"
             %text.mudcommand% will yield "open". @RHELP MUDCOMMAND@n

Example: @RTSTAT 30@n
#0
TRIGEDIT-VARIABLES-SPECIALS SPEC-VAR %SELF% RANDOM %RANDOM% %TIME% %PEOPLE% TRIGEDIT-SPEC-VAR %RANDOM.CHAR% %SPEECH% 

Special Variables When using field - The variable returns:
 
self          - The mob, item, or room running the script. Normal fields may be 
                used with this.
time.<field>  - Field may be hour, day, month, or year. The returned value will 
                be the current hour in the mud (0-23), day of the month (1-35),
                month (1-16), or year respectively.
people.<vnum> - This variable returns the number of people in the room 
                specified via vnum.
random.<#>    - This returns a number between 1 and the field value. 
                %random.10% would return a number between 1 and 10.
random.char   - This returns a random character in the room.
speech        - This variable is set to the complete phrase spoken by an actor 
                that triggers a speech trigger.

|%var%        - name's, someone's, your
&%var%        - it, you, he/she
*%var%        - it, you, him/her
* object only
'%obj%        - something, name

Example: @RTSTAT 31@n
#0
TRIGEDIT-VARIABLES-ROOMS ROOM-VARIABLES %WEATHER% %ID% %NAME% %DIRECTION% TRIGEDIT-ROOM-VAR %VNUM% CONTENTS %CONTENTS% %ROOMS% ROOM-VARS 

Rooms When using field - The variable returns:
 
contents - The id of the first obj in the room.
(dir)    - The list of flags affecting the exit in the specified direction: 
           north, south, east, west, up or down. The result is either:
           subfield, "vnum"  - vnum of room in direction
           subfield, "key"   - vnum of key to use
           subfield, "bits"  - CLOSED LOCKED, etc.
           subfield, "room"  - room variable for room in direction
           no subfield: same as 'bits'. %self.north(key)%
id       - The unique id of the room.
name     - The name of the room.
people   - The id of the first character in the room, or an empty return.
sector   - The sector type of the room.
vnum     - The room's vnum.
weather  - current weather: sunny, cloudy, rainy, or lightning @RTSTAT 41098@n.

Example: @RTSTAT 29@n
#0
TRIGEDIT-VARIABLES-OBJECTS OBJ-VAR %SHORTDESC% TRIGEDIT-OBJ-VAR VAL0 VAL1 VAL2 VAL3 %OBJECT% OBJVARS OBJ-VARS

Objects When using field - The variable returns:
 
carried_by   - The id of the character carrying the object, or an empty return.
contents     - Gives the first object in a container.  @RTSTAT 32@n
cost         - The cost (not rent cost) of the object.
cost_per_day - The rent cost of the object
id           - The unique id of the object.
is_inroom    - Returns true if object is in room.
name         - The list of key words of the object.
next_in_list - The id of the next object in the characters inventory, or an
               empty return
room         - Returns the room id the object is in.
shortdesc    - The name of the object that players see.
timer        - The timer of the object.
type         - The type of object, such as WAND, ARMOR, or KEY.
val0         - Returns the current value 0 of the object, defined here.
val1         - Returns the current value 1 of the object, defined here.
val2         - Returns the current value 2 of the object, defined here.
val3         - Returns the current value 3 of the object, defined here.
vnum         - The virtual number of the object. 
weight       - The weight of the object.     
worn_by      - The id of the character wearing the object, or an empty return

Example: @RTSTAT 28@n
#0
TRIGEDIT-VARIABLES-CHARACTERS HAS_ITEM CHAR-VAR TRIGEDIT-CHAR-VAR ACTOR.INV %ACTOR.INV% %ACTOR.ALIGN% %ACTOR.EQ% %ACTOR.ID% ACTOR.ID ACTOR.VNUM %ACTOR.VNUM% %ACTOR.NAME% IS_PC %IS_PC% %ACTOR% MASTER %VICTIM% SELF %SELF% MOBVARS MOB-VARS 

When using field  - The variable returns:
 
alias             - The list of aliases of the mob or the player name. 
align             - The numeric alignment of the actor.
affect()          - Checks the actor for the affect in the subfield 
canbeseen         - True if the actor can be seen by the mob (always true 
                    for non-mob triggers).
cha               - The actor's charisma.
class             - The actor's class, as a string.
con               - The actor's constitution.
dex               - The actor's dexterity.
exp()             - %actor.exp% returns the actor's XP. Using the subfield it 
                    can be modified up to 1000 Xp. %actor.exp(20)% gives actor
                    20 XP. The subfield can be negative. 
eq()              - This will return the identifier (id) for the object 
                    equipped in position, if any. The specified position may be 
                    either a position number (0-18) or the name of the location.
                    * checks all positions. @RHELP POSITIONS@n
fighting          - The unique id of the mob fighting the actor.
follower(name)    - The follower of the actor (as an id) with name supplied.
gold()            - %actor.gold% returns the amount of gold on the actor. This
                    amount can be changed by the subfield. %actor.gold(20)% 
                    gives the actor 20 gold. The subfield can be negative. 
has_item()        - Checks if the actor has a object (inventory, equipped and in 
                    containers) by subfield name/var/vnum.
heshe             - Returns the correct pronoun (he/she/it).
himher            - Returns the correct pronoun (him/her/it).
hisher            - Returns the correct pronoun (his/her/its).
hitp              - The current hit points of the actor.      
id                - The unique id of the actor.
int               - The actor's intelligence.
inventory()       - Returns the id of the first item in the actors inventory or 
                    the id of the first object with vnum in the subfield. If
                    the character doesn't have the item, an empty string is
                    returned. %actor.inventory(1300)%. * checks for any inv. 
                    @RTSTAT 19537@n.
is_killer(on/off) - If the ()'s are omitted, return value is whether or not the 
                    actor is marked as a Player killer. If the ()'s are 
                    omitted, return value is whether or not the character is 
                    marked as a killer. Can be set on or off with: 
                    nop %actor.is_killer(on)%
is_pc             - Checks if the actor is a player. Useful when you want a 
                    trigger to fire on players and not mobs. 
is_thief(on/off)  - If the ()'s are omitted, return value is whether or not the 
                    actor is marked as a Player Thief. 
level             - The actor's current level.
mana              - The current mana points of the actor.
master            - The master of the actor (as an id), or an empty return.
maxhitp           - The maximum hit points of the actor.
maxmana           - The maximum mana points of the actor.
maxmove           - The maximum movement points of the actor.
move              - The movement points of the actor.
name              - The actor's name (the short description for mobs).
next_in_room      - The next actor in the room as a variable (id) nice to 
                    use for loops, or an empty return.
prac()            - The actor's number of practices. Subfield modifies.
race              - The actor's race, as a string. (not used in stock Circle)
room              - The room the actor is in as a room variable. 
sex               - The actor's sex, as a string: MALE, FEMALE, or NEUTRAL.
skill()           - The percentage of learnedness in the skill subfield.
str               - The actor's strength.
stradd            - The actor's strength addition (if str is 18).
title()           - The actor's title. Subfield sets. Not used for mobs.
varexists()       - Returns 1 if global variable in subfield exists, 0 if not.
                    Useful when dealing with remote vars on players.
vnum              - The actor's virtual number.  
weight            - The actor's weight. 
wis               - The actor's wisdom.    
<global>          - If the specified field is not a recognized one, the 
                    actor's script global list is searched for a matching 
                    global name. If found, its value will be returned. This 
                    can is also used to get values of vars set on players;
                    if %actor.varexists(testvar)%
                      set testvar %actor.testvar%
                    end
                    * and then later in the script write it back:
                    remote testvar %actor.id%

Example: @RTSTAT 27@n
#0
EXPRESSIONS TRIGEDIT-EXPRESSIONS INCREMENTS MATHEMATICAL /= || \

A false expression is any expression that evaluates to 0, or an empty string.
A true expression is any expression that evaluates to anything other than a
false expression. The following list are the recognized operators. The higher
the operator is on the list, the higher the precedence. The expression is
evaluated from left to right. Parenthesis can be used to group. 

|Operator|         Name          | Examples  0=False 1=True  |
--------------------------------------------------------------
|   ||   | logical or            | 0 || ( ) = 0; 5 || 0 = 1  |
|   &&   | logical and           | 1 && 0 = 0; 5 && 3 = 1    |
|   ==   | equivalence           | 5 == 3 = 0; dog == DoG = 1| 
|   !=   | inequality            | 0 != Z = 0; dog != d = 1  | 
|   <    | less than             | 4 < 3 = 0; 4 < 5 = 1      |
|   >    | greater than          | 4 > 3 = 1; 4 > 4 = 0      |
|   <=   | less than or equal    | 4 <= 3 = 0; 4 <= 5 = 1    |
|   >=   | greater than or equal | 4 >= 3 = 1; 4 >= 4 = 1    |
|   /=   | substring             | "concatenate" /= "cat"    |
|   -    | subtraction           | 15 - 10 = 5               |
|   +    | addition              | 10 + 15 = 25              |
|   *    | multiplication        | 10 * 20 = 400             |
|   /    | division              | 100 / 20 = 5              |
|   !    | negation              | !() = 1; !0 = 1; !dog = 0;| 
--------------------------------------------------------------

Example: @RTSTAT 63@n
#0
ROOM-TRIGGERS TRIGEDIT-ROOM-TYPES
 
 1) Global       @RHELP TRIGEDIT-ROOM-GLOBAL@n
 2) Random       @RHELP TRIGEDIT-ROOM-RANDOM@n
 3) Command      @RHELP TRIGEDIT-ROOM-COMMAND@n
 4) Speech       @RHELP TRIGEDIT-ROOM-SPEECH@n       
 6) Zone Reset   @RHELP TRIGEDIT-ROOM-ZONE@n       
 7) Enter        @RHELP TRIGEDIT-ROOM-ENTER@n        
 8) Drop         @RHELP TRIGEDIT-ROOM-DROP@n       
16) Cast         @RHELP TRIGEDIT-ROOM-CAST@n       
17) Leave        @RHELP TRIGEDIT-ROOM-LEAVE@n       
18) Door         @RHELP TRIGEDIT-ROOM-DOOR@n       
#0
OBJ-TRIGGERS OBJECT-TRIGGERS TRIGEDIT-OBJ-TYPES

 1) Global    @RHELP TRIGEDIT-OBJ-GLOBAL@n
 2) Random    @RHELP TRIGEDIT-OBJ-RANDOM@n            
 3) Command   @RHELP TRIGEDIT-OBJ-COMMAND@n             
 6) Timer     @RHELP TRIGEDIT-OBJ-TIMER@n              
 7) Get       @RHELP TRIGEDIT-OBJ-GET@n              
 8) Drop      @RHELP TRIGEDIT-OBJ-DROP@n            
 9) Give      @RHELP TRIGEDIT-OBJ-GIVE@n              
10) Wear      @RHELP TRIGEDIT-OBJ-WEAR@n              
12) Remove    @RHELP TRIGEDIT-OBJ-REMOVE@n              
14) Load      @RHELP TRIGEDIT-OBJ-LOAD@n              
17) Leave     @RHELP TRIGEDIT-OBJ-LEAVE@n              
#0
MOB-TRIGGERS MOBILE-TRIGGERS TRIGEDIT-MOB-TYPES

 1) Global      @RHELP TRIGEDIT-MOB-GLOBAL@n              
 2) Random      @RHELP TRIGEDIT-MOB-RANDOM@n          
 3) Command     @RHELP TRIGEDIT-MOB-COMMAND@n           
 4) Speech      @RHELP TRIGEDIT-MOB-SPEECH@n          
 5) Act         @RHELP TRIGEDIT-MOB-ACT@n           
 6) Death       @RHELP TRIGEDIT-MOB-DEATH@n          
 7) Greet       @RHELP TRIGEDIT-MOB-GREET@n           
 8) Greet-All   @RHELP TRIGEDIT-MOB-GREET-ALL@n          
 9) Entry       @RHELP TRIGEDIT-MOB-ENTRY@n          
10) Receive     @RHELP TRIGEDIT-MOB-RECEIVE@n          
11) Fight       @RHELP TRIGEDIT-MOB-FIGHT@n          
12) HitPrcnt    @RHELP TRIGEDIT-MOB-HITPRCNT@n          
13) Bribe       @RHELP TRIGEDIT-MOB-BRIBE@n          
14) Load        @RHELP TRIGEDIT-MOB-LOAD@n          
15) Memory      @RHELP TRIGEDIT-MOB-MEMORY@n          
16) Cast        @RHELP TRIGEDIT-MOB-CAST@n          
17) Leave       @RHELP TRIGEDIT-MOB-LEAVE@n          
18) Door        @RHELP TRIGEDIT-MOB-DOOR@n          
#0
TRIGEDIT-OBJ-GET

Activated any time a character attempts to pick up this object.
 
Numeric Arg : percentage chance this trigger will activate.
Argument    : not used.

If used with a return 0 the character will fail to pick the object up.

Variables:
%actor% - the character trying to get the object

Example: @RTSTAT 83@n
#0
TRIGEDIT-OBJ-DROP DROP-TRIGGER TRIG-OBJ-DROP

Activated any time a character attempts to drop this object. This includes
putting the object into a container.

If used with a return 0 the character will fail to drop the object.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor% - the character attempting to drop the object
%self% - the item being dropped. 

Example: @RTSTAT 84@n
#0
TRIGEDIT-OBJ-GIVE
 
Activated when a player attempts to give this object to another character.
 
If used with a return 0 the character will fail to give the object.

Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor% - the character giving away the object
%victim - the potential recipient of the object

Example: @RTSTAT 85@n
#0
TRIGEDIT-OBJ-WEAR

Activated each time a character attempts to wear the
object.
 
Numeric Arg : not used.
Argument    : not used.

Variables:
%actor% - the character attempting to wear the object.

Example: @RTSTAT 86@n
#0
TRIGEDIT-OBJ-REMOVE

Activated each time a character tries to remove the object.

Numeric Arg : not used.
Argument    : not used.

With a return 0 the object is not removed.

Variables:
%actor%  - the character attempting to remove the object

Example: @RTSTAT 87@n
#0
TRIGEDIT-OBJ-LOAD 
 
Activated when the object is created. Can be used with the global trigger.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Example: @RTSTAT 88@n
#0
TRIGEDIT-OBJ-CAST

Activated when the obj is targetted by a spell.
 
Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will cause the spell not to be cast.

Variables: 
%actor%     - the caster of the spell 
%spell%     - the number of the spell 
%spellname% - the name of the spell

Example: @RTSTAT 90@n 
#0
TRIGEDIT-OBJ-LEAVE 
 
Activated when someone leaves the room the obj is in.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will prevent the player from leaving the room.

Variables: 
%actor%     - the character leavering the room. 
%direction% - the direction the character is leaving to.

Example: @RTSTAT 89, 27147@n
#0
TRIGEDIT-OBJ-CONSUME

Activated any time a character attempts to consume (eat, drink, or quaff) this 
object. If used with a return 0 the character will fail to consume the object.

Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor% - the character attempting to consume the object.
%self% - the object being consumed.
%command% - either eat, drink, or consume.

Example: @RTSTAT 1374@n
#0
TRIGEDIT-ROOM-GLOBAL

Not a trigger type by itself; used in conjunction with Random @RHELP 
TRIGEDIT-ROOM-RANDOM@n. While Random triggers only trigger if players 
are in the same room, Global Random triggers will trigger regardless. 
 
Numeric Arg : not used.
Argument    : not used.

Example: @RTSTAT 50@n
#0
TRIGEDIT-ROOM-RANDOM
 
No specific event needs to occur for this trigger to be activated. Every 13 
seconds this trigger has a chance to run.
 
Numeric Arg : 0-100: percentage chance this trigger will run when its time 
              comes due.
Argument    : not used.

Example: @RTSTAT 51@n 

See ALso: RANDOM-TIMING
#0
RANDOM-TIMING TIMING

Since random triggers fire every 13 seconds you can set how often the trigger
fires by modifying numeric arg to the following values:

1%   = 22 minutes
2%   = 11 minutes
5%   =  4 minutes
10%  =  2 minutes
20%  =  1 minute
50%  = 26 seconds
100% = 13 seconds

See Also: TRIGEDIT-OBJ-RANDOM, TRIGEDIT-MOB-RANDOM, TRIGEDIT-ROOM-RANDOM
#0
TRIGEDIT-ROOM-COMMAND

Activates when commands are performed in the room.
Does not work for level 32 and above.

Numeric Arg : not used.
Argument    : text which must be part of the command typed to filter out 
              uninteresting commands.

If 0 is returned by the trigger, character will receive the same message as 
if the trigger did not exist, and any other command triggers will be checked.

Variables:
%actor% - the character issuing the command
%cmd%   - the exact command (without arguments) issued
%arg%   - the arguments, if any, following the command

Example: @RTSTAT 52@n
#0
TRIGEDIT-ROOM-SPEECH

Activates when matching text is spoken by a character in the room
 
Numeric Arg : 0: argument is a substring that must be found in the speech to cause a
                 match. 
              1: argument is a list of words, any of which found in the speech will
                 activate the trigger.
Argument    : a phrase or wordlist to be matched.

Variables:
%actor%  - the character whose speech activated the trigger
%speech% - the entire phrase spoken

Example: @RTSTAT 53@n 
#0
TRIGEDIT-ROOM-ZONE-RESET TRIGEDIT-ROOM-ZRESET TRIGEDIT-ROOM-LOAD
 
Activated when the zone this room belongs to is reset.
Note: %load% obj # will not work if it is NO_RENT
 
Numeric Arg : percentage chance this trigger will activate.
Argument    : not used.

Example: @RTSTAT 54@n 
#0
TRIGEDIT-ROOM-ENTER TRIGEDIT-ROOM-ENTRY TRIGEDIT-ENTRY TRIG-ROOM-ENTRY

   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.
 
Numeric Arg : percentage chance this trigger will activate.
Argument    : not used.

If used with a return 0 the character will fail to enter the room.

Variables:
%actor%     - the character trying to get the object
%direction% - the direction the character came from

Example: @RTSTAT 55@n 
#0
TRIGEDIT-ROOM-DROP

Activated any time a character attempts to drop an item in this room.

If used with a return 0 the character will fail to drop anything.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor%  - the character attempting to drop the object
%object% - the object the character is attempting to drop

Example: @RTSTAT 56@n 
#0
TRIGEDIT-ROOM-CAST

Activated if a spell is cast in the room.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will cause the spell not to be cast.

Variables: 
%actor%     - the caster of the spell 
%spell%     - the number of the spell 
%spellname% - the name of the spell
%vict%      - the target (mob/player) of the spell, if any.
%obj%       - the target (object) of the spell, if any.

Example: @RTSTAT 57@n 
#0
TRIGEDIT-ROOM-LEAVE 

Activated when someone leaves the room.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will prevent the player from leaving the room.

Variables: 
%actor%     - the character leavering the room. 
%direction% - the direction the character is leaving to.

Example: @RTSTAT 58@n 
#0
TRIGEDIT-ROOM-DOOR TRIGEDIT-DOOR
 
Activated when a player uses the door specific commands: 
'close, open, pick, lock, unlock' on a door. 

Used with return 0 will prevent the command from executing.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Variables:
%actor%     - the character using the command. 
%direction% - the direction the command is used on. 
%cmd%       - the specific command activating the trigger  

Example: @RTSTAT 59@n 
#0
TRIGEDIT-MOB-RANDOM TRIGEDIT-RANDOM TRIG-MOB-RANDOM TRIG-RANDOM
 
No specific event needs to occur for this trigger to be activated. Every 13 
seconds this trigger has a chance to run.
 
Numeric Arg : 0-100: percentage chance this trigger will run when its time 
              comes due.
Argument    : not used.

Example: @RTSTAT 61@n

See Also: RANDOM-TIMING
#0
TRIGEDIT-MOB-COMMAND

Activates when commands are performed in the same room as the mobile.
Does not work for level 32 and above.

Numeric Arg : not used.
Argument    : text which must be part of the command typed to filter out 
              uninteresting commands.

If 0 is returned by the trigger, character will receive the same message as 
if the trigger did not exist, and any other command triggers will be checked.

Variables:
%actor% - the character issuing the command
%cmd%   - the exact command (without arguments) issued
%arg%   - the arguments, if any, following the command

Example: @RTSTAT 153, 1371, 62@n
#0
TRIGEDIT-MOB-SPEECH

Activates when matching text is spoken by a character in the same room as the 
mobile.
 
Numeric Arg : 0: argument is a substring that must be found in the speech to cause a
                 match. 
              1: argument is a list of words, any of which found in the speech will
                 activate the trigger.
Argument    : a phrase or wordlist to be matched.

Variables:
%actor%  - the character whose speech activated the trigger
%speech% - the entire phrase spoken

Example: @RTSTAT 2776, 63@n
#0
TRIGEDIT-MOB-ACTION ACTIONS

Activated when a matching action is performed by a character in the room. 
Actions are any text output via the act() function, and include most output 
from the mud. (Notable exclusions are character say's, and immortal echo's.) 
 
Numeric Arg : 0: argument is a substring that must be found in the text to cause a
                 match. 
              1: argument is a list of words, any of which found in the text will
                 activate the trigger.
Argument    : a phrase or wordlist to be matched.

Variables:
%actor%  - the character causing the trigger to activate
%victim% - the character, if any, on the receiving end of the action 
%object% - the object, if any, used in the action
%target% - the target of the action, if any
%arg%    - the entire phrase

Example: @RTSTAT 64, 1372@n
#0
TRIGEDIT-MOB-DEATH

Activated when this mobile dies.
 
Numeric Arg : percent chance this trigger will be activated upon the mobile's death.
Argument    : not used.

If used with a return 0 no death cry will be heard from the mobile.

Variables:
%actor% - the character killing this mob, if any

Example: @RTSTAT 65, 19537@n
#0
TRIGEDIT-MOB-GREET GREET

Activated when a player attempts to enter the room and the character is visible 
to the mobile with this trigger. Does not work for poofins.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor%     - the character entering the room
%direction% - the direction the character came from

Example: @RTSTAT 66@n
#0
TRIGEDIT-MOB-GREET-ALL GREET-ALL TRIGEDIT-MOB-GREETALL 
 
Identical to greet except the mobile does not have to see the entering character 
for this trigger to activate. Does not work for poofins.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor%     - the character entering the room
%direction% - the direction the character came from

Example: @RTSTAT 67@n
#0
TRIGEDIT-MOB-ENTRY ENTRY TRIGEDIT-ENTRY TRIGGER-ENTRY 

Activated each time the mobile it is attached to enters a room.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Example: @RTSTAT 68@n
#0
TRIGEDIT-MOB-RECEIVE TRIG-MOB-RECEIVE

Activated any time an object is given to the mobile.

Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

With a return 0 the object is not transferred to the mobile.

Variables:
%actor%  - the character handing the object to the mobile
%object% - the object being handed over

Examples: @RTSTAT 69, 38, 152@n
           
#0
TRIGEDIT-MOB-FIGHT
 
Activated each round of fighting, after the mobile has had all of its attacks.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Variables:
%actor% - the character this mobile is fighting

Example: @RTSTAT 70@n
#0
TRIGEDIT-MOB-HITPERCENT TRIGEDIT-MOB-HITPRCNT 
 
Activated during combat when the mobiles hit point percentage drops below a 
specified percentage.
 
Numeric Arg : percentage of hitpoints at the threshhold of allowing this trigger to
              activate.
Argument    : not used.

Variables:
%actor% - the character this mobile is fighting

Example: @RTSTAT 71@n
#0
TRIGEDIT-MOB-BRIBE

Activated when a character gives a specified amount of gold to the mobile.
 
Numeric Arg : minimum number of gold pieces required to activate this trigger.
Argument    : not used.

Variables:
%actor% - the character providing gold to the mobile
%amount% - number of coins given

Example: @RTSTAT 72@n
#0
TRIGEDIT-MOB-LOAD TRIGEDIT-LOAD TRIG-LOAD 
 
Activated when this mobile is created.
 
Numeric Arg : percent chance this trigger will be activated.
Argument    : not used.

Example: @RTSTAT 73@n
#0
TRIGEDIT-MOB-MEMORY
 
Activated when the mobile encounters a character in its memory (mremember) 
list and there is no over-riding command. Any mobile making use of mremember 
MUST have a memory script, even if it will never be called.
 
Numeric Arg : percent chance this trigger will be activated..
Argument    : not used.

Variables:
%actor% - the character being remembered

Example: @RTSTAT 74@n, @RTSTAT 75@n
#0
TRIGEDIT-MOB-CAST

Activated when the mob is targetted by a spell.
 
Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will cause the spell not to be cast.

Variables: 
%actor%     - the caster of the spell 
%spell%     - the number of the spell 
%spellname% - the name of the spell

Example: @RTSTAT 76@n
#0
TRIGEDIT-MOB-LEAVE 

Activated when someone leaves the room the mob is in if the mob can see the person.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Used with return 0 will prevent the player from leaving the room.

Variables: 
%actor%     - the character leavering the room. 
%direction% - the direction the character is leaving to.

Example: @RTSTAT 77@n
#0
TRIGEDIT-MOB-DOOR 
 
Activated when the mobile is in the same room as someone using the door specific 
commands 'close, open, pick, lock, unlock' on a door. 

Used with return 0 will prevent the command from executing.

Numeric Arg : percent chance this trigger will be activated. 
Argument    : not used.

Variables:
%actor%     - the character using the command. 
%direction% - the direction the command is used on. 
%cmd%       - the specific command activating the trigger  

Example: @RTSTAT 78@n
#0
TRIGEDIT-OBJ-GLOBAL

Not a trigger type by itself; used in conjunction with Random @RHELP 
TRIGEDIT-OBJ-RANDOM@n. While Random triggers only trigger if players 
are in the same room, Global Random triggers will trigger regardless. 
 
Numeric Arg : not used.
Argument    : not used.

Example: @RTSTAT 79@n
#0
TRIGEDIT-OBJ-RANDOM
 
No specific event needs to occur for this trigger to be activated. Every 13 
seconds this trigger has a chance to run.
 
Numeric Arg : 0-100: percentage chance this trigger will run when its time 
              comes due.
Argument    : not used.

Example: @RTSTAT 80@n

See Also: RANDOM-TIMING
#0
TRIGEDIT-OBJ-COMMAND TRIGEDIT-OBJECT-COMMAND TRIG-OBJ-COMMAND

Activates when commands are performed in the same room as the object.
This does not work for level 32 and above.

Numeric Arg : a bitfield to indicate where the object must be in order to cause 
              the trigger to activate. 
              Bits: 1: In character's worn equipment.
                    2: In character's carried inventory.
                    4: In same room with the character.
                       These bits can be set at once by adding the values.
                       7= worn, inv, room. 3 = worn, inv. 5 = worn, room.
Argument    : text which must be part of the command typed to filter out 
              uninteresting commands.

If 0 is returned by the trigger, character will receive the same message as 
if the trigger did not exist, and any other command triggers will be checked.

Variables:
%actor% - the character issuing the command
%cmd%   - the exact command (without arguments) issued
%arg%   - the arguments, if any, following the command

Example: @RTSTAT 81@n
#0
TRIGEDIT-OBJ-TIMER
 
Activated when the timer for this object has expired. The otimer command may 
be used in a script to set the object's timer. Timer value of 1 equals about
1 minute. 
 
Numeric Arg : not used.
Argument    : not used.

Example: @RTSTAT 82@n
#0
TRIGEDIT-ADVANCED

@RWARNING: long and verbose (wordy)@n

To add life to the worlds circlemud uses something called scripts (or triggers). 
There are three major types of game objects which can use scripts. These are 
mobiles (mobs), objects, and rooms (world objects). Examples of scripts in the 
game are: 

Cityguards screaming 'PROTECT THE INNOCENT! BANZAI! CHARGE!', (a mob script).
A portal that teleports players when they enter it (an object script).
A room that creates a new exit when a player pulls a lever (a room script).

Each game item (room, mobile, or object) can have a script. A script is composed
of one or more triggers, which work in collaboration to define complex actions 
of the game object. A trigger is a definition of an event that the script watches 
for, and list of commands to execute when that event occurs. 

There are several different types of triggers. Each trigger type determines
when the trigger will be checked. For example, a mob speech trigger is checked
every time a character who is in the same room as the mob with the trigger uses
the 'say' command. A room enter trigger is checked every time a character
enters the room. There are two parts of the trigger used to determine if the
trigger's commands are executed when it is checked, the argument and numerical
argument (NArg). Some triggers use both; some may use only one of the two; and
some may use neither. The interpretation of these two fields is dependant on
the type, and is described in more detail on the webpage and in the help files.

When an event in the game occurs, each script in the room where the event 
occurred is checked to see if there are any triggers which are supposed to
react to that event. A trigger currently running (such as from a 'wait'
command) is skipped. Only one trigger of each script will be run by a single
event. For example, if there are two triggers on a script, and both are the
same type with the same arguments, the second trigger will only be run if the
first one is already running. 

Triggers can be of more than one type. For example, to simulate a cursed item,
a trigger on the object could be of types drop, give, and remove. A more common
combined trigger would have both random and global types, so the random trigger
would be checked even when the zone was empty. Combined triggers must have the
same argument and numerical argument. 

The other component of a trigger is the command list. This is a series of
commands that are executed when the trigger is run. Commands are chosen from
two groups of commands, script specific commands and game commands. Script
specific commands are those commands that only the script interpreter can
recognize. These include flow control commands (such as if, elseif, else, end,
halt, wait, and return), and commands to manipulate variables (such as set,
eval, unset, and global). Game commands are those commands that a player could
issue from their command line as well as special commands added for mobiles,
objects, and rooms.
#0
TRIGEDIT-ADVANCED-TUTORIAL

This section is a step by step tutorial to explain the writing of scripts 
(triggers). It goes through the script creation process developing a practical
script. 

Decide what you want the script to do. 
   Consider how your mob, item, or room should behave. Doing this before
worrying what can be done prevents you from limiting yourself to what you have
seen other scripts do, and allows you to produce a more interesting script. 
  
For example, I want to create a gate guard for a small walled town. The ruler
of the town has decided that each group of people will be charged ten coins to
enter his domain. The gate guard must notify travelers of the cost to enter,
collect the money, allow people who have payed to enter the city, and close the
gate after them. This will be a mob script. 
  
Decide what trigger types you need.
   Look through the section on triggers to see the currently available trigger
types. New trigger types can be added by one of the implementors if needed. All
types are listed in the help files @RHELP TRIGEDIT-TYPE@n.
  
Our gate guard needs to react to five different events: 

1. A character entering the room from the south, the road leading away from the
   town, needs to be informed of the price for entrance. This will be a greet
   trigger. 
2. When the guard is given ten or more coins, the guard must open the gate. This
   is done by a bribe trigger. 
3. If the guard is given less than ten coins, the guard needs to inform the
   character that it is insufficient. This is also a bribe trigger. 
4. When someone passes through the gate into the city, the guard must close the
   gate behind them. This is done with an act trigger. 
5. When the gate is opened from the other side, the guard must eventually close
   it. This will be another act trigger. 

Determine the argument and the numerical argument of the triggers. Read the 
specifications on trigger types, and decide what the values for argument and 
Numeric Arg must be for the trigger to react appropriately to the events.
  
@RHELP TRIGEDIT-MOB-GREET@n
Argument    : not used 
Numeric Arg : the percent chance that the trigger is run when checked. Since I 
              want it run every time someone enters the room, it should be 100. 

@RHELP TRIGEDIT-MOB-BRIBE@n
Argument    : not used
Numeric Arg . minimum number of gold pieces required to activate this trigger.
              The guard should only open the gate when given 10 coins, so it
              should be 10. 

For the second bribe trigger, the guard must respond whenever someone gives 
him 1 or more coins, so Numeric Arg should be 1. 

@RHELP TRIGEDIT-MOB-ACT@n
Argument    : the text the mob should react to. Since I want the guard to 
              react to a character going north, argument should be "leaves 
              north." 
Numeric Arg : Since argument is a phrase, NArg should be 0. 

The second act trigger should trigger on text "The gate is opened from the other
side", so it is triggered whenever someone opens the gate from inside the town.
Again, Numeric Arg should be 0 for a phrase. 
  
Write the list of commands for the trigger.
This is the most complex and time consuming part of a trigger to write. The
valid commands are explained in the help files and on the webpage. Variables 
and expressions are also used in the commands list.

For the greet trigger, I want the guard to inform anyone entering from the
south how to get into the city. First, I must check if the character is
entering from the south. If they are entering from that direction, the guard
should tell the character the cost of entry. The command list for this trigger
will be as follows: 
  
if (%direction% == south) 
 wait 1 sec
 emote snaps to attention as you approach. 
 wait 1 sec
 say Admittance to the city is 10 coins. 
end 
 
Checking the specifications of the greet trigger, we see that the variable
"direction" is set to the direction that the character entered. The percent
sign surrounding direction means it is a variable. The two equal signs together
compare the value of the variable to the word "south". If these are equal, the
statements between this line and the line "end" will be executed. The "wait 1 sec"
pauses briefly while the character finishes his move. (The greet trigger is
actually checked before the character enters the room, so if we did not have
this line, he or she would never see the guard snap to attention.) After
another brief pause, the guard announces the cost to enter the town. The
indentations are not needed, but make it easier to read. 

The guard must open the gate if ten or more coins were given to him. The
command list looks like this: 
  
wait 1 sec
unlock gate 
open gate 
wait 10 sec 
close gate 
lock gate 
  
After a brief wait (so everything doesn't happen at once), the guard unlocks
the gate and opens it. The guard will close the gate after 10 seconds, even if
no one passes through it. 

The guard must inform the character that his payment was not enough, and
return the money. The commands list will be: 
  
wait 1 sec
say This is not enough! 
give %amount% coins %actor.name% 
  
For the line "give %amount% coins %actor.name%", the variables amount and actor,
both set when the bribe trigger is called, are substituted into the line before
the guard performs the command. The gate guard returns the number of coins he
was given. 

For the first act trigger, I want the guard to close and lock the gate after
someone passes through the gate. The guard should wait briefly so he isn't
shutting the gate on the character's back, and close and lock the gate. The
command list will be: 

wait 1 sec
close gate 
lock gate 
  
For the last act trigger we want the guard to close and lock the gate when it 
is opened from the other side. The commands will look like: 
  
wait 5 sec 
close gate 
lock gate 
  
The "wait 5 sec" gives time for someone on the other side to get through the gate. 
Decide the order of the triggers. The triggers are checked from first to last.
If there are two triggers of the same type, the first one run will be the only
one run. 

There are two sets of triggers which are the same type, the bribe triggers and
the act triggers. If the bribe trigger with the Numeric Arg of 1 is first, the 
other trigger would never be run, since ten or more coins is still one or more. 
In order for my triggers to work right, the trigger with Numeric Arg of 10 must 
be before the trigger with the NArg of 1 in the list. The other possible 
conflict is with the act triggers. Since both have arguments that will not 
occur together, the order does not matter. 

Create the trigger file.
Simply use trigedit to create your triggers and they will be saved for you
when you exit the editor. 

Put the triggers into the game.
In the OasisOLC medit / redit / oedit menus, use menu option S to enter the
script editor. Then select the triggers that will be part of your script. Note,
that order is important! If there are two possible triggers that could both be
executed at the same time, only the first one found in the list will be
activated. In this example, it means place the bribe trigger for 10 or more
coins BEFORE the bribe trigger for 1 coin. 

Test the script.
You should see how the script actually works in the game, and watch other
people interact with it. Often you will see ways you can improve it. 

@RGOTO 1310@n and work your way north to test these out. Triggers 4-8.
#0
TRIGEDIT-MOB-GLOBAL

Not a trigger type by itself; used in conjunction with Random @RHELP 
TRIGEDIT-MOB-RANDOM@n. While Random triggers only trigger if players 
are in the same room, Global Random triggers will trigger regardless. 
 
Numeric Arg : not used.
Argument    : not used.

Example: @RTSTAT 60@n
#0
TRIGEDIT-MENU TRIG-MENU TRIG-EDIT TRIGEDIT-EDITOR SCRIPT-EDITOR SCRIPT-MENU 

Trigger Editor [1300]                       @RHELP TRIGEDIT-EDITOR@n

1) Name         : @ynew trigger@n               @RHELP TRIGEDIT-NAME@n
2) Intended for : @yMobiles@n                   @RHELP TRIGEDIT-INTENDED@n
3) Trigger types: @yGreet@n                     @RHELP TRIGEDIT-TYPES@n
4) Numeric Arg  : @y100@n                       @RHELP TRIGEDIT-NUMERIC@n
5) Arguments    :                           @RHELP TRIGEDIT-ARG@n
6) Commands:                                @RHELP TRIGEDIT-COMMANDLIST@n
@csay My trigger commandlist is not complete!@n

Q) Quit
Enter Choice :

See Also: TRIGEDIT-TYPES, TRIGEDIT-COMMANDS, VARIABLES, TRIGEDIT-MOB-TUTORIAL,
          TRIGEDIT-ADVANCED-TUTORIAL, TRIGEDIT-ADVANCED
#0
TRIGGER-EDITORS

A trigger consists of 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. 
#0
TRIGEDIT-NAMES TRIG-NAMES

1) Name         : @ynew trigger@n

Always use names that explain the trigger. More importantly: always include the
VNUM for the mob/obj/room the trigger is going to be attached to.

   It's important to give your trigger a name you and others can understand. 
Even more important is including the VNUM of what it is attached to. This way
tlist and stat will show the name description and VNUM allowing others to 
quickly comprehend what the trigger does. A good name could be 'guard shout for
help - 101' or 'mage cast poison - 300' even 'cursed object - 130.'

Examples:
   Quest Offer - 1310       --> trigger attached to mob 1310
   Fall Down Stairs - 1300  --> trigger attached to room 1300
   No Dropping Stuff - 1301 --> trigger attached to obj 1301
#0
TRIGEDIT-INTENDED

2) Intended for : @yMobiles@n
This is either Mobiles (the default), Objects or Rooms. While in most cases it 
is possible to make a script work for either one, it is highly recommended to 
only use the correct type.

0: Mobiles, 1: Objects, 2: Rooms: 0

#0
TRIGEDIT-TRIGGER-TYPES

3) Trigger types: @yGreet@n
This is a bitvector  of which kind of events this trigger is triggered by. This 
is the most important part of the trigger. It's here you decide if you want the 
trigger to react on people dying in the room, dropping objects, saying stuff, 
entering, jumping insanely up and down or whatever else you might think of.

This part is also the most important, in the sense that the rest of the triggers' 
info means different things, depending on what trigger type the trigger has. 

For a full listing of types see: @RHELP TRIGEDIT-TYPES@n
#0
TRIGEDIT-ARGUMENTS ARGUMENTS 

Argument: This describes the text argument, if any, which can be used to
filter out matches to the trigger.

See also: TRIGEDIT-MENU
#0
NUMERIC-ARGUMENTS NUMARG NARG TRIGEDIT-NUMERIC-ARGUMENTS TRIGEDIT-ARGUMENTS 

4) Numeric Arg : @y100@n
5) Arguments   : 

Dependant on the trigger type, these values will mean different things. For 
instance, if you've decided to use a hitpcnt trigger, the numeric Arg is the 
percent a mobs hit points have to fall to, before the trigger is activated, 
and the command list is executed.

#0
TRIGEDIT-COMMANDLISTS

6) Commands:
@csay My trigger commandlist is not complete!@n
This is the command list, which contains the actions which take place, when the 
trigger is executed. The command list makes use of the @RHELP TEXT-EDITOR@n.
This is often called the 'script', and is actually a small program, executed 
step by step. In it, you can use different types of commands: script - specific 
commands, flow control commands - if this is a mobile script, you can use 
standard mud commands like say or give.
#0
DG-SCRIPTS DG_SCRIPTS DGSCRIPTS 

Stands for Death Gate scripts and are named after the original MUD they came from.
See: @RTRIGEDIT@n
#0
TRIGEDIT-MOB-TUTORIAL TRIGEDIT-TUTORIAL

Mob trigger tutorial
This mini-quest is setup in TBA as an example. @RGOTO 1310@n and work your way north
with nohassle off.
 
The following 7 steps should give you a general idea about what to do, and how to go 
about making small quests in the dg scripting language. This example is concentrated 
on quests involving mobs. 

The process can be broken down to the following:  
   1. Decide what you want the script to do.
   2. Make corresponding objects and mobs.
   3. Split up the quest.
   4. Find corresponding trigger types.
   5. write the scripts for the triggers.
   6. Attach the scripts - permanently
   7. Done ? 
   
1. Decide what you want the script to do.  
   In this example, we want to make a small mini quest in an area. The quest 
will work like this: When you enter the room, where the first mob is, it will 
start to tell a tale. In this tale, you are instructed to perform a task, in 
this case, kill an evil ogre, that lives in a nearby forest. As proof of the 
kill, you must bring back the ogre's apprehension to the questgiving mob. 

2. Make corresponding objects and mobs.  
   Ingredients for this quest:
      1 Questgiver mob - I've chosen 'the questmaster' - vnum 1310
      1 Target mob - In this case 'an apprehensive Ogre' - vnum 1311
      1 Quest object - 'some apprehension' - trash object, vnum 1300 

3. Split up the quest.  
   Next thing to do is look at the different steps involved with the quest. In 
this example, we have three steps: 
   Player entering room -> tell story 
   Player finds ogre -> load object (Do not just want the mob to carry it) 
   Player gives questmaster apprehension -> reward player 

4. Find corresponding trigger types.  
   Having split the quest up also means we reasonably easy can decide what 
kinds of triggers we need - in this case: 
   mob GREET trigger (attached to questmaster) 
   mob DEATH trigger (attached to ogre) 
   mob RECEIVE trigger (attached to questmaster) 
 
5. write the scripts for the triggers.  
    Up to this point, neither trigedit or the script editors have been used. 
All the info needed is in the help files and on the webpages. Notice most of
the work required is PLANNING! You must know exactly what you want to do before
you do it. Now is the time to fire up trigedit and start editing the triggers. 
Let's give the first one vnum 0, and edit it to look like the script below: 


> trigedit 0
Trigger Editor [0]

1) Name         : @yMob Tutorial Example 1310 - Quest Offer@n
2) Intended for : @yMobiles@n
3) Trigger types: @yGreet @n
4) Numeric Arg : @y100@n
5) Arguments    : 
6) Commands:
@c* we don't want him to tell this to mobs. vnum -1 is reserved for players.
if %actor.vnum% == -1
  * only greet players coming from the south.
  if %direction% == south
    *wait 1 second, always give the player time before you start sending text.
    wait 1 sec
    say Can you help me, %actor.name%?
    wait 1 sec
    say An apprehensive ogre has something of mine.
    wait 1 sec
    say If you slay him I'll give you all the coins I can spare.
    wait 1 sec
    say Please, bring me the apprehension he has stolen.
  end
end@n

The script above will be executed every time anyone enters the room. If the 
person entering is a mobile, the if check at the beginning will stop the 
execution. Note, that I've named the trigger as I did above. ALWAYS include
the VNUM of where you plan on attaching the trigger. Also, give it a name so 
it is easy to see what part of the quest this trigger handles. The second 
script is very simple.

> trigedit 1
Trigger Editor [1]

1) Name         : @yMob Tutorial Example 1311 - Kill ogre@n
2) Intended for : @yMobiles@n
3) Trigger types: @yDeath@n
4) Numeric Arg : @y100@n
5) Arguments    : 
6) Commands:
@csay you got the best of me %actor.name%.
* load some apprehension
%load% obj 1300
* reload the mob for the next questor
%load% mob 1311@n

The above script will be executed when the mob is killed - just before the 
death cry. The last script just needs to check if the object handed over is 
the correct one. Let's see it, here with vnum 2: 

> trigedit 2
Trigger Editor [2]

1) Name         : @yMob Tutorial Example 1310 - Give/Quest Completion@n
2) Intended for : @yMobiles@n
3) Trigger types: @yReceive@n
4) Numeric Arg : @y100@n
5) Arguments    : 
6) Commands:
@c* check if this was indeed the right object
if %object.vnum% == 1300
  wait 1 sec
  say Thank you, %actor.name%
  %send% %actor% %self.name% gives you a gold piece.
  %echoaround% %actor% %actor.name% is rewarded for his valor.
  nop %actor.gold(1)%
  wait 5 sec
  %purge% obj 1300
else
  * this wasn't the right object - don't accept it
  say I don't want that - bring me back my apprehension.
  return 0
end@n

The script above is pretty self explanatory, but to clarify a bit: First check 
if the object is the correct vnum, then give the reward, and send messages to 
the player and others in the room. If it wasn't the object, reject it, and use 
the return value of the script to prevent the object being passed over. Lastly, 
and very importantly, 'end' ends the if. 

6. Attach the scripts - permanently  
   Proceed and add the scripts to the two mobiles through medit: 

> medit 1310
[medit menu]
Enter choice ? S
     Script Editor

     Trigger List:
     <none>

 N)  New trigger for this script
 D)  Delete a trigger in this script
 X)  Exit Script Editor

     Enter choice :
Here, add the scripts by typing N, then the script vnum: 
Enter choice : n
Please enter position, vnum   (ex: 1, 200): 0
Enter choice ? n
Please enter position, vnum   (ex: 1, 200): 2
Enter choice ? x

And add the trigger vnum 3 to the ogre in a similar manner. 

7. Done ?  
   The scripts are now attached to the correct mobs, and the players of your 
mud can now take the quest whenever they wish. This is a great time for 
considering improvements to the little quest: 

Balance issues: 
   Should players get a smaller reward if they perform the quest many times ? 
   Should it be limited to 1 quest per player or 1 per reboot ? 
Gameplay issues: 
   Perhaps other mobs in town should tell the player to go see the old man ? 
   Should the ogre always load the object, or only when people know he has it ? 
   Are there other mobs who would like to pay for that object ? 

The above list is just a few examples. All of them could be implemented, but 
it is beyond the scope of this tutorial. 


12DEC01 - mob tutorial by Welcor
04OCT02 - updated/modified by Rumble
#0
TSTAT TRIGEDIT-EXAMPLES EXAMPLES TRIG-EXAMPLES

Usage: tstat <trigger vnum>

Tstat lets you learn more about a specific trigger. 
Be warned that all the triggers on TBA may not work since anyone could
have made them. Ask around for the best examples. Zone 0 are the basic
examples. For more examples check out zones 13, 19, 27, 29, 77, 236 and 
237. There are numerous others. Look around, just beware some may not be
"good" examples. 

To learn more about any of these just tlist <zone #> then tstat each
trigger individually. You can always ask Rumble to find you an example.

See also: TLIST, TRIGEDIT, OLC
#0
ATTACH

Builder's working on their trial vnum do not need to learn this command, yet.

Usage: attach mob {trigger vnum/name} {mob name} [location]
       attach obj {trigger vnum/name} {obj name} [location]
       attach room {trigger vnum/name} {room vnum} [location]

   Attach lets you attach a script to one instance of a mob/obj/room, for
testing or other purposes. The command only attaches the script once,
and will not last over a reboot (or crash).

The 'location' is what number in the triggerlist the trigger will assume.
It is important to first attach a trigger to test before you manually add it
through oedit/medit/redit. 

Examples:
attach room 14500 14520 - Attaches room trigger 14500 to room 14520.
attach mob 1332 santa   - Attaches mob trigger 1332 to mob 1308 (santa).
attach obj 1480 sword   - Attaches obj trigger 1480 to a sword. 

See also: DETACH, TRIG-ATTACH, TRIG-DETACH, OLC, TRIGEDIT, TSTAT, STAT, ROOMFLAGS
#0
DETACH

Builder's working on their trial vnum do not need to learn this command, yet.   

Usage: detach [mob | obj] {target name} {trigger name/vnum | 'all'}
       detach room {target vnum | '.'} {trigger name/vnum | 'all'}

   Detach removes a script to one instance of a mob/obj/room, for testing or 
other purposes. The command only removes the trigger temporarily, until the
room/obj/mob is reloaded via reboot, zreset, load.

Use the optional arguments 'mob' and 'obj' to differentiate if more entities
with the same alias are in the room.

Examples:
detach room 14500 14520 - remove trigger 14500 from room 14520.
detach room all         - removes all triggers from a room.
detach santa 1332       - detach trigger 1332 from mob 1308 (santa).
detach mob santa all    - detach all triggers from Santa.
detach santa all        - Same as above.
detach sword 1300       - detach trigger 1300 from sword.
detach obj sword 1300   - You guessed it - same as above.
detach sword all        - detach all triggers from the sword.

See also: ATTACH, TRIG-DETACH, TRIG-ATTACH, OLC, TRIGEDIT, TSTAT, STAT, ROOMFLAGS
#0
TRIG-ATTACH

Usage: attach vnum id
* This small trigger will attach a trigger to the carrier this can for instance 
* be used if you want the mob to change attitude by adding another trigger 
* (ie - mob was mad - mob got apple - mob gets a 'nicer' trigger attached
attach 3001 %self.id% 

   This command allows a script to attach a trigger (referenced by vnum) to 
anything capable of receiving triggers, by id number. (%self.id%, %object.id%, 
and %actor.id% are examples of id numbers, for use with this command.)

See Also: ATTACH, DETACH, TRIG-DETACH
#0
TRIG-DETACH

Usage: detach <vnum | all> id
* if we - as described in the attach example, want our mob/obj/room to behave
* differently, it's not always enough to just add another trigger with attach.
* it might be necessary to remove some old ones :
detach 3000 %self.id%
or
detach all %self.id%

   The opposite of attach, this removes triggers from the specified target.

Example: @RTSTAT 45@n

See Also: ATTACH, DETACH, TRIG-ATTACH
#0
TLIST TRIGLIST TRIG-LIST TRIGEDIT-LIST 

Usage: tlist <range of vnums or zone number>

Tlist gives you a list of the triggers numbered within the parameters.
Be warned that all the triggers on TBA may not work since anyone could
have made them. Ask around for the best examples. Zone 13, 40, 41 is a 
good start.

   tlist 13          - lists all triggers defined in zone 13
   tlist 4000 4099   - lists all existing triggers from vnum 4000 to 4099
   
See also: TSTAT, TRIGEDIT, OLC
#0
TRIGEDIT-ARRAYS ARRAYS TRIG-ARRAYS

   Trigedit can even use arrays to store information.

@RTSTAT 150, 41005, 1325@n
#0
ASSEMBLIES ASSEMBLE MAKE BAKE BREW CRAFT FLETCH KNIT MIX THATCH WEAVE ASSEDIT FORGE
 
   These are no longer implemented here since the same thing can be done with
DG Scripts.

@RTSTAT 38@n
@RTSTAT 48@n 
#0
DG_AFFECTS

Usage:  dg_affect <target> <property> <value> <duration>

Modifies an affection or apply on the target. Durations must be non-zero.
dg_affect %actor% sanct on 20    -- Sets sanctuary on actor for 20 hours.
dg_affect %actor% maxhit 100 20  -- Sets maxhit on actor +100 for 20 hours.

Example: @RTSTAT 1382@n
See also: APPLIES, AFFECTIONS
#0
EQUIPMENT POSITIONS WORN FINGERS NECKS BODY HEADS LEGS FEET HANDS ARMS SHIELDS ABOUT WAIST WRISTS WIELDED HELD

Usage: equipment

Gives you a list of all the equipment you're wearing, holding, and wielding.

You are using:                                               Trigedit positions
<used as light>      [200] a generic light                      light     0 
<worn on finger>     [201] a generic ring                       rfinger   1
<worn on finger>     [202] a generic ring                       lfinger   2
<worn around neck>   [203] a generic necklace                   neck1     3
<worn around neck>   [204] a generic necklace                   neck2     4
<worn on body>       [205] a set of generic body armor          body      5
<worn on head>       [206] a generic helm                       head      6
<worn on legs>       [207] a pair of generic leggings           legs      7 
<worn on feet>       [208] a pair of generic boots              feet      8
<worn on hands>      [209] a pair of generic gloves             hands     9
<worn on arms>       [210] a pair of generic sleeves            arms     10
<worn as shield>     [211] a generic shield                     shield   11
<worn about body>    [212] a generic cape                       about    12
<worn about waist>   [213] a generic belt                       waist    13
<worn around wrist>  [214] a generic wristguard                 rwrist   14   
<worn around wrist>  [215] a generic wristguard                 lwrist   15
<wielded>            [216] a generic weapon                     wield    16
<held>               [217] a generic staff                      hold     17
<inventory>                                                     inv      18

   AC is modified on some positions as follows: Body X3, Head and Legs X2.

See also: INVENTORY, REMOVE, WEAR
#0
MEDIT-AFF-FLAGS AFFECTIONS AFFECTS
 
M) AFF Flags : @cNOBITS@n
1)  BLIND          Mob is blind.
2)  INVIS          Mob is invisible.
3)  DET-ALIGN      Mob is sensitive to the alignment of others.
4)  DET-INVIS      Mob can see invisible characters and objects.
5)  DET-MAGIC      Mob is sensitive to magical presence.
6)  SENSE-LIFE     Mob can sense hidden life.
7)  WATWALK        Mob can traverse unswimmable water sectors.
8)  SANCT          Mob is protected by sanctuary (takes half damage).
9)  GROUP          Reserved for internal use.  Do not set.
10) CURSE          Mob is cursed.
11) INFRA          Mob can see in dark.
12) POISON         Mob is poisoned.
13) PROT-EVIL      Mob is protected from evil characters.
14) PROT-GOOD      Mob is protected from good characters.
15) SLEEP          Reserved for internal use.  Do not set.
16) NO_TRACK       Mob cannot be tracked.
17) UNUSED         Unused (room for future expansion).
18) UNUSED         Unused (room for future expansion).
19) SNEAK          Mob can move quietly without room being informed.
20) HIDE           Mob is hidden; can only be seen with sense life.
21) UNUSED         Unused (room for future expansion).
22) CHARM          Reserved for internal use.  Do not set.
 
See Also: MEDIT-NPC-FLAGS
#
TEXT-EDITOR TEXTEDITOR /d /i /h /s /a /c /ra /l /fi WORDWRAP WORD-WRAP FORMATTING /e#
   The text editor is what you use to write room/mob/obj/extra descriptions,
mudmails, and even boards. It allows you more commands than the typical entry.
To learn the commands while using the text editor, type /h. It will tell you
what all the / commands do. Always use /fi to format, indent, and word wrap.
It looks much better to see writing that is formatted than one that runs all
over the place wrapping around etc. Just simply type /fi on a new line and hit
enter. Before you save type /l to list the buffer and see for yourself how it
looks. Fix as needed.
   When entering the text editor for the first time make sure to use /c to clear
the current contents. Indent and format all descriptions by typing /fi (format
with indent) in the text editor.  This includes all forms of OLC, mudmails,
boards, and anywhere else you use the text editor. This will indent the line
by 3 spaces and wrap your text at less than 80 characters so telnet users can
read it.
 
Editor command formats: /<letter>
 
@n/a         -  aborts editor
@n/c         -  clears buffer
@n/d#        -  deletes a line #
@n/e# <text> -  changes the line at # with <text>
@n/f         -  formats text. 
@n/fi        -  indented formatting of text (highly recommended for all desc's)
@n/h         -  list text editor commands
@n/i# <text> -  inserts <text> before line #
@n/l         -  lists buffer
@n/n         -  lists buffer with line numbers
@n/r 'a' 'b' -  replace 1st occurance of text <a> in buffer with text
@n/ra 'a' 'b'-  replace all occurances of text <a> within buffer with text
        usage: /ra 'pattern' 'replacement'
@n/s         -  saves text

NOTE: /f and /fi in trigedit will autoindent your trigger.
Commands such as /r, /n, /e#, /i#, /d# are invaluable and will make your job
much easier. For example lets say you mistype "the" with "teh" in a 10 line
description. Instead of /c (clearing) the text you can /r 'teh' 'the' or if it
was on line 5 you can type /e5 <line with teh spelled correctly> or /d5. Learn
all these options.
#
FURNITURE COUCH CHAIR

   There is no object type for furniture since this is stock CircleMUD. But it
can be done through trigedit. Just set the object type to OTHER and attach a
trigger similar to the example below. Just change the word chair to the name
you desire.

Example: @RTSTAT 1399@n
#0
BLAST SHOOT GUN RANGED-WEAPONS BOWS QUIVERS MISSILES 

   Not currently implemented. The same effect may be created through trigedit.

@RTSTAT 1361, 9000, 11838@n
#0
TRIGEDIT TRIGS TRIGGEREDIT TRIGGER-EDIT TRIGGERS DG SCRIPTS MOBPROGS MPROGS PROGS SCRIPTING

Builder's working on their trial vnum do not need to learn this command, yet.

Usage: trigedit <trigger vnum>

This command will let you edit a trigger/script within your designated
zone. If you specify an unused vnum, a new script will be created with
that number.

    trigedit 3001   --  make a trigger in zone 30, with the vnum 3001

Go to http://welcor.n3.net to access the building documents.
Join the mailing list at: http://groups.yahoo.com/group/dg_scripts/

@RNOTE: You must disable NOHASSLE to test triggers.@n

@RGOTO 1310@n to enter the trigedit hallway.

See also: TRIGEDIT-MENU, TSTAT, TLIST, OLC

#0
VDELETE

Usage: vdelete <variablename> <id>

Use this to remove a Variable from either mob, room, obj, or player.

Examples: vdelete has_solved_quest 5351

To determine the player ID stat player
> stat file test
male PC 'Test'  IDNum: [ 3531], In room [    0]

See Also: REMOTE, RDELETE
#0
$~