Games-Axmud
view release on metacpan or search on metacpan
share/docs/tutorial/ch13.html view on Meta::CPAN
</code></pre>
<p>Often you can move between two adjacent rooms by going <strong>north</strong> and then <strong>south</strong> again. This pair of exits are called <em>twin exits</em>. We can find an exit's twin like this:</p>
<pre><code> LET twin_exit_num = Getexittwin (exit_num)
</code></pre>
<p>The <a href="../guide/index.html">Axmud Guide</a> describes various exit <em>types</em>, such as <em>incomplete</em>, <em>unallocated</em> and <em>impassable</em>. The following function returns a string describing the exit type.</p>
<pre><code> LET exit_type$ = Getexittype$ (exit_num)
</code></pre>
<p>You might also find the <strong>Getexitstatus$ ()</strong> function useful for working out which exits are connected to rooms in different regions.</p>
<p>An exit in the direction <strong>portal</strong> might actually be drawn on the map as a <strong>north</strong> exit. An actual <strong>north</strong> exit is <em>definitely</em> drawn on the map as a <strong>north</strong> exit. To get the direc...
<pre><code> LET dir$ = Getexitdrawn$ (exit_num)
</code></pre>
<p>You can test whether an exit still exists using the <strong>Isexit ()</strong> function. The function returns 1 if the numbered exit exists, or 0 if it doesn't.</p>
<pre><code> LET result = Isexit (exit_num)
</code></pre>
<p>Exits can be deleted, if necessary, with the <strong>Delexit ()</strong> function.</p>
<pre><code> LET result = Delexit (exit_num)
</code></pre>
<h2><a name="13.8">13.8 Retrieving room data</a></h2>
<p>The following functions apply to the automapper's current room. To get the room's model number:</p>
<pre><code> LET number = Getroomnum ()
</code></pre>
<p>To get the room's title (brief description):</p>
<pre><code> LET title$ = Getroomtitle$ ()
</code></pre>
<p>To get the room's verbose description, stored as a single string (even if it was received as multiple lines of text):</p>
<pre><code> LET descrip$ = Getroomdescrip$ ()
</code></pre>
<p>To get the room tag or the room guild (or an empty string, if the current room has no room tag or room guild):</p>
<pre><code> LET tag$ = Getroomtag$ ()
LET guild$ = Getroomguild$ ()
</code></pre>
<p>You can test whether a room still exists using the <strong>Isroom ()</strong> function. The function returns 1 if the numbered room exists, or 0 if it doesn't.</p>
<pre><code> LET result = Isroom (number)
</code></pre>
<p>Rooms can be deleted, if necessary, with the <strong>Delroom ()</strong> function.</p>
<pre><code> LET result = Delroom (number)
</code></pre>
<h2><a name="13.9">13.9 Room contents</a></h2>
<p>The Locator task is capable of extracting a room's current contents. This doesn't work at most worlds, because few MUDs display the contents list in an unambiguous way. However, if the information is available to the Locator task, it's available t...
<p>The <strong>Getroomobjects ()</strong> returns the number of objects in the current room.</p>
<pre><code> LET count = Getroomobjects ()
</code></pre>
<p>If you want to, you can restrict that list to the number of sentient beings, or the number of weapons, and so on.</p>
<pre><code> LET count = Getroomobjects ("sentient")
LET count = Getroomobjects ("weapon")
</code></pre>
<p><strong>Getroomobjects () </strong> only accepts a limited selection of strings: <strong>"weapon"</strong>, <strong>"armour"</strong>, <strong>"garment"</strong>, <strong>"char"</strong> (for characters), <strong>"minion"</strong>, <strong>"sentie...
<p>In a room containing three objects, those objects are numbered 1 to 3. We can retrieve the strings <strong>"big axe"</strong>, <strong>"smelly orc"</strong> and <strong>"pile of treasure"</strong> using the following lines:</p>
<pre><code> PRINT Getobject$ (1)
PRINT Getobject$ (2)
PRINT Getobject$ (3)
</code></pre>
<p>We can also retrieve each object's type, in this case the strings <strong>"weapon"</strong>, <strong>"sentient" and "portable"</strong>:</p>
<pre><code> PRINT Getobjecttype$ (1)
...
</code></pre>
<p>We can furthermore retrieve the main noun, in this case the strings <strong>"axe"</strong>, <strong>"orc"</strong> and <strong>"treasure"</strong>:</p>
<pre><code> PRINT Getobjectnoun$ (1)
...
</code></pre>
<p>This function will tell us whether Axmud believes the object is alive, or not. The function returns 1 for living beings and 0 for everything else, possibly including any nasty monsters you've recently dispatched to the afterlife:</p>
<pre><code> PRINT Getobjectalive (1)
...
</code></pre>
<p>Axmud might store <strong>10 gold coins</strong> as a single object, or as ten separate ones, depending on the current world profile's settings. In this case, the functions <strong>Getroomobjects ()</strong> and <strong>Getobjectcount ()</strong> ...
<pre><code> ! Display 1, because Axmud has stored the gold coins
! as a single object
PRINT Getroomobjects (1)
! Display the actual number of objects in the game,
! which is 10
PRINT Getobjectcount (1)
</code></pre>
<h2><a name="13.10">13.10 Other automapper functions</a></h2>
<p>There are few more functions to cover.</p>
<p>A direction like <strong>"north"</strong> can be abbreviated to <strong>"n"</strong> using the <strong>Abbrevdir$ ()</strong> function, and restored using the <strong>Unabbrevdir$ ()</strong> function.</p>
<pre><code> LET dir$ = "north"
LET abbrev$ = Abbrevdir (dir$)
PRINT abbrev$
LET old$ = Unabbrevdir (abbrev$)
PRINT old$
</code></pre>
<p>REVPATH (a statement, not a function) takes an array of movement commands, and reverses them, transforming <strong>north northwest up east</strong> into <strong>west down southeast south</strong>. Here's an example.</p>
<pre><code> DATA "north", "northwest", "up", "east"
DIM stuff$ (4)
FOR a = 1 TO 4
READ stuff$ (a)
NEXT a
REVPATH stuff$
FOR a = 1 TO 4
PRINT stuff$ (a)
NEXT a
</code></pre>
<p>If a room's description is different during daylight and at night, Axmud can store both descriptions. You can use the <strong>Setlight ()</strong> function to set Axmud's current <em>light status</em>, and you can use the <strong>Getlight$ ()</str...
<p>(The default values for Axmud's light status are <strong>"day"</strong>, <strong>"night"</strong> and <strong>"dark"</strong>. The light status is <strong>"day"</strong> unless it has been changed to another value.)</p>
<p>If you have administrative privileges at your MUD, your map may contain the path to each room's source code file. This path can be retrieved with the <strong>Getroomsource$ ()</strong> function.</p>
<p>If you've added a lot of room tags to the rooms in your map, you can set the current room using a room tag rather than with a model number.</p>
<pre><code>LET result = Setroomtagged ("bank")
</code></pre>
<p>Finally, when the automapper gets lost, if remembers the room that used to be the current room. The model number of that room can be retrieved with the <strong>Getlostroom ()</strong> function.</p>
<hr>
<p><a href="ch12.html">Previous</a> <a href="index.html">Index</a> <a href="ch14.html">Next</a></p>
</body>
</html>
( run in 1.261 second using v1.01-cache-2.11-cpan-39bf76dae61 )