<spanid="evennia-contrib-grid-ingame-map-display-ingame-map-display"></span><h1>evennia.contrib.grid.ingame_map_display.ingame_map_display<aclass="headerlink"href="#module-evennia.contrib.grid.ingame_map_display.ingame_map_display"title="Permalink to this headline">¶</a></h1>
<p>Basic Map - helpme 2022</p>
<p>This adds an ascii <strong>map</strong> to a given room which can be viewed with the <strong>map</strong> command.
You can easily alter it to add special characters, room colors etc. The map shown is
dynamically generated on use, and supports all compass directions and up/down. Other
directions are ignored.</p>
<p>If you don’t expect the map to be updated frequently, you could choose to save the
calculated map as a .ndb value on the room and render that instead of running mapping
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.grid.ingame_map_display.ingame_map_display.</code><codeclass="sig-name descname">Map</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">caller</span></em>, <emclass="sig-param"><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">2</span></em>, <emclass="sig-param"><spanclass="n">location</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">__init__</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">caller</span></em>, <emclass="sig-param"><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">2</span></em>, <emclass="sig-param"><spanclass="n">location</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.__init__"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Initializes the map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>caller</strong> (<em>object</em>) – Any object, though generally a puppeted character.</p></li>
<li><p><strong>size</strong> (<em>int</em>) – The seed size of the map, which will be multiplied to get the final grid size.</p></li>
<li><p><strong>location</strong> (<em>object</em>) – The location at the map’s center (will default to caller.location if none provided).</p></li>
<codeclass="sig-name descname">create_grid</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.create_grid"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.create_grid"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the empty grid for the map based on the configured size</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p><em>list</em>– The created grid, a list of lists.</p>
<codeclass="sig-name descname">exit_name_as_ordinal</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">ex</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.exit_name_as_ordinal"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.exit_name_as_ordinal"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the exit name as a compass direction if possible</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>ex</strong> (<em>Exit</em>) – The current exit being mapped.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>string</em>– The exit name as a compass direction or an empty string.</p>
<codeclass="sig-name descname">update_pos</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em>, <emclass="sig-param"><spanclass="n">exit_name</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.update_pos"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.update_pos"title="Permalink to this definition">¶</a></dt>
<dd><p>Update the position pointer.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>room</strong> (<em>Room</em>) – The current location.</p></li>
<li><p><strong>exit_name</strong> (<em>str</em>) – The name of the exit to to use in this room. This must
be a valid compass direction, or an error will be raised.</p></li>
</ul>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><strong>KeyError</strong>– If providing a non-compass exit name.</p>
<codeclass="sig-name descname">has_drawn</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.has_drawn"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.has_drawn"title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the given room has already been drawn or not</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>room</strong> (<em>Room</em>) – Room to check.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>bool</em>– Whether or not the room has been drawn.</p>
<codeclass="sig-name descname">draw_room_on_map</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em>, <emclass="sig-param"><spanclass="n">max_distance</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.draw_room_on_map"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.draw_room_on_map"title="Permalink to this definition">¶</a></dt>
<dd><p>Draw the room and its exits on the map recursively</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>room</strong> (<em>Room</em>) – The room to draw out.</p></li>
<li><p><strong>max_distance</strong> (<em>int</em>) – How extensive the map is.</p></li>
<codeclass="sig-name descname">draw_exits</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.draw_exits"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.draw_exits"title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a given room’s exit paths</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>room</strong> (<em>Room</em>) – The room to draw exits of.</p>
<codeclass="sig-name descname">draw</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.draw"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.draw"title="Permalink to this definition">¶</a></dt>
<dd><p>Draw the map starting from a given room and add it to the cache of mapped rooms</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>room</strong> (<em>Room</em>) – The room to render.</p>
<codeclass="sig-name descname">start_loc_on_grid</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">room</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.start_loc_on_grid"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.start_loc_on_grid"title="Permalink to this definition">¶</a></dt>
<dd><p>Set the starting location on the grid based on the maximum width and length</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>room</strong> (<em>Room</em>) – The room to begin with.</p>
<codeclass="sig-name descname">show_map</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">debug</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#Map.show_map"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.Map.show_map"title="Permalink to this definition">¶</a></dt>
<dd><p>Create and show the map, piecing it all together in the end</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>debug</strong> (<em>bool</em>) – Whether or not to return the time taken to build the map.</p>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.grid.ingame_map_display.ingame_map_display.</code><codeclass="sig-name descname">CmdMap</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#CmdMap"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">key</code><emclass="property"> = 'map'</em><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap.key"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">func</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#CmdMap.func"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap.func"title="Permalink to this definition">¶</a></dt>
<dd><p>This is the hook function that actually does all the work. It is called
by the cmdhandler right after self.parser() finishes, and so has access
<codeclass="sig-name descname">aliases</code><emclass="property"> = []</em><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap.aliases"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">help_category</code><emclass="property"> = 'general'</em><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap.help_category"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">lock_storage</code><emclass="property"> = 'cmd:all();'</em><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.CmdMap.lock_storage"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.contrib.grid.ingame_map_display.ingame_map_display.</code><codeclass="sig-name descname">MapDisplayCmdSet</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">cmdsetobj</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">key</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#MapDisplayCmdSet"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">at_cmdset_creation</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/contrib/grid/ingame_map_display/ingame_map_display.html#MapDisplayCmdSet.at_cmdset_creation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet.at_cmdset_creation"title="Permalink to this definition">¶</a></dt>
<dd><p>Hook method - this should be overloaded in the inheriting
class, and should take care of populating the cmdset by use of
<codeclass="sig-name descname">path</code><emclass="property"> = 'evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet'</em><aclass="headerlink"href="#evennia.contrib.grid.ingame_map_display.ingame_map_display.MapDisplayCmdSet.path"title="Permalink to this definition">¶</a></dt>