Below are further examples of MOBprogs with descriptions. The first few will detail how to use the 'or' and 'else' function.
The 'else' and 'or' commands can be used with the if_checks.


For example:

>all_greet_prog 100
if isnpc($n) 
if isimmort($n) 
bow $n 
endif 
endif 
end 

All_greet_prog triggers 100% of the time
Is target NPC?
Is target an immortal?
Social command and variable
Closes "isnpc" check
Closes "isimmort" check
Closes program

In the example above, the commands will be sent if the target is an
NPC, or if it is an immortal. The "else" function works the opposite way, as shown in the example below:

>all_greet_prog 100
if isgood($n) 
grin $n 
else 
frown $n
endif
end 

All_greet_prog triggers 100% of the time
Is target of good alignment?
Social command and variable
Else statement
Social command and variable
Closes the if_check
Closes the program

NOTE: If you want to do two checks, such as one to see if the target is a PC of good-alignment, the "and " function is not necessary, simply write it as shown below.

>all_greet_prog 100
if ispc($n) 
if isgood($n) 
bow $n 
endif 
endif 
end 
All_greet_prog triggers 100% of the time
Is target PC?
Is target good-aligned?
Social command and variable
Closes "isnpc" check
Closes "isimmort" check
Closes program

Now it's time for some sample MOBprograms! The following example was taken from one of my mobs, Kralikazas the Ice God. It has some fun fight_progs in it

>act_prog 'is DEAD!!' 
if ispc($n) 
ooc Ow, $n seems to have kicked the bucket! 
endif
end 

Act_prog trig goes off when someone dies.
Checks if the target who triggered it is a PC
Gives the message through OOC channel
Ends the "ispc" check.
Closes the mobprogram

 

>all_greet_prog 100  
if isnpc($n) 
mpechoaround $n $I summons forth a blast of cold, which causes $N to freeze, and shatter into thousands of brilliant crystals.
mppurge $n 
else 
c 'thought vise' $n 
endif 
end 

Allgreet trig, goes off 100% of the time
Checks the person entering is a NPC
If it is a NPC, the message will show


The target NPC is destroyed
If target is not a NPC.
Will cast 'thought vise' on the player.
Closes the 'isnpc' check

Closes the mobprogram

-This next one is an example of a fight_prog, taken from another of my mobs, Grumtukk Threetooth.

>fight_prog 16
mpecho A fierce ogre warrior stumbles through the bushes, and assists his leader! 
mpmload 3202
end

Fight_prog trig, 16% chance of going off per round
Message to room

Loads the mob with a vnum of 3202.
Closes the program

This one is a druid guard that was meant to keep newbies within the lower-leveled areas

>all_greet_prog 100
if level($n) > 5
mpechoat $n $I smiles at you.
else
mpecho $I says, "Sorry, $n, I have orders to keep you in the Adventurers' Guild until you've gained a few more levels. It's for your own safety, I assure you."
mpechoat $n $I hauls you back to the east.
mpechoaround $n $I blocks $n's path.
mptransfer $n 2073
mpat 2073 mpforce $n look
endif
end

Allgreet prog, triggered 100% of the time
Checks if level is greater than 5
Message is displayed if level is greater than 5
If the player is not greater than level 5.
Messages everyone in room


Message to player
Messages everyone but player
Transfers player to room 2073
Forces the player to 'look'
Ends the 'if level' check
Closes the program.

-Another bit taken from the newbie school, this one will teleport players to another hometown.

>speech_prog Dreamweaver Dragonaris 
if level($n) <40
mpecho $I says, "Very well, $n, you will be teleported to Dragonaris."
mpat 4104 mpechoaround $n A shimmering red portal appears, and $n steps out of it.
mptransfer $n 4104
mpechoat $n A shimmering red portal opens, and you close your eyes and step through. When you open your eyes, you are elsewhere...
mpat $n mpforce $n look
mpechoaround $n A shimmering red portal opens, and $n enters it.
endif
end

Speech trig if either keyword is said
Checks to see if player is below level 40.
Message to room

Message to target room

Transfers player to room 4104
Displays the message to the player in room 4104.



Forces player to 'look'.
Message to player 
Ends the 'if level' check
Closes the program