<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fexit_key</id>
	<title>Manual:DIL Manual/exit key - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fexit_key"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/exit_key&amp;action=history"/>
	<updated>2026-11-22T21:28:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/exit_key&amp;diff=2933&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/exit_key&amp;diff=2933&amp;oldid=prev"/>
		<updated>2026-11-14T23:13:46Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= exit_key =&lt;br /&gt;
'''Field''' (string, read/write; units: rooms).&lt;br /&gt;
&lt;br /&gt;
 room.exit_key[dir] : string&lt;br /&gt;
&lt;br /&gt;
The key that locks and unlocks the room's exit in direction &amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt;, as &amp;lt;code&amp;gt;&amp;quot;keyname@zone&amp;quot;&amp;lt;/code&amp;gt; in lower case, set with &amp;lt;code&amp;gt;key&amp;lt;/code&amp;gt; on the exit in the zone file. Empty when the exit has no key. The lock and unlock commands in basemove.zon look for a unit with this symbolic name in the player's inventory, and say &amp;quot;you can't seem to find a keyhole&amp;quot; when it is empty.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; is a direction from vme.h: &amp;lt;code&amp;gt;NORTH&amp;lt;/code&amp;gt; (0) to &amp;lt;code&amp;gt;SOUTHWEST&amp;lt;/code&amp;gt; (9), &amp;lt;code&amp;gt;MAX_EXIT&amp;lt;/code&amp;gt; being the last.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* It fails when the unit is not a room, when &amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; is outside 0 to &amp;lt;code&amp;gt;MAX_EXIT&amp;lt;/code&amp;gt;, and when the room has no exit that way (so it is not &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; then). Test the exit with [[Manual:DIL Manual/exit to|exit_to]] first.&lt;br /&gt;
* Assigning a string replaces the key; assigning &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt; leaves the exit without one. No access level is needed.&lt;br /&gt;
* Whether the exit can be locked at all is in [[Manual:DIL Manual/exit info|exit_info]] (&amp;lt;code&amp;gt;EX_OPEN_CLOSE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;EX_LOCKED&amp;lt;/code&amp;gt;). An object's own key is the [[Manual:DIL Manual/key|key]] field.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin integer has_exit_key(pc : unitptr, room : unitptr, dir : integer);&lt;br /&gt;
var&lt;br /&gt;
   k : unitptr;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   if (not room.exit_to[dir])&lt;br /&gt;
      return (FALSE);&lt;br /&gt;
   if (room.exit_key[dir] == &amp;quot;&amp;quot;)&lt;br /&gt;
      return (FALSE);&lt;br /&gt;
   k := findsymbolic(pc, room.exit_key[dir], FIND_UNIT_IN_ME);&lt;br /&gt;
   return (k != null);&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Tells whether a player carries the key to a door, as lock and unlock do in basemove.zon.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/exit info|exit_info]]&lt;br /&gt;
* [[Manual:DIL Manual/exit to|exit_to]]&lt;br /&gt;
* [[Manual:DIL Manual/key|key]]&lt;br /&gt;
* [[Manual:DIL Manual/findsymbolic()|findsymbolic()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>