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 object, go to the Objects Tutorial first, then come back here for prog basics.
Desc: (null) Vnum: [105] Involved: FALSE Debug: FALSE Code: | Creating a Random ProgWhat is all that gibberish on the left? That is a prog that is set up to send random messages to the room through an echo. This type of prog can also be used to make mobs do random emotes, make random comments, create random noises in a room, etc. if rand 10 is the line that basically tells us if it’s time for the 10% random chance for this prog to go off, then I want whatever follows it to happen. You can add as many different IF sections as you want, there’s really no limit. prog echo is how a prog can make an echo in that particular room. This is also where on an mprog you could have the mob do a random emote (just emote [text]), or a random say (just say [text]). You can put multiple lines after the if rand 10 statement. One line could be a mob doing an emote, the next line could be the mob doing a say. Just remember they all happen in succession so large strings of actions/talks/echos could be seen as 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 rand 10 lines with. For every IF we have to have an ENDIF. So if you have 5 random things going off, then have 5 endifs at the end of the prog. Note:10% is really as fast as we want most random progs to fire off. If there’s a good reason for them to happen more often, you can raise the percentage, otherwise keep it at 10 and below. 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: [woven bone necklace tribal pendant] Area: [ 6] Immortal Realms Vnum: [ 121] Type: [clothing] Level: [ 55] Wear Loc: [neck] Extra flags: [no_drop] Perm Spell: [nothing] Activation: [never] Act chance: [0%] Material: [none] Condition: [ 100] Weight: [ 1] Cost: [10000] Size: [all] Ex desc kwd: [none] Short desc: a woven bone necklace with tribal markings Long desc: A woven bone necklace with tribal markings has been left here.
| Adding the above prog to a room, mob, or objectOur next step, once we have all our different random commands ready in the prog above, is to add it to the room, mob, or object. To do so, have your room, mob, or object handy. I’ll use an object for an example, so we would type: addoprog 121 random 5. Which addprog and the vnum should already be explained in the prog basics tutorial. random just means we are adding a random trigger to this object, and it will go off 5% of the time. But how is this different than the if rand 10 I already put in the prog? For simplicity sake, you may just want to make the random percentage the same value in the prog and when you add it to something. |
[ Download Rain’s .xls file (modified by Teran 05/2009) ] (right click, save as) | Rain’s Random Chance SpreadsheetRain has also created a small spreadsheet that you can download to the left, that sorta helps with creating random chance progs that are always supposed to fire, and should have several parts that have equal chance of firing. He writes: It works simply. Once you’ve decided how many possible outcomes there are. You go to the chart and choose the number of parts you are going to use. Let’s say a coin toss. That has two parts so you choose two. The chart then tells you how many if rands you are going to use. (in this case 1). And what percentage to use with those if rands in what order. The last part always just uses else with no if rand. So for instance in this case the chart would tell you to do something like, prog echo The coin lands and reveals the heads side up. break else prog echo The coin lands and reveals the tails side up. And both outcomes have an equal chance of firing. The chart will allow you to create a prog with 12 different outcomes with an equal chance of firing.” |
To exit the object editor, type: done
And be sure to -always- save your area by typing: edit area, asave area, done