ter
 
[Herne's SMAUG Building Guides]
  [Introduction] [Building Rooms] [Making Resets]
  [FAQ] [Building Objects] [Making Programs]
  [Some of Herne's Ideas] [Building Mobs] [OLC Resources]
 
 

I am also working on making a PDF Version of this page.

This page last updated: Oct 2002
 
 

A Guideline for Making Programs

This is intended as a set of guidelines to those who are just beginning as Builders. Nothing here is written in stone, this file is based on my experience and the online help files.

Herne the Hunter

Remember that most important command: SAVEAREA

Please Note: Many of these help files have been written or rewritten by the various hard-working Immortals of the Realms of Despair. Without these people, there would be no need for these guides, nor would they be nearly as comprehensive as they are now.

Table of Contents:

1. Giving life to your areas  
2. How to make Programs — Getting Started  
3. Triggers — How to set programs in motion.  
  RPTRIGGERS — Room Programs OPTRIGGERS — Object Programs
  MPTRIGGERS — Mobile Programs •  (Special Case) Use_Programs
4. Commands for Editing Programs  
  •  MPEDIT — Edit Mob Programs •  MPSTAT — Show Mob Programs
  •  OPEDIT — Edit Object Programs •  OPSTAT — Show Object Programs
  •  RPEDIT — Edit Room Programs •  RPSTAT — Show Room Programs
5. The Meat of the Program  
  » MPCommands — Commands used in Programs
  » Silent — Making quiet programs.
  » Colour Codes — For use in mpechoes.
  » Using Multiple Rand Programs — More than one program on a mob/object/room?
6. IFChecks — Information Gathering Tools  
7. Variables — What's Triggering the Program?  
8. Some Sample Programs  
  » Program 1 — A simple greeting program  
  » Program 2 — A simple bribe program  
  » Program 3 — A simple act program  
  » Program 4 — A simple atmosphere program  
  » Program 5 — A simple object program  
9. The Economy Code — What is it and how does it work?
» A Final Word  


Giving Life to your Areas

This is by no means the LAST word on how to make programs for SMAUG-type MUDs, this is merely intended as a "place to start". There are many people who have MUCH more experience when it comes to making programs, and this file is my crude attempt at helping those who are just starting out. The main thing is, this file will provide all the required HELP files in one place for the new programmer.

Programs are the tools that provide "life" to an area, from something as simple as providing "atmosphere" to something as complicated as a fight program. Programs bring the MUD alive.

[Back to Top]

How to Make Programs

Programs can be linked to either rooms, mobs or objects, but all programs require a trigger to set them in motion. What you use for a trigger will probably depend on what you want the program to do. Should you require a mob to sell a special key, you'd need a bribe trigger. If you wanted a room to check the alignment of players that passed through it, you'd need an entry trigger, and so on.

When writing your programs, you first need to figure out what you want the program to do, and then work from there towards your goal. If, for example, you want to make a program that will combine various objects into another object (The Sword of Legends comes to mind) then you'll need to have the objects handy, and you will also need to program in some sort of error-checking before the object can be combined. Think your process out logically and writing the program becomes easier.

This page is intended to provide you with an overview of the commands you'll need to make your own programs, and I have also provided a few easy sample programs for you to try. Kindly do not email me and ask me to write programs for you, it will not happen.

[Back to Top]

TRIGGERS

A trigger is an action, phrase, or game event that causes a program held within a room, mob or object, to begin playing out its commands.

Triggers can be anything from a player or mob entering a room, to a player stating a particular phrase within a room, or to a mob or an object.

For detailed information on triggers, see also: RPTRIGGERS, OPTRIGGERS and MPTRIGGERS.

[Back to Top]

ROOMTRIGGERS   RPTRIGGERS

Trigger Option Triggering Variable Explanation
Act {p} <keyword / phrase> [emotes, socials, actions, bamfs]
Speech {p} <keyword / phrase> [says or tells from within the room]
Rand   <percentage> [randomly triggered based on %]
Sleep   <percentage> [when a player sleeps within the room]
Rest   <percentage> [when a player rests within the room]
Entry   <percentage> [when a mob/player enters the room]
Fight   <percentage> [when a player is fighting in the room]
Death   <percentage> [when a player dies in the room]
Leave   <percentage> [when a player leaves the room]
Time   <hour> [script prog, runs once an hour]
Hour   <hour> [loops Script for an hr from start hr]
Login   <percentage> [triggered by login or reconnecting]
Void   <percentage> [triggered by returning from the void]
ImmInfo   <percentage> [triggers when an Imm enters room]
Exa {p} <keywords> [when a char looks at <keyword>]
Command {p,m} <keywords> [See HELP COMMAND PROGRAM]

*NOTE*
• {hour}/(hour) is in military time. ie, 15 hours is 3pm mud time.
• The mpcommand MPDONOTHING currently only works in Script progs, NOT in Time
    or Hour progs.

See also: MPSTAT, MPEDIT, TRIGGER, MPCOMMANDS, IFCHECKS, VARIABLES.

[Back to Top]

OBJTRIGGERS   OPTRIGGERS

Trigger Option Triggering Variable Explanation
Wear   <percentage> [when a player wears the object]
Remove   <percentage> [when a player removes the object]
Speech {p} <keyword / phrase> [says or tells from same room as mob]
Rand   <percentage> [randomly triggered based on percentile]
Sac   <percentage> [when a player sacrifices the object]
Zap   <percentage> [when the player zaps due to alignment]
Get   <percentage> [when a player gets the object]
Drop   <percentage> [when a player drops the object]
Damage   <percentage> [when the object is damaged]
Repair   <percentage> [when the object is repaired]
Greet   <percentage> [when a mob/player enters the room]
Exa   <percentage> [when the object is Exam'ed or Looked at]
Look   NOT CURRENTLY IN USE
Push   <percentage> [when a player pushes an object]
Pull   <percentage> [when a player pulls an object]
Use   <percentage> [see 'HELP USEPROG' for details]

See also: OPSTAT, OPEDIT, TRIGGER, OPCOMMANDS, IFCHECKS, VARIABLES.

[Back to Top]

USEPROG

Syntax : opedit (object) {command} [number] [use_prog] [percentage]

Example: opedit helmet add use 50 (Prog triggers 50% of the time worn)

The use_prog is an objtrigger that can be used in object programs. The use_prog will be executed when the item is used. To define what will trigger the use_prog, here is a list:

» Wands — when you zap
» Staves — when you brandish
» Food/pills — when you eat
» Blood/fountains/drink containers — when you drink
» Lights/armour/weapons — when you wear/wield/hold
» Potions — when you quaff
» Pipes — when you smoke

When the use_prog is executed you will not see the standard 'use message' (ie You quaff a violet potion). What you will see will be any mpechoes placed in the program. Also, any mobprog commands can be used in use_prog (see MPCOMMANDS).

*NOTE* The use_progs on lights, armour, and weapons are executed BEFORE the player wears/holds/wields any item. Therefore, a mpforce to remove the item will not work in the use_prog. You will have to use a wear trigger to accomplish this.

[Back to Top]

MOBTRIGGERS   MUDTRIGGERS   MPTRIGGERS

Trigger Option Triggering Variable Explanation
Act {p} <keyword / phrase> [emotes, socials, actions, bamfs]
Speech {p} <keyword / phrase> [says or tells from same room as mob]
Rand   <percentage> [randomly triggered based on %]
Fight   <percentage> [random within a fight, based on %]
Hitprcnt   <percentage> [percent is % of mob's max H.P.]
Greet   <percentage> [entry that mob can see, by mob/pc]
Allgreet   <percentage> [entry by mob/pc, regardless if seen]
Entry   <percentage> [when the mob itself enters a room]
Bribe   <percentage> [when a player gives the mob money]
Death   <percentage> [when the mob dies]
Script   <hour> [loops line at a time. Hour triggers]
Time   <hour> [script prog, runs once a hour]
Hour   <hour> [loops Script for an hr from start hr]
Load   <percentage> [triggers on MOB reset based on %]
Login   <percentage> [triggers on login/reconnect]
Void   <percentage> [triggers on return from the void]
Emote {p} <keyword / phrase> [triggered by emoting <keywords>]
Tell {p} <keyword / phrase> [triggers by tells only]
Greetinfight   <percentage> [message on entry if fighting]
Command   <keyword / phrase> [triggers on command in room]
Sell   <percentage> [triggers when shopkeeper sells item]
Move   <percentage> [triggers to override mob wander]

*NOTE*
• {hour}/(hour) is in military time. ie, 15 hours is 3pm mud time.
• The mpcommand MPDONOTHING currently only works in Script progs, NOT in Time
    or Hour progs.

See also: MPSTAT, MPEDIT, TRIGGER, MPCOMMANDS, IFCHECKS, VARIABLES.

[Back to Top]

Commands for Editing Programs

MPEDIT

Syntax: mpedit (mobile) {command} [number] [program] [arguments]
Syntax: mpedit (mobile) add {program} [arguments]
Syntax: mpedit (mobile) insert {number} {program} [arguments]
Syntax: mpedit (mobile) edit {number} [program] [arguments]
Syntax: mpedit (mobile) delete {number}
Syntax: mpedit (mobile) list

Add, insert and edit will put you into the line editor to edit your program. The arguments consist of a trigger, plus any arguments associated with that trigger.

MPSTAT

Syntax: mpstat (mob/mobvnum)

Mpstat will display all of the mobprograms that have been written for the specified mob. If an instance of that mob exists in the game, it can be accessed with its vnum.

See also: TRIGGER, MPTRIGGERS, MPCOMMANDS, IFCHECKS, VARIABLES

[Back to Top]

OPEDIT

Syntax: opedit (object) {command} [number] [program] [arguments]
Syntax: opedit (object) add {program} [arguments]
Syntax: opedit (object) insert {number} {program} [arguments]
Syntax: opedit (object) edit {number} [program] [arguments]
Syntax: opedit (object) delete {number}
Syntax: opedit (object) list

Add, insert and edit will put you into the line editor to edit your program. The arguments consist of a trigger, plus any arguments associated with that trigger. Object programs are like mobprograms, with trigger differences.

To edit an Objprogram, you must be holding the object in your inventory.

OPSTAT

Syntax: opstat (object/object vnum)

Opstat will display all of the objprograms that have been written for the specified object. If a copy of the object exists in the game, it can be accessed by its vnum.

See also: TRIGGER, OPTRIGGERS, OPCOMMANDS, IFCHECKS, VARIABLES

[Back to Top]

RPEDIT

Syntax: rpedit {command} [number] [program] [arguments]
Syntax: rpedit add {program} [arguments]
Syntax: rpedit insert {number} {program} [arguments]
Syntax: rpedit edit {number} [program] [arguments]
Syntax: rpedit delete {number}
Syntax: rpedit list

Add, insert and edit will put you into the line editor to edit your program. The arguments consist of a trigger, plus any arguments ssociated with that trigger.

To edit a roomprogram you must be in the room you wish to edit.

RPSTAT

Syntax: rpstat

Rpstat will display all of the roomprograms that have been written for a room. You must be standing in the room that you are rpstatting (though you can also use 'rpstat' in conjunction with the 'at' command to rpstat a room remotely).

See also: TRIGGER, RPTRIGGERS, RPCOMMANDS, IFCHECKS, VARIABLES

[Back to Top]

The Meat of the Program

Once you've set the trigger for a program, you enter into a note-like text editor that you use to write the program itself. Just like writing a program for a PC, a MUD Program can perform many tasks such as issuing mpcommands (MUD Program Commands), ifchecks, or merely printing text to the screen.

MPCOMMANDS RPCOMMANDS OPCOMMANDS

The following commands can be used for Room, Mob and Object progs. The commands listed at the bottom of the left column are for mob progs only.

The MPCommand Help Files are in a separate HTML document to preserve space here.

MPCommand Parameters
MPECHO <phrase>
MPECHOAT <name/var> <phrase>
MPECHOAROUND <name/var> <phrase>
MPASOUND <phrase>
MPECHOZONE <text/phrase>
MPOLOAD <object vnum>
MPOSET <field> <value>
MPMLOAD <mob vnum>
MPMSET <field> <value>
MPJUNK <name/var>
MPPURGE <object/mobile name>
MPTRANSFER <name/all>
MPSCATTER <victim> <#> <#>
MPFORCE <name/all> <actions>
MPSLAY <victim>
MPDAMAGE <name> <#hps>
MPDREAM <name> <phrase>
MPFLAG <flag> <bit>
MPTAG <tag> <value>
MPRESTORE <victim> <amount>
 
MPCommand Parameters
MPOPENPASSAGE <room> <dest> <dir>
MPCLOSEPASSAGE <room> <direction>
MPFILLIN <direction>
MPFAVOR <victim> <value>
MPPRACTICE <victim> (skill|spell) (max%)
MPADVANCE <player name> <level>
MPINVIS <level>

MPSLEEP

<delay>
 
For Mobiles Only
MPKILL <name>
MPGOTO <vnum>
MPREGOTO <vnum>
MPAT <vnum>
MPDEPOSIT <amount>
MPWITHDRAW <amount>
MPPLACE <area|vnum range>
MPRETRANS <name>
MPHUNT <name>
MPHATE <name>

Shortcuts
MPECHOAROUND = MER MPTRANSFER = MPTRANS
MPECHOAT = MEA MPECHO = MPE
MPECHOZONE = MEZ  

See also: MPSTAT, RPSTAT, OPSTAT, MPEDIT, RPEDIT, OPEDIT, TRIGGER,
MPTRIGGERS, RPTRIGGERS, OPTRIGGERS, IFCHECKS, and VARIABLES.

Note: MPCommands are not case sensitive.

[Back to Top]

SILENT (RoD Specific)

Syntax: Silent <Commands>

Usage: M/O/Rprograms

Adding this word to the beginning of a line in a mob program will force the resulting command to be silenced to all players in the room. An example would be:

silent mpforce 0.$n remove all

This will cause the player to remove all. Only mobs in the room with the character will see the remove messages. This can also be used to silently trigger other mobprograms in the room.

[Back to Top]

ECHO_COLOURS

The following 16 colors are supported in the commands echo, recho, mpecho, mpechoat and mpechoaround.

Note: When choosing a colour, remember that not everyone sees screen colours as you do.

Code Colour
_whi White (Default)
_blu Blue
_lbl Light Blue
_gre Green
_cha Charcoal (Grey)
_pur Purple (Magenta)
_ora Orange
_pin Pink
 
Code Colour
_yel Yellow
_dbl Dark Blue
_cya Cyan
_dgr Dark Green
_dch Dark Charcoal (Dark Grey)
_red Red
_bro Brown
_bla Black

If the indicator is preceded by an asterisk, the message will blink. To save line space, you only need to enter as much of the color indicator as required to uniquely identify it.

Example: recho _red This is an example of recho in red.
  recho *red This is an example of recho in blinking red.
  mpecho _yel This is an example of mpecho in yellow.
  mpe _yel This is an example of mpecho in yellow.
  mpechoat $n _blu This is an example of mpechoat in blue.
  mea $n _blu This is an example of mpechoat in blue.
  mpechoaround $n _bro This is an example of mpechoaround in brown.
  mer $n _bro This is an example of mpechoaround in brown.

[Back to Top]

Using Multiple Rand Programs

All mobs/objects/rooms with multiple programs of the same type at less than 100% on any of them will result in the following programs being restricted to basic probability rules.

For instance, if a mob A has:

rand_prog 10 10% chance of occuring.
rand_prog 10 10% of the 90 remaining percent, thus 9%.
rand_prog 5 5% of the remaining 81%, thus 77%.
rand_prog 10 10% of the remaining 77%, thus 7% ( or 8% depending on rounding)
rand_prog 5 and so on...

To (roughly) divide parts equally (As calculated by Dria):

Parts Randoms Percentage Breakdowns (%)
2
1
50
 
 
 
 
 
 
 
 
 
 
3
2
33
50
 
 
 
 
 
 
 
 
 
4
3
25
33
50
 
 
 
 
 
 
 
 
5
4
20
25
33
50
 
 
 
 
 
 
 
6
5
17
20
25
33
50
 
 
 
 
 
 
7
6
14
17
20
25
33
50
 
 
 
 
 
8
7
13
14
17
20
25
33
50
 
 
 
 
9
8
11
13
14
17
20
25
33
50
 
 
 
10
9
10
11
13
14
17
20
25
33
50
 
 
11
10
9
10
11
13
14
17
20
25
33
50
 
12
11
8
9
10
11
13
14
17
20
25
33
50

So if we wanted a mobile to have 4 programs, each with an even chance of triggering, we'd use the option that has "4 parts" or "3 randoms," giving us;

rand_prog 25 25% chance of occuring.
rand_prog 33 33% of the 75 remaining percent, thus 25%.
rand_prog 50 50% of the remaining 50%, thus 25%.
  This leaves us 25% remaing for the final program.
[Back to Top]

IFCHECKS

The bulk of the IfCheck Help Files are in a separate HTML document to preserve space here.

Value checks can use == (equals) > (greater than) < (less than)
and ! (not). Combine for: != (not equal) >= (greater than or equal).

Value Checks
Sex Sex? (1 2 or 3)
Level Experience level?
Str # of Strength?
Int # of Intelligence?
Wis # of Wisdom?
Dex # of Dexterity?
Con # of Constitution
Cha # of Charisma?
Lck # of Luck?
Name Name? (STRING)
Race Race name? (STRING)
Class Class name?(STRING)
Hps # of hps?
Hitprcnt % of hit/max_hit?
Mana # of mana?
Goldamt # of gold?
Position Position #?
Age Is target's age == <age>?
Weight Target's weight?
Height Target's Height?
IsGood Align >= +350?
IsEvil Align <= -350?
IsNeutral Align < +350 > -350?
Drunk Is target drunk?
Haspet Does target have pet?
 
Value Checks
Deity Name deity? (STRING)
Isdevoted target devoted?
Favor # of favor?
Guild Guild name? (STRING)
IsLeader Leader, #1, #2?
Council Member of council? (STRING)
Clan Clan name? (STRING)
IsClanLeader Clan Leader?
IsClan1 Is target #1?
IsClan2 Is target #2?
Clantype Clan/Order/Guild Type?
Ispkill Pkiller?
Canpkill Pkill/lev>4/age>17?
Pkadrenalized Have Adrenaline?
Ishelled Is target helled?
IsAttacker Have Attacker Flag?
IsKiller Have Killer Flag?
IsThief Have Thief Flag?
IsFlagged Flagged with <flag>?
IsTagged Tagged with <var>?
PCFlagged Is PC flagged with ...?
DoingQuest Is PC doing a quest?
Rank Rank?(STRING)
Genre Which genre? (RoD specific)
   

Value Checks
isnuisance Is nuisanced?
Nuisance nuisance level?
Isasupressed Is target asupressed?
Waitstate Is target in waitstat?
Idle Is target idle?
Hostdesc Target's IP?
Multi Multi-playing?
AreaMulti Present area Multi?
Isnpc Mob?
Ispc Player Character?
Isimmort Immortal?
Ismounted Mounted?
Isriding Being ridden?
Isfollow Following master?
Ischarmed Charmed?
Isaffected Affected_by name?
IsFlying Is Target Flying?
Ishunting Hunting someone?
Ishating Hating someone?
Isfight Fighting?
Numfighting Number Fighting?
Timeskilled # of times killed?
Ispacifist Pacifist?
Isdead Did the mob die? (See helpfile)
Actflagged What is target's actflag?
Wearing Is target wearing something?
Wearingvnum Is target wearing specific vnum?
Carryingvnum Is target holding specific vnum?
 
Value Checks
Cansee Can I see the target?
Ismobinvis Mobinvis?
Mobinvislevel Level of invis?
Inroom Room #? (VNUM)
Inarea Is target in specific area?
Mobinroom Mob in room?
Mobinarea Is mob in area?
Mobinworld Does mob exist?
Mortinroom Is mort in room?
Mortinarea Is mort in area?
Mortinworld Is mort anywhere?
WasInRoom Was target in X room?
MortCount Mortals in room?
MobCount NPCs in room?
CharCount NPCs + Mortals in room?
Safe Is it a safe room?
Norecall Is room norecall?
NoAstral Is room noastral?
NoSummon Is room nosummon?
NoMagic Is room nonmagic?
NoSupplicate Can they supp?
indoors Is room indoors?
Ispassage(DIR) Exit exists?
Isopen(DIR) Exit open?
Islocked(DIR) Exit locked?
   
   
   

Value Checks
Objval# Value# ==?
Objtype Type of Object?
Objinworld Is the Object on the MUD?
Ovnumhere # of objvnum here
Ovnumroom # of objvnum in room #
Ovnumwear # of objvnum worn by target
Ovnumcarry # of objvnum carried by target
Ovnuminv # of objvnum in target's inv
Otypehere # of objtype here
Otyperoom # of objtype in room #
Otypewear # of objtype worn by target
Otypecarry # of objtype carried by target
Otypeinv # of objtype in target's inv
 
Value Checks
Time (Military)Time?
Economy # of economy?
Rand (#) Equal to or less than (#)?
LeverPos Lever Up/Down?
Number Is vnum ==?
ishot Is it hot?
iscold Is it cold?
iswindy Is it windy?
issnowing Is it snowing?
israining Is it raining?
iscalm Is it calm?
mpsleep Is target in MPSLEEP state?
stopscript Is target able to run script?

See Also: MPSTAT, RPSTAT, OPSTAT, MPEDIT, RPEDIT, OPEDIT, TRIGGER, MPTRIGGERS, RPTRIGGERS, OPTRIGGERS, MPCOMMANDS, RPCOMMANDS, OPCOMMANDS, VARIABLES, and MINPOS.

[Back to Top]

MINPOS

Minimum Positions affect both spells and skills. For example, if the minimum position for a spell was 8, it would work while sitting, fighting or any position higher than that. The same spell would not work in the resting position as it's ranked at 6.

Bitvector Position
0
POS_DEAD
1
POS_MORTAL
2
POS_INCAP
3
POS_STUNNED
4
POS_SLEEPING
5
POS_BERSERK
6
POS_RESTING
7
POS_AGGRESSIVE
 
Bitvector Position
8
POS_SITTING
9
POS_FIGHTING
10
POS_DEFENSIVE
11
POS_EVASIVE
12
POS_STANDING
13
POS_MOUNTED
14
POS_SHOVE
15
POS_DRAG
[Back to Top]

VARIABLES

Variable
Mobile
Actor
Victim
Random
Object
2nd_Object
Last_Obj
Last_Char
Name
$i
$n
$t
$r
$o
$p
$v
$w
Shrt_desc/title
$I
$N
$T
$R
$O
$P
$V
$W

he/she/it

$j
$e
$E
$J
$u
him/her/it
$k
$m
$M
$K
$h
his/hers/its
$l
$s
$S
$L
$g

LAST_CHAR applies to the last character loaded in the game — can be used when a mob is mpmloaded in the program.

Using a * after a variable (eg. mpe $i* says hello) will cause the firstletter of the variable become capitalized.

See Also: MPSTAT, RPSTAT, OPSTAT, MPEDIT, RPEDIT, OPEDIT, TRIGGER, MPTRIGGERS, RPTRIGGERS, OPTRIGGERS, MPCOMMANDS, RPCOMMANDS, OPCOMMANDS, and IFCHECKS.

[Back to Top]

SAMPLE PROGRAMS

Program 1: Basic shopkeeper greet program.

Commands Comments
mpedit joe add greet 100 Add a 100% greet prog to the mob named "Joe"
if ispc($n) Check to see if triggerer is Player
mea $n Greetings $n*! If True: Echo at Player {phrase} (Capitalize Player's name)
else Otherwise
say Hello, $I. If False: say "Hello" to NPC
endif Every "if" requires an "endif"

[Back to Top]

Program 2: A simple bribe program.

Commands Comments
mpedit joe add bribe 1000 Add bribe program to mob named "Joe"; cost 1000 coins
if ispc($n) Check to see if triggerer is Player
  mea $n Here's your key, $n*. If True: Echo at Player (Capitalize Player's name)
  mpoload 1000 1 Load object 1000 at level 1
  give key $n Give key to Player
else Otherwise
  say Thanks for the gold, chump! False: Say {phrase}
endif Every "if" requires an "endif"

[Back to Top]

Program 3: A simple act program

Commands Comments
mpedit joe add act p heal me Add act prog to mob named "Joe" triggered by phrase
if ispc($n) Check to see if triggerer is Player
  if isevil($n) If True: Is player evil?
    say I don't heal evil people! If True: Say {phrase}
  else Otherwise (From second IF statement)
    say I will heal you, $n*. Not evil (False): Say {phrase}
    mpforce $n give 5000 coins joe Force player give mob 5000 coins
    c 'heal' $n Cast heal on player
else Otherwise (From first IF statement)
  say I don't heal mobs! Not PC (False): say phrase
  endif Endif to match If
endif Endif to match If

[Back to Top]

Program 4: A simple "atmosphere"-type room program.

Commands Comments
rpedit add rand 5 Add a random program - 5% chance
mea $r The crickets chirp in the grass. Echo phrase at a random player

Why do we use 'mea $r'?

Every time a player enters the room the random program fires and checks to see if the random number falls within the 5%. If 8 players enter the room, the program fires 8 times in succession, so this could cause your atmosphere-type program to fire several times in succession as well. To solve this problem, use mpechoat and the random variable so that only one player will see the message at any time.

[Back to Top]

Program 5: A simple Object program

Commands Comments
opedit sword add repair Add repair program to object named 'sword' (Object must be in your inventory.)
mea $n A silver sword says, 'Oh! That's much better!' Echo {phrase} at the Player who is using the 'repair' command.
mer $n A silver sword gleams in $n*'s hand. Echo {phrase} around the Player who is using the 'repair' command.

[Back to Top]

The Economy Code

The Economy Code is something fairly new that was added to the MUD to encourage players to explore many areas instead of just sitting in one area repeatedly killing good cash producing mobs. The Advanced Builder can modify the economy of a specific area by "tweaking" using programs and ifchecks to cause a mob to replenish its gold, or "borrow" gold from other areas to replenish its area's economy. (I don't claim to be that advanced, but I thought I'd include this for those who wish to try.)

ECONOMY
Each area will initialize (on bootup of the mud) with a pool of gold based on the area's range and the wealth of each mob in that area.

The shopkeepers and thieves will automatically deposit gold into the economy if they are carrying more than a certain amount (the higher the level of the shopkeeper, the greater they will carry before depositing).

To allow mobprogs to be created to manipulate area economies, making them interactive and interdependent, there are two mpcommands: MPDEPOSIT, and MPWITHDRAW (see related helpfiles listed below). There is also an 'ifeconomy' ifcheck.

The aset command can also be used to adjust an area's economy by hand (Example: aset {area filename} low_economy [amount], this will give the specified area a minimum economy at the level you set).

Mobs will not repop with more gold than what they were originally created with, but if the area economy runs low they will begin to repop with less until the economy is replenished (as they all share the same gold pool).

MPDEPOSIT MPWITHDRAW
Syntax: mpdeposit (amount)
Syntax: mpwithdraw (amount)

This command orders the mobile to deposit or withdraw a specified number of gold coins from an area. These can be used in conjunction with mpat to tell the mob which area to withdraw/deposit money in.

Example: mpat 21000 mpwithdraw 5000000

This would cause the mob to withdraw 5 million coins from the new Darkhaven area, as that is the area vnum 21000 is in.

If no mpat is used, the mob will withdraw or deposit the gold from the area in which it is located at the time.

[Back to Top]

A Final Word

Once you have reached the level of "Programs", you've reached a certain level of trust in the Building circle. Mob programs have the power to add life to the MUD, and they have the power to cause the MUD to spin into an unending loop and crash. You must remember to be extremely careful when you begin making programs. As you progress and your programs become more and more complex, they also become more dangerous to the stable operation of the MUD. Always be sure you know exactly what you're doing when you make a program: start small and work your way towards the complexity you desire in small steps rather than leaps. But at the same time, don't be afraid to say "what if..."


Rooms  ] [ Objects ] [ Mobs ] [ Resets ] [ Programs ] [ Resources ] [  FAQ  ]

[Back To My Homepage][Back to Top]
The entire contents of this page is Copyright ©1997-2007 FoxDesigns