Prog: Speech

To start editing a prog, go to the room you wish this prog to go off in, or where the object/mob are reset in.

Type: pedit create <vnum> – This will create a new prog.
Type: pedit <vnum> – To edit an existing prog.
Type: plist all (or plist with no argument for a list) – To see a list of all the progs in the area and what they are attached to,.
Type: show – to see the current information of the prog, which should look like this:

To build the basics of your mob, go to the Mobs Tutorial first, then come back here for prog basics.

Desc: (null)
Vnum: [105]
Involved: FALSE
Debug: FALSE

Code:

bow $n
say Why hello!

Or Alternatively, if you wish to set it based on sex
if sex $n == 1
say Greetings, sir!
emote nods to $n as they walk past.
else
say Greetings, ma’am!
emote nods to $n as they walk past.
endif

Creating a Speech Prog

Setting up progs that are triggered by speech is very simple and easy. Essentially in the prog, we set what we would like the mob to do once someone says our keyword. In the example on the left, the first version has the mob bow and then say “Why hello” once our key phrase is said. But I have included a way to make the phrases different depending on the sex, so you get a feel for how they work as well (this can also be done for race, clan etc).

&n is a way for us to target the person who has set off this prog.

if sex &n == 1 essentially states, “If this character is a male, then we want to do this.” If the sex of &n is equal to (two equal signs is yes, one is no), 1 (males are 1, females are 2, neutrals are 3, and random sex is 0, I think), then we want this prog to happen.

The “else” after the male section, just means that, if the first prog couldn’t fire, then we’ll do this. It works good for when you want to say “Well if they are male, do this, otherwise we’ll do this instead.” Obviously there are only two choices when it comes to sex. If you were trying to use clans, you could say “If this person is a centaur, do this, but for all other races, we’ll do this instead.”

If you wanted to do specific things for several races, we would do something like

if clan &n == Imperium
say Hi Impy
elseif clan &n == Brotherhood
say I hate the brotherhood
else
say Howdy stranger

What that prog essentially did was give a specific greeting to all Imperials and Brotherhood members, but to everyone else, they just said “Howdy Stranger”. That’s because of the “elseif” because we wanted to target another specific item.

You can have your mob do as many actions as you want in this prog, but keep in mind that too many lines of emotes and says or actions might get spammy.

break tells the prog “Okay! After that happens I want you to stop this particular section of the prog!” That way it’s not doing all the emotes/echos at once, it just does one at a time and then stops until it decides to randomly go off again.

else basically tells us, “Okay, that first prog, if it’s not time for that one to fire, THEN we’re gonna do this next one instead!”

endif is what we have to close all the if sex &n == 1 lines with. For every IF we have to have an ENDIF. So if you have 5 ifs, you need 5 endifs.

Formatting is very important for progs, because it helps us read them faster. Make sure you indent all of your lines within the same IF section.

Keywords: [old scruffy dog]
Area: [ 3] Thelasian Harbor
Template: [unique]
Act: [npc]
Vnum: [ 250]
Sex: [male]
Race: [dog]
Level: [25]
Hit Chance: [50]
Evade: [10]
Hitroll: [7]
Dam Type: [bite]
Hit dice: [ 3d9 + 333]
Damage dice: [ 2d8 + 5]
Mana dice: [ 0d0 + 0]
Affected by: [none]
Armor: [pierce: 0 bash: 0 slash: 0 magic: 0]
Form: [edible animal mammal]
Parts: [head legs heart brains guts feet ear eye tail claws fangs]
Imm: [disease]
Res: [none]
Vuln: [none]
Off: [dodge fast]
Size: [small]
Start pos. [standing]
Default pos [standing]
Wealth: [ 100]
Short descr: an old scruffy dog
Long descr:
An old scruffy dog sniffs around for food here.
Description:


MOBPrograms for [ 3475]:
Number Vnum Trigger Value
——- —– ———— —–
[ 0] 3125 speech greetings

Adding the above prog to a room, mob, or object

Our next step, once we have all our speech responses ready, is to add it to the room, mob, or object. To do so, have your room, mob, or object handy.

I’ll use a mob for an example, so we would type: addmprog 3125 speech greetings. Which addprog and the vnum should already be explained in the prog basics tutorial.

speech just means we are adding a speech trigger to this mob.

value is the phrase you want to trigger the prog. This can be a couple of words, like “boars tusk” or just ” boar”, but try to avoid long sentences that people could easily type in wrong.

To exit the mob editor, type: done

And be sure to -always- save your area by typing: edit area, asave area, done