Progs: Getting Started

To clear a few things up right off

YES Progs require you to do some coding, including some simple logic statements, nothing too crazy though. You can handle it.
YES You will most likely screw up the first, second, or third time you try to do a prog, it’s cool, happens to everyone.
NO They are not difficult. 75% of the progs you will be writing/using have already been done to some degree before you.

The most important thing to remember in my opinion is this,¦ keep things simple and add onto them. If you start out with a huge, complicated, complex prog and sit down and try to write it out, chances are you aren’t going to get anywhere. Do a small portion of it, test it, smile in self gratification and keep going. This will help you to stay focused and feeling like you are getting somewhere. Progs can be very frustrating, don’t let it get the best of you.

Designing a Prog

Very simple: what do you want to happen, and when? Try to keep in mind how it can be abused, and under what circumstances you don’t want the event to happen. For example, I want to make a prog that when a player types “pick apple” when standing in front of a certain tree, it loads a golden apple object into their inventory just as if they had picked the apple from the tree. The apple is meant to be an item that can be sold for 5 gold as a prize for reaching the tree after a long quest. However, in my prog, I didn’t set anything to make sure that the PC could only have one apple in their inventory, so I’ve given the player access to as many apples as he can carry, and essentially screwed our economy all to hell.

Triggers

This is what event must take place in order for things to happen. If you want something to happen when you say “Fetch me some water”, then you are using a speech trigger. If you want something to happen when a character types “light cigar” you are using something called the interp (or interpret) trigger. There is no reason to sit down and memorize all the triggers, when you need something to happen based on whatever condition, simply refer back to the Advent Prog Dictionary and look under the section “Triggers”. You will learn the important ones quickly, and the explanations for the others are quite detailed, so you shouldn’t have too much trouble finding what you need.

Logic Tests

This is basically anything that you want to check for before the system continues processing your prog. For instance, if you only want a guard to react to something said when it is said by a woman, then you would use something like:

if sex $n == 2
sayto $n Hello there ma’am!

So, basically what that means is that if the sex of $n (the player who said something to set off the trigger) is 2 (female) then say to them “Hello there ma’am!” Pretty easy, right? If you wanted the mob to only respond to a man, simply change the 2 (female) to a 1 (male) and the sayto line to “Hello there sir!” and you are done.

Again, there is no reason to memorize these, simply layout the idea you want, and then refer to the Prog Help File to find out what you need to use for your prog to make it work. This brings us to our next section to explain, “How the hell did you come up with ” To answer simply, I didn’t, there’s a list of things called.

References

This is the object, character, mob, etc. that you want to include in your prog. If you want the prog to say something to the character, or you want to load an object into his/her inventory, this is how you do it. There is a list of references in the Advent Prog Dictionary, and under any function you are using it will tell you what symbol needs to be inserted before the reference to make it correct. So in this case ˜n becomes $n

A couple of these just to clarify would be:

1. i Always the calling mob of an prog
2. n Always the person triggering the prog, if any
3. t An involved char
4. f An involved char, generally a shopkeeper
5. j Always the calling obj of an oprog
6. k Always the calling room of an rprog

And so on and so forth, again the full list can be found in the Advent Prog Dictionary.

Special Functions

When you want something special within your prog, most of the time something a normal player or mob couldn’t do, that’s when special functions come into play. For instance.

prog echo The wind blows, causing a beautiful assortment of colored leaves to rain from the trees

This would send a message to everyone who was in the room when the prog was triggered. These are simply put into the body of your code in the order and under the circumstances you wish. They are always preceded by the word prog. These are also listed in the Advent Prog Dictionary.

Now that you have a basic understanding of what progs consist of, let’s build one.

I want a prog that does the following:

When someone walks up to a guard and says, “raise the banners”, a message is displayed to everyone in the city that the banners are being raised, and the guard then acknowledges the player who said it with something like, “The banners have been raised as you commanded.”

What do we want the prog to be triggered by? When someone walks up to a guard and says, “raise the banners”, so our trigger is going to be speech.

Our code will look like this¦

prog zecho The Imperium banners blow gently in the wind as the guards raise them high.
sayto $n The banners have been raised as you commanded.

Add the prog to the guard mob with the speech trigger and parameters of “raise the banners” and you are done.

Now, after thinking about it a little bit, I don’t want just anyone raising the banners, just members of the Imperium. So how do we do that? Logic statements.

if clan $n imperium
prog zecho The Imperium banners blow gently in the wind as the guards raise them high.
sayto $n The banners have been raised as you commanded.
else
sayto $n And who are you to order me around? Go away before I cleave you in two!
endif

So, now if you are a member of the clan “Imperium”, the banners will be raised and the zone echo will be sent, otherwise, the guard will tell you to beat it. Still pretty simple, right?

Let’s get a little more fancy then,¦ when the banners are raised, we want an object representing the banners loaded into the same room the guard and the PC are in. So:

if clan $n imperium
prog zecho The Imperium banners blow gently in the wind as the guards raise them high.
oload
sayto $n The banners have been raised as you commanded.
else
sayto $n And who are you to order me around? Go away before I cleave you in two!
endif

Less complicated than you’d think. I like to load any object, or mob before I give the final response that the job is completed, the system doesn’t care particularly, and it will all happen too fast for you to notice, but it makes more sense in my head to do things in that order.

Now, let’s go a step further. If the member of the imperium is a man, let’s tack a “sir” on the end of the statement and show some respect. If it’s a woman, we’ll say “ma’am”

if clan $n imperium
if sex $n == 1
prog zecho The Imperium banners blow gently in the wind as the guards raise them high.
oload
sayto $n The banners have been raised as you commanded, sir.
elseif sex $n == 2
prog zecho The Imperium banners blow gently in the wind as the guards raise them high.
oload
sayto $n The banners have been raised as you commanded, ma’am.
else
sayto $n And who are you to order me around? Go away before I cleave you in two!
endif
endif

And that’s it, we’ve gone from a very, very simple prog with no logic statements, to a versatile, moderately complex prog complete with logic.

Hopefully this was of some value in understanding the basics of progs and why we use them. I recommend that you look over some of the other sample progs to familiarize yourself with the logic statements and how they are used.

View Mob Prog Master Document