NOTE: It is a *really* good idea to create MOBprograms on the builder port. It's quite easy to crash the MUD, especially when you're first starting out.

You've finally managed to scan through the information on if_checks, commands, variables, and everything else. Now it's time to combine them all to form some MOBprogs! Below is a little tutorial, type the directions exactly as shown, and you should have yourself a mobprog =)

Getting Started

First things first. You need to make sure that your coders have installed an online editor into the MUD, and that you have permission to use it. Once you've got that done, type "build". Then type "mpedit [mob vnum] ". You're now in the MOBprog editor, ready to create some programs. Proceed to step two.

NOTE: Every command needs to be on a new line when dealing with MOBprograms.

Adding MOBprograms

Once in MPEDIT you'll need to add the trigger type, to do this type "addmp [trigger] [argument]". For the MOBprogram I'm showing you to work, type "addmp allgreet 100". This will create an allgreet trigger that will be activated 100% of the time.

Adding IF_Checks

You're now ready to tell the MUD what to do when the trigger is activated. This is the spot where all of the above items (if_checks, varaibles, crashes, etc.) we've been discussing come together. Commands can be entered just like they can on a board. The first thing you'll usually want to do when making any MOBprogram is add an if_check. To do this, simply type the if_check out. For the MOBprogram we're making, type "if ispc($n)". When the trigger is activated by the target, $n, it will check to see if it is a PC.

Commands

Now the commands will only go off if the target is a PC, but what command will it be? To tell it what commands to do, simply type them in, like you did with the if_check. For ours, we'll type this in: "mpecho Woot! The MOBprog Worked! And I love Dwarves!".

That message will now be displayed if our MOBprog worked.

Wrapping Things Up

We'll now begin to close down the MOBprogram, to do this we first need to add an 'endif' for each if_check. Since there was only one if_check "if ispc($n)" we only need one endif. So type 'endif' and hit the enter key. The last thing you need to type when you end a MOBprogram is 'end'. This should go after the 'endif'. After typing this, press the period key, just like you would when exiting a board. Now press "x". The MOBprogram should look exactly like this:

>all_greet 100
if ispc($n)
mpecho Woot! The MOBprog worked! And I love Dwarves!
endif
end

Step 6. Making Sure It Works

Time to test it! Leave the builder. Load the MOB. Leave the room. Enter the room. If it works, you'll see the message: "Woot! The MOBprog worked! And I love Dwarves!".

Congratulations! You've either made your first MOBprogram, or crashed the MUD!

Saving your MOBprogs

The mobprog editor does NOT save unless you edit another part of your area and then forcereset. ( I normal just toggle a room flag on and then off, then forcereset) Always make sure to do this after you are positive your program works. Don't save before testing because some programs will cause a loop and will repeatedly crash the mud and the mprog will have to be hand edited on the server.

Summary of Steps:


Step 1. Get into the builder.
Step 2. mpedit [mobile vnum]
Step 3. addmp [trigger] [argument]
Step 4. Add if_checks/commands
Step 5. Close it up using 'endif' for each if_check, and at the end type in 'end'.
Then press the period key.

Step 6. Test your program to make sure it works
Step 7. SAVE YOUR WORK!

NOTE: If you need to edit the program for any reason, first mpedit the mob, then type "edit #" and you will be placed in the editor again. If you want to change the trigger type or argument just type "edit # [new trigger] [new argument]".