A R C H I P E L A G O
USING
DYNAMIC
MOB
LANGUAGE
This is an introduction to the dynamic mob language. A simple, one
thread program containing the essentials of an interactive mob named
Elsa will be outlined here.
start: wait_for_enter
say ^hi^
wait_for_say 0 ^hello^
say ^I'm glad you came, the cows are getting restless.^
goto start
This script is simple, and straightforward. A player enters, Elsa says
hi, and waits for a hello before talking about cows.
start: is a label in the program
that a goto command can go to if needed, so this program loops
back to start.
start: wait_for_enter
say ^hi^
wait_for_say 6 ^hello^
say ^I'm glad you came, the cows are getting restless.^
echoch ^You hear cows mooing anxiously outside.^
goto start
wait_for_say 0 ^hello^ causes Elsa to
wait until infinity for the player to say hello. Perhaps a time limit is in
order, so if we change the 0 into a 6, Elsa will now only wait 6 rounds, or
12 seconds for the hello. Notice, we also added an
echoch command where some text about
restless cows is echoed to the player. echoch and echonotch
works only if the mob remembers the char, so make sure a
wait_for_enter, a randomchar, or a trap command is used
prior to the echoes.
start: wait_for_enter
say ^hi^
wait_for_say 6 ^hello^
iffalse ignore
say ^I'm glad you came, the cows are getting restless.^
echoch ^You hear cows mooing anxiously outside.^
goto start
ignore: emote ^touches your face, and smiles warmly.^
say ^There are cows out back who need milking.^
say ^and I, myself, have work to do, bye bye.^
goto start
Here, we added an ignore: loop to the
script where we want Elsa to ignore people who don't say hello after 6 rounds.
Notice we proceeded the wait_for_say 6 ^hello^
with an iffalse ignore command.
We could also have used an iftrue command after the
wait_for_say where the program jumps somewhere when hello is said.
Note, the iffalse, and iftrue commands only execute when
the command preceding wait_for_say had assigned a true/false flag.
In this case, we had to wait 6 rounds before a flag was assigned.
Some players may inevitably fight the mob while it is in mid-script.
To stop the mob from just babbling away while it is being attacked,
it is a good idea to add an isfighting check into the thread.
So we have this, now finished, one-thread program.
start: wait_for_enter
say ^hi^
wait_for_say 6 ^hello^
iffalse ignore
say ^I'm glad you came, the cows are getting restless.^
echoch ^You hear cows mooing anxiously outside.^
goto start
ignore: isfighting
iftrue gofight
emote ^touches your face, and smiles warmly.^
say ^There are cows out back who need milking.^
say ^and I, myself, have work to do, bye bye.^
goto start
gofight: wait 1
isfighting
iftrue gofight
goto start
The above program is more than adequate for a mob, but oftentimes, more
realism is needed. You can always add fighting sequences inside the
gofight loop. A sequence where Elsa hands you a bucket by using the
loadobject and giveobj commands can also be added.
Additional threads to check and trap player commands and actions might
be useful. There is a lot you can do with this scripting language.
The following are very basic example scripts you can use and modify.
Ask xero for examples of more elaborate, and multi-thread scripts when
online.
petcheck: trap 442
hasarg ^cat^
iffalse petcheck
block
echoch ^You pet a black cat.^
echonotch ^$n pets a black cat.^
emote ^bares its teeth, and hisses.^
goto petcheck
trap is a special command used to trap
certain player actions. 442 is the command number for pet as listed in
interpreter.c. To make sure the cat was being petted, [hasarg] was used.
Notice that a $n was used in echonotch.
$n will insert the name of the player being targetted here. $N, if used,
will insert the name of the mob.
givetrap: trap 72
hasarg ^coins^
iffalse givetrap
hasarg ^beggar^
iffalse givetrap
block
echoch ^You give the beggar some coins.^
echonotch ^$n gives the beggar some coins.^
say ^Oh, thank thee kindly.^
goto givetrap
72 is the command number for 'give'. Since there are several ways one can
give coins to a beggar, e.g., 'give coins beggar', 'give 10 coins beggar',
'give beggar coins', you have to use two hasarg commands to cover
each. Even if there was one way, you still would have to use two
hasarg commands because hasarg doesn't accept anything longer than
one word, unless you are specifically using isarg to match an exact
phrase.
© Copyright 1997 by
.
All rights reserved.
Last revised February 27, 1997.