/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
MTRIGADD

-= mobproc command =-
-= see also: mtrigdelete mtrigwax mtrigoff mtrigon =-

mtrigadd <trigger list>
{
  block of reactions
}

The command %6mtrigadd%0 is a block structured mobproc command,
meaning a block structure MUST ALWAYS follow an %6mtrigadd%0.

This command is used in SPC_MOBPROC mobs.  It's used to build up a 
trigger list and corresponding reactions on the mobproc mob.  The trigger
list %B%1cannot%0 have newlines in it, but each trigger can be seperated
by the character %B%6*%0.  You can have up to %B%610%0 triggers in said
trigger list.
Two special characters have unique meanings in triggers, the %B%6#%0 and the 
%B%6|%0 both deal with substring comparisons.  Placing the %B%6#%0 before
a trigger causes the mud to do a %Bsubstring compare%0 against that
trigger.  The %B%6|%0 acts as a %Bwildcard%0 character in the trigger and
must be used with the %B%6#%0.

%B%6Example 1:%0
mtrigadd giggle
{
say Hey, +C! What are you giggling at?
}

%B%6Example 2:%0
mtrigadd #giggle
{
say Hey, +C! What are you giggling at?
}

%B%6Example 3:%0
mtrigadd #|gig|
{
say Hey, +C! What are you giggling at?
}

In the first example, the reaction would be triggered by someone typing 
only the word giggle.  In the second example, however, using the
substring character before the trigger would allow the reaction to be
triggered if the word 'giggle' appeared anywhere in the command someone
typed.  In example 3, any stream of characters, followed by "gig",
followed by any stream of characters would trigger the reaction.

%B%6Example 4:%0
mtrigadd flies*fly*bug*bugs
{
say Yeah... I love them things!
tell +C Do you eat them, +C?
}

%B%6Example 5:%0
mtrigadd #flies*#fly*#bug
{
say Yeah... I love them things!
tell +C Do you eat them, +C?
}

Example 4 is really not practical.  It will only go off if someone types
flies, fly, bug, or bugs exactly.  If I typed, "I like bugs.", That trigger
would not go off, because its looking for exactly one of those 4 words and
nothing else.

Example 5, however, uses substring matching along with multiple triggers to 
produce the desired affect.  It will go off if anybody even includes the words
flies, fly, or bug.  They could type the command, "odihosidh%Bbugs%0odihodih",
and the trigger would go off.

Though there is a relatively long allowance for reaction block length, I would
ask that you all use the %B%6mgoto%0 command if the reaction is longer than
5 lines.  For example:

%B%6Example 6:%0
mtrigadd #|know|riddler|
{
say Ahhh, +C knows of the riddler... lemme tell you a story about him.
mgoto 20
}

In this latest example, we send the mobproc off to line 20 when the reaction
is triggered.

%B%6Notes about the trigger lists:%0
  
  The trigger list of a mob is exactly that... a list.  When you use this 
mtrigadd command, it inserts a trigger structure into the mob's trigger list.
When someone types something, and there is a mob in the room that has a 
trigger list, the mud scans thru that list and checks for triggers.  If it
finds one, it executes the reaction block.
  %B%5If you mtrigadd < AN EXISTING TRIGGER > { block }%0, the existing reaction 
for that trigger will be replaced.  This is a useful tool to have mobs update
triggers and reactions on the fly during load time.  Please do not continually
have a mob loop through mtrigadds repeatedly, however, as that just causes
mud performance degradation as the mud continually replaces mtriggers.  

  A mob will ignore mtriggers if you called %B%6mtrigoff%0.
  A mob will wait until a trigger is triggered if you called %B%6mtrigwait%0.

Other than Vall, Cyng is probably the most experienced with full length
mobprocs, so if you need advice, don't hesitate to ask.