<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://avendar.net/index.php?action=history&amp;feed=atom&amp;title=Avendar%3AProg_Section_1</id>
	<title>Avendar:Prog Section 1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://avendar.net/index.php?action=history&amp;feed=atom&amp;title=Avendar%3AProg_Section_1"/>
	<link rel="alternate" type="text/html" href="https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;action=history"/>
	<updated>2026-05-21T04:29:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.4</generator>
	<entry>
		<id>https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;diff=2680&amp;oldid=prev</id>
		<title>Elanthe at 03:18, 19 January 2025</title>
		<link rel="alternate" type="text/html" href="https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;diff=2680&amp;oldid=prev"/>
		<updated>2025-01-19T03:18:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;amp;diff=2680&amp;amp;oldid=2667&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Elanthe</name></author>
	</entry>
	<entry>
		<id>https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;diff=2667&amp;oldid=prev</id>
		<title>Elanthe: Created page with &quot;=Prog Structure and Practice=   &lt;i&gt;&quot;It&#039;s just a puzzle box.&quot;&lt;/i&gt;     -- Kirstie, Hellraiser  : Firstly, there are three classes of entities in the game which can have progs: Mobiles, : Objects, and Rooms. Broadly speaking, the syntax used on each of these prog types is the : same. Respectively, these are referred to as mobprogs, objprogs, or room progs. Over time, : the prog system has been rationalized so that the syntax for mpcommands and if checks is  : the same acros...&quot;</title>
		<link rel="alternate" type="text/html" href="https://avendar.net/index.php?title=Avendar:Prog_Section_1&amp;diff=2667&amp;oldid=prev"/>
		<updated>2025-01-19T03:07:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=Prog Structure and Practice=   &amp;lt;i&amp;gt;&amp;quot;It&amp;#039;s just a puzzle box.&amp;quot;&amp;lt;/i&amp;gt;     -- Kirstie, Hellraiser  : Firstly, there are three classes of entities in the game which can have progs: Mobiles, : Objects, and Rooms. Broadly speaking, the syntax used on each of these prog types is the : same. Respectively, these are referred to as mobprogs, objprogs, or room progs. Over time, : the prog system has been rationalized so that the syntax for mpcommands and if checks is  : the same acros...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Prog Structure and Practice=&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;i&amp;gt;&amp;quot;It&amp;#039;s just a puzzle box.&amp;quot;&amp;lt;/i&amp;gt; &lt;br /&gt;
   -- Kirstie, Hellraiser&lt;br /&gt;
&lt;br /&gt;
: Firstly, there are three classes of entities in the game which can have progs: Mobiles,&lt;br /&gt;
: Objects, and Rooms. Broadly speaking, the syntax used on each of these prog types is the&lt;br /&gt;
: same. Respectively, these are referred to as mobprogs, objprogs, or room progs. Over time,&lt;br /&gt;
: the prog system has been rationalized so that the syntax for mpcommands and if checks is &lt;br /&gt;
: the same across the type of entity. &amp;quot;Mobprog&amp;quot; is therefore often used to refer to the general&lt;br /&gt;
: class of all prog types, and this is the usage which will be employed in this document. Every&lt;br /&gt;
: prog has the following structure:&lt;br /&gt;
&lt;br /&gt;
   [prog_trigger] [modifier] [argument]&lt;br /&gt;
   Body of Prog: &lt;br /&gt;
   {&lt;br /&gt;
   (Control structures)&lt;br /&gt;
   (Commands)&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
: It isn&amp;#039;t immediately obvious by what we mean by all these terms, so let&amp;#039;s try to clarify them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;prog_trigger&amp;lt;/b&amp;gt;&lt;br /&gt;
:  The prog_trigger reflects a central fact about progs: All progs are, in fact, a set of actions&lt;br /&gt;
:  which occur in response to a triggering event. What a trigger really says is, &amp;quot;Execute the &lt;br /&gt;
:  commands that are in my body when conditions matching my trigger are met&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
:  To take a concrete example, consider the following prog_trigger:&lt;br /&gt;
&lt;br /&gt;
:    Greet_prog:&lt;br /&gt;
:    Syntax: greet_prog &amp;lt;Percentage value from 1-100&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:  A greet_prog triggers whenever a pc enters the room with the object/room/mob. The chance that &lt;br /&gt;
:  the greet prog triggers is equal to the percentage value given as an argument. &lt;br /&gt;
&lt;br /&gt;
:    Ex:&lt;br /&gt;
:    greet_prog 50&lt;br /&gt;
:    say Hello there!&lt;br /&gt;
&lt;br /&gt;
:  So, this mob has a 50% chance any time a pc enters the room of triggering the prog, at which&lt;br /&gt;
:  point the pc will see the mob saying &amp;quot;Hello there!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:  Another example of a prog trigger which does not have a percentage argument is the speech_prog.&lt;br /&gt;
&lt;br /&gt;
:  Syntax: speech_prog [p] [argument]&lt;br /&gt;
&lt;br /&gt;
:  Speech_prog triggers if [argument] is said aloud in the same room as mobile or object. The &amp;quot;p&amp;quot; &lt;br /&gt;
:  determines whether or not the match must be exact or simply a substring match. If no argument is &lt;br /&gt;
:  specified, the speech_prog will trigger on any speech at all.&lt;br /&gt;
&lt;br /&gt;
:    Ex: &lt;br /&gt;
:    speech_prog p Hello&lt;br /&gt;
:    say Hi there!&lt;br /&gt;
&lt;br /&gt;
:  Now, a mobile with this program would respond whenever someone said &amp;quot;hello&amp;quot; to the mob. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;The Prog Body:&amp;lt;/b&amp;gt;&lt;br /&gt;
:  The body of the prog is where the &amp;#039;meat&amp;#039; of the prog resides. Broadly speaking, you will find&lt;br /&gt;
:  two types of things within the body:&lt;br /&gt;
&lt;br /&gt;
:    Commands&lt;br /&gt;
:    Control Structures&lt;br /&gt;
&lt;br /&gt;
==(i) Commands==&lt;br /&gt;
&lt;br /&gt;
:   Commands are actions that the mob can perform. As a general rule, mobiles can perform any &lt;br /&gt;
:   action a player can that does not involve the use of a skill or spell. [They can do these&lt;br /&gt;
:   as well, but it requires a special other thing to be done first.]&lt;br /&gt;
&lt;br /&gt;
:   In addition to these normal commands, there are a suite of prog-specific commands. These &lt;br /&gt;
:   commands are designed to allow progs to duplicate imm commands, player skills or spells, or to &lt;br /&gt;
:   just generally do interesting things. To take a concrete example, consider the following prog&lt;br /&gt;
:   specific command:&lt;br /&gt;
&lt;br /&gt;
:     mpgoto:&lt;br /&gt;
:     Syntax: mpgoto &amp;lt;vnum&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:   When executed from within a mob prog, mpgoto causes the mobile in question to goto the room&lt;br /&gt;
:   with vnum specified. Taking the examples we&amp;#039;ve seen, we can construct a very simple prog:&lt;br /&gt;
&lt;br /&gt;
:     greet_prog 100&lt;br /&gt;
:     say Oh no, people!&lt;br /&gt;
:     mpgoto 5000&lt;br /&gt;
&lt;br /&gt;
:   In the above prog, &amp;quot;greet_prog&amp;quot; is the prog trigger, and the say and the mpgoto are examples &lt;br /&gt;
:   of commands. This prog basically says, &amp;quot;Whenever someone enters the same room as this mob, &lt;br /&gt;
:   have it say &amp;quot;Oh no, people!&amp;quot;, then have the mob goto room 5000&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
:   This is a very basic prog, but might be used on a mischievous imp or forest spirit. [And a &lt;br /&gt;
:   cunning player would go to room 5000, and ambush the imp there!] There are many, many different&lt;br /&gt;
:   mpcommands, so we&amp;#039;ll detail those in their own chapter. &lt;br /&gt;
&lt;br /&gt;
==(ii) Control Structures==&lt;br /&gt;
&lt;br /&gt;
:   Normally, commands in the body of a prog are executed in linear order. I.e., if we have a prog:&lt;br /&gt;
&lt;br /&gt;
:     prog_trigger&lt;br /&gt;
:     command 1&lt;br /&gt;
:     command 2&lt;br /&gt;
:     command 3&lt;br /&gt;
&lt;br /&gt;
:   When the prog triggers, it will execute command 1, then command 2, then command 3, and so on, line&lt;br /&gt;
:   by line, from top to bottom. &lt;br /&gt;
&lt;br /&gt;
:   Control structures allow us to control the natural order of prog execution. Structures exist to &lt;br /&gt;
:   allow for logical branching, multiple conditionals, looping, subroutines, and numerous other &lt;br /&gt;
:   functions. To take a concrete example, consider the &amp;quot;loop&amp;quot; statement:&lt;br /&gt;
&lt;br /&gt;
:     Loop:&lt;br /&gt;
:     Syntax: loop &amp;lt;lower number&amp;gt; to &amp;lt;higher number&amp;gt;&lt;br /&gt;
:     [Body of loop]&lt;br /&gt;
:     endloop&lt;br /&gt;
&lt;br /&gt;
:   The loop structure, like its name implies, will loop through the body of the loop, executing the &lt;br /&gt;
:   lines within for every iteration of the loop. So, consider the following prog:&lt;br /&gt;
&lt;br /&gt;
:     greet_prog 100&lt;br /&gt;
:     loop 1 to 3&lt;br /&gt;
:     say Hey Hey!&lt;br /&gt;
:     endloop&lt;br /&gt;
&lt;br /&gt;
:   This prog will trigger when someone enters the room. It will then hit the loop, so it will &lt;br /&gt;
:   execute its contents three times. So, if I enter a room with a mob who had this prog, I will &lt;br /&gt;
:   see:&lt;br /&gt;
&lt;br /&gt;
:     Mob says, &amp;#039;Hey Hey!&amp;#039; [this is when the loop is on 1]&lt;br /&gt;
:     Mob says, &amp;#039;Hey Hey!&amp;#039; [this is when the loop is on 2]&lt;br /&gt;
:     Mob says, &amp;#039;Hey Hey!&amp;#039; [this is when the loop is on 3]&lt;br /&gt;
&lt;br /&gt;
:   Later, we&amp;#039;ll give control structures their own chapter. But for right now, the important thing&lt;br /&gt;
:   is to realize is that the default behavior for a prog is to execute its commands in order, and &lt;br /&gt;
:   control structures exist to change the order in which commands are executed.&lt;/div&gt;</summary>
		<author><name>Elanthe</name></author>
	</entry>
</feed>