<h1>Scripting Capabilities<aclass="headerlink"href="#scripting-capabilities"title="Permalink to this headline">¶</a></h1>
<p>Porymap is extensible via scripting capabilities. This allows the user to write custom JavaScript (technically, ECMAScript) files to support enhanced workflows, without having to fork Porymap itself. While the possibilities are endless, some useful examples of scripting might be:</p>
<ulclass="simple">
<li><p>Toggle Day/Night Palettes</p></li>
<li><p>Custom Map Painting Brushes</p></li>
<li><p>Detect Tile Errors</p></li>
<li><p>Show Diagonistic Information</p></li>
<li><p>Procedurally Generated Maps</p></li>
<li><p>Randomize Grass Patterns</p></li>
</ul>
<divclass="section"id="writing-a-custom-script">
<h2>Writing a Custom Script<aclass="headerlink"href="#writing-a-custom-script"title="Permalink to this headline">¶</a></h2>
<p>Let’s write a custom script that will randomize grass patterns when the user is editing the map. This is useful, since it’s cumbersome to manually add randomness to grass patches. With the custom script, it will happen automatically. Whenever the user paints a grass tile onto the map, the script will overwrite the tile with a random grass tile instead.</p>
<p>First, create a new script file called <codeclass="docutils literal notranslate"><spanclass="pre">my_script.js</span></code>–place it in the project directory (e.g. <codeclass="docutils literal notranslate"><spanclass="pre">pokefirered/</span></code>).</p>
<p>Next, open the Porymap project config file, <codeclass="docutils literal notranslate"><spanclass="pre">porymap.project.cfg</span></code>, in the project directory. Add the script file to the <codeclass="docutils literal notranslate"><spanclass="pre">custom_scripts</span></code> configuration value. Multiple script files can be loaded by separating the filepaths with a comma.</p>
<p>Now that Porymap is configured to load the script file, let’s write the actual code that will power the grass-randomizer. Scripts have access to several “callbacks” for events that occur while Porymap is running. This means our script can define functions for each of these callbacks. We’re interested in the <codeclass="docutils literal notranslate"><spanclass="pre">onBlockChanged()</span></code> callback, since we want our script to take action whenever a user paints a block on the map.</p>
<divclass="highlight-js notranslate"><divclass="highlight"><pre><span></span><spanclass="c1">// Porymap callback when a block is painted.</span>
<p>It’s very <strong>important</strong> to remember to <codeclass="docutils literal notranslate"><spanclass="pre">export</span></code> the callback functions in the script. Otherwise, Porymap will not be able to execute them.</p>
<p>In addition to the callbacks, Porymap also supports a scripting API so that the script can interact with Porymap in interesting ways. For example, a script can change a block or add overlay text on the map. Since we want to paint random grass tiles, we’ll be using the <codeclass="docutils literal notranslate"><spanclass="pre">map.setMetatileId()</span></code> function. Let’s fill in the rest of the grass-randomizing code.</p>
<p>Let’s test the script out by re-launching Porymap. If we try to paint grass on the map, we should see our script inserting a nice randomized grass pattern.</p>
<p>The grass-randomizer script above happens implicitly when the user paints on the map. However, other times we probably want to call the custom script on demand. One of the API functions Porymap provides is the ability to trigger scripting functions from the <codeclass="docutils literal notranslate"><spanclass="pre">Tools</span></code> menu, or a keyboard shortcut. To do this, we will usually want to register the action when the project loads. Here is an example script where some custom actions are registered.</p>
<spanclass="nx">map</span><spanclass="p">.</span><spanclass="nx">registerAction</span><spanclass="p">(</span><spanclass="s2">"applyNightTint"</span><spanclass="p">,</span><spanclass="s2">"View Night Tint"</span><spanclass="p">,</span><spanclass="s2">"T"</span><spanclass="p">)</span>
<spanclass="p">}</span>
</pre></div>
</div>
<p>Then, to trigger the <codeclass="docutils literal notranslate"><spanclass="pre">applyNightTint()</span></code> function, we could either click <codeclass="docutils literal notranslate"><spanclass="pre">Tools</span><spanclass="pre">-></span><spanclass="pre">View</span><spanclass="pre">Night</span><spanclass="pre">Tint</span></code> or use the <codeclass="docutils literal notranslate"><spanclass="pre">T</span></code> keyboard shortcut.</p>
<p>Now that we have an overview of how to utilize Porymap’s scripting capabilities, the entire scripting API is documented below.</p>
</div>
<divclass="section"id="scripting-api">
<h2>Scripting API<aclass="headerlink"href="#scripting-api"title="Permalink to this headline">¶</a></h2>
<divclass="section"id="callbacks">
<h3>Callbacks<aclass="headerlink"href="#callbacks"title="Permalink to this headline">¶</a></h3>
<codeclass="sig-name descname">onProjectOpened</code><spanclass="sig-paren">(</span><emclass="sig-param">projectPath</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onProjectOpened"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when Porymap successfully opens a project.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>projectPath</strong> (<em>string</em>) – the directory path of the opened project</p></li>
<codeclass="sig-name descname">onProjectClosed</code><spanclass="sig-paren">(</span><emclass="sig-param">projectPath</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onProjectClosed"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when Porymap closes a project. For example, this is called when opening a different project.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>projectPath</strong> (<em>string</em>) – the directory path of the closed project</p></li>
<codeclass="sig-name descname">onMapOpened</code><spanclass="sig-paren">(</span><emclass="sig-param">mapName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onMapOpened"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a map is opened.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>mapName</strong> (<em>string</em>) – the name of the opened map</p></li>
<codeclass="sig-name descname">onBlockChanged</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em>, <emclass="sig-param">prevBlock</em>, <emclass="sig-param">newBlock</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onBlockChanged"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a block is changed on the map. For example, this is called when a user paints a new tile or changes the collision property of a block.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
<li><p><strong>prevBlock</strong> (<em>object</em>) – the block’s state before it was modified. The object’s shape is <codeclass="docutils literal notranslate"><spanclass="pre">{metatileId,</span><spanclass="pre">collision,</span><spanclass="pre">elevation,</span><spanclass="pre">rawValue}</span></code></p></li>
<li><p><strong>newBlock</strong> (<em>object</em>) – the block’s new state after it was modified. The object’s shape is <codeclass="docutils literal notranslate"><spanclass="pre">{metatileId,</span><spanclass="pre">collision,</span><spanclass="pre">elevation,</span><spanclass="pre">rawValue}</span></code></p></li>
<codeclass="sig-name descname">onBlockHoverChanged</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onBlockHoverChanged"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the mouse enters a new map block.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="onBlockHoverCleared">
<codeclass="sig-name descname">onBlockHoverCleared</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#onBlockHoverCleared"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the mouse exits the map.</p>
</dd></dl>
<dlclass="js function">
<dtid="onMapResized">
<codeclass="sig-name descname">onMapResized</code><spanclass="sig-paren">(</span><emclass="sig-param">oldWidth</em>, <emclass="sig-param">oldHeight</em>, <emclass="sig-param">newWidth</em>, <emclass="sig-param">newHeight</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onMapResized"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the dimensions of the map are changed.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>oldWidth</strong> (<em>number</em>) – the width of the map before the change</p></li>
<li><p><strong>oldHeight</strong> (<em>number</em>) – the height of the map before the change</p></li>
<li><p><strong>newWidth</strong> (<em>number</em>) – the width of the map after the change</p></li>
<li><p><strong>newHeight</strong> (<em>number</em>) – the height of the map after the change</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="onMapShifted">
<codeclass="sig-name descname">onMapShifted</code><spanclass="sig-paren">(</span><emclass="sig-param">xDelta</em>, <emclass="sig-param">yDelta</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onMapShifted"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the map is updated by use of the Map Shift tool.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>xDelta</strong> (<em>number</em>) – the horizontal change from the shift</p></li>
<li><p><strong>yDelta</strong> (<em>number</em>) – the vertical change from the shift</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="onTilesetUpdated">
<codeclass="sig-name descname">onTilesetUpdated</code><spanclass="sig-paren">(</span><emclass="sig-param">tilesetName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onTilesetUpdated"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the currently loaded tileset is changed by switching to a new one or by saving changes to it in the Tileset Editor.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tilesetName</strong> (<em>string</em>) – the name of the updated tileset</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="onMainTabChanged">
<codeclass="sig-name descname">onMainTabChanged</code><spanclass="sig-paren">(</span><emclass="sig-param">oldTab</em>, <emclass="sig-param">newTab</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onMainTabChanged"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the selected tab in the main tab bar is changed. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Map, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Events, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Header, <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code>: Connections, <codeclass="docutils literal notranslate"><spanclass="pre">4</span></code>: Wild Pokemon).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>oldTab</strong> (<em>number</em>) – the index of the previously selected tab</p></li>
<li><p><strong>newTab</strong> (<em>number</em>) – the index of the newly selected tab</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="onMapViewTabChanged">
<codeclass="sig-name descname">onMapViewTabChanged</code><spanclass="sig-paren">(</span><emclass="sig-param">oldTab</em>, <emclass="sig-param">newTab</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#onMapViewTabChanged"title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the selected tab in the map view tab bar is changed. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Metatiles, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Collision).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>oldTab</strong> (<em>number</em>) – the index of the previously selected tab</p></li>
<li><p><strong>newTab</strong> (<em>number</em>) – the index of the newly selected tab</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getBlock</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getBlock"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a block in the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileId</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileId"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the metatile id of a block in the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the metatile id of the block</p>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getCollision</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getCollision"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the collision of a block in the currently-opened map. (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> = passable, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code> = impassable)</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the collision of the block</p>
<dd><p>Sets the collision of a block in the currently-opened map. (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> = passable, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code> = impassable)</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
<li><p><strong>collision</strong> (<em>number</em>) – the collision of the block</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getElevation</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getElevation"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the elevation of a block in the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>x</strong> (<em>number</em>) – x coordinate of the block</p></li>
<li><p><strong>y</strong> (<em>number</em>) – y coordinate of the block</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the elevation of the block</p>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<li><p><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. When making many related map edits, it can be useful to set this to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, and then commit all of them together with <codeclass="docutils literal notranslate"><spanclass="pre">map.commit()</span></code>.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getDimensions</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getDimensions"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the dimensions of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns {width, height}</dt>
<ddclass="field-odd"><p>the dimensions of the map</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getWidth</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getWidth"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the width of the currently-opened map.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getHeight</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getHeight"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the height of the currently-opened map.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setDimensions</code><spanclass="sig-paren">(</span><emclass="sig-param">width</em>, <emclass="sig-param">height</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setDimensions"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the dimensions of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>width</strong> (<em>number</em>) – width in blocks</p></li>
<li><p><strong>height</strong> (<em>number</em>) – height in blocks</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setWidth</code><spanclass="sig-paren">(</span><emclass="sig-param">width</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setWidth"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the width of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>width</strong> (<em>number</em>) – width in blocks</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setHeight</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setHeight"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the height of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>height</strong> (<em>number</em>) – height in blocks</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">redraw</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.redraw"title="Permalink to this definition">¶</a></dt>
<dd><p>Redraws the entire map area. Useful when delaying map redraws using <codeclass="docutils literal notranslate"><spanclass="pre">forceRedraw</span><spanclass="pre">=</span><spanclass="pre">false</span></code> in certain map editing functions.</p>
</dd></dl>
<dlclass="js function">
<dtid="map.commit">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">commit</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.commit"title="Permalink to this definition">¶</a></dt>
<dd><p>Commits any uncommitted changes to the map’s edit/undo history. Useful when delaying commits using <codeclass="docutils literal notranslate"><spanclass="pre">commitChanges</span><spanclass="pre">=</span><spanclass="pre">false</span></code> in certain map editing functions.</p>
<p>The following functions are related to an overlay that is drawn on top of the map area. Text, images, and shapes can be drawn using these functions. Items can be drawn and manipulated on separate layers by specifiying a layer id. Items on higher layer ids will be drawn above those on lower layers. If no layer is specified they will be added to the default layer <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>. The visibility and position of each layer can be changed; by default all layers are visible, and their position is <codeclass="docutils literal notranslate"><spanclass="pre">0,0</span></code>.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">clearOverlay</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.clearOverlay"title="Permalink to this definition">¶</a></dt>
<dd><p>Clears and erases all overlay items on the specified layer that were previously-added to the map.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">clearOverlays</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.clearOverlays"title="Permalink to this definition">¶</a></dt>
<dd><p>Clears and erases all overlay items that were previously-added to the map.</p>
</dd></dl>
<dlclass="js function">
<dtid="map.hideOverlay">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">hideOverlay</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.hideOverlay"title="Permalink to this definition">¶</a></dt>
<dd><p>Hides all overlay items on the specified layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">hideOverlays</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.hideOverlays"title="Permalink to this definition">¶</a></dt>
<dd><p>Hides all overlay items on all active layers.</p>
</dd></dl>
<dlclass="js function">
<dtid="map.showOverlay">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">showOverlay</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.showOverlay"title="Permalink to this definition">¶</a></dt>
<dd><p>Shows all overlay items on the specified layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">showOverlays</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.showOverlays"title="Permalink to this definition">¶</a></dt>
<dd><p>Shows all overlay items on all active layers.</p>
</dd></dl>
<dlclass="js function">
<dtid="map.getOverlayVisibility">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getOverlayVisibility</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getOverlayVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified overlay layer is currently showing or not.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlayVisibility</code><spanclass="sig-paren">(</span><emclass="sig-param">visible</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlayVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlaysVisibility</code><spanclass="sig-paren">(</span><emclass="sig-param">visible</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlaysVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of all active overlay layers.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getOverlayX</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getOverlayX"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the x position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getOverlayY</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getOverlayY"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the y position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlayX</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlayX"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the x position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlayY</code><spanclass="sig-paren">(</span><emclass="sig-param">y</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlayY"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the y position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlaysX</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlaysX"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the x position of all active overlay layers.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlaysY</code><spanclass="sig-paren">(</span><emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlaysY"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the y position of all active overlay layers.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getOverlayPosition</code><spanclass="sig-paren">(</span><emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getOverlayPosition"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlayPosition</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlayPosition"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the position of the specified overlay layer.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setOverlaysPosition</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setOverlaysPosition"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the position of all active overlay layers.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">moveOverlay</code><spanclass="sig-paren">(</span><emclass="sig-param">deltaX</em>, <emclass="sig-param">deltaY</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.moveOverlay"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">moveOverlays</code><spanclass="sig-paren">(</span><emclass="sig-param">deltaX</em>, <emclass="sig-param">deltaY</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.moveOverlays"title="Permalink to this definition">¶</a></dt>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>width</strong> (<em>number</em>) – the pixel width of the rectangle</p></li>
<li><p><strong>height</strong> (<em>number</em>) – the pixel height of the rectangle</p></li>
<li><p><strong>color</strong> (<em>string</em>) – the color of the rectangle. Can be specified as “#RRGGBB” or “#AARRGGBB”. Defaults to black.</p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>width</strong> (<em>number</em>) – the pixel width of the rectangle</p></li>
<li><p><strong>height</strong> (<em>number</em>) – the pixel height of the rectangle</p></li>
<li><p><strong>color</strong> (<em>string</em>) – the color of the rectangle. Can be specified as “#RRGGBB” or “#AARRGGBB”. Defaults to black.</p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>filepath</strong> (<em>string</em>) – the image’s filepath</p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>useCache</strong> (<em>boolean</em>) – whether the image should be saved/loaded using the cache. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Reading images from a file is slow. Setting <codeclass="docutils literal notranslate"><spanclass="pre">useCache</span></code> to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> will save the image to memory so that the next time the filepath is encountered the image can be loaded from memory rather than the file.</p></li>
<dd><p>Creates an image item on the specified overlay layer. This differs from <codeclass="docutils literal notranslate"><spanclass="pre">map.addImage</span></code> by allowing the new image to be a transformation of the image file.</p>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>filepath</strong> (<em>string</em>) – the image’s filepath</p></li>
<li><p><strong>width</strong> (<em>number</em>) – the image width. If <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, use the full width of the original image. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code></p></li>
<li><p><strong>height</strong> (<em>number</em>) – the image height. If <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, use the full height of the original image. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code></p></li>
<li><p><strong>offset</strong> (<em>number</em>) – the pixel offset into the original image where data should be read from. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>xflip</strong> (<em>boolean</em>) – whether the image should be a horizontal flip of the original image. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>yflip</strong> (<em>boolean</em>) – whether the image should be a vertical flip of the original image. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>paletteId</strong> (<em>number</em>) – the id of which currently loaded tileset palette to use for the image. If <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code>, use the original image’s palette. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code></p></li>
<li><p><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>useCache</strong> (<em>boolean</em>) – whether the image should be saved/loaded using the cache. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Reading images from a file is slow. Setting <codeclass="docutils literal notranslate"><spanclass="pre">useCache</span></code> to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code> will save the image to memory so that the next time the filepath is encountered the image can be loaded from memory rather than the file.</p></li>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>tileId</strong> (<em>number</em>) – tile value for the image</p></li>
<li><p><strong>xflip</strong> (<em>boolean</em>) – whether the tile image is flipped horizontally</p></li>
<li><p><strong>yflip</strong> (<em>boolean</em>) – whether the tile image is flipped vertically</p></li>
<li><p><strong>palette</strong> (<em>number</em>) – palette number for the tile image</p></li>
<li><p><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">addTileImage</code><spanclass="sig-paren">(</span><emclass="sig-param">x</em>, <emclass="sig-param">y</em>, <emclass="sig-param">tile</em>, <emclass="sig-param">setTransparency = false</em>, <emclass="sig-param">layer = 0</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#id0"title="Permalink to this definition">¶</a></dt>
<dd><p>Creates an image of a tile on the specified overlay layer. This is an overloaded function that takes a single tile as a JavaScript object instead of each of the tile’s properties individually.</p>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>tile</strong> (<em>{tileId,xflip,yflip,palette}</em>) – the tile to create an image of</p></li>
<li><p><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<li><p><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</p></li>
<li><p><strong>metatileId</strong> (<em>number</em>) – id of the metatile to create an image of</p></li>
<li><p><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code></p></li>
<li><p><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code></p></li>
<h4>Tileset Functions<aclass="headerlink"href="#tileset-functions"title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to tilesets and how they are rendered. The functions with “preview” in their name operate on a “fake” version of the palette colors. This means that changing these “preview” colors won’t affect the actual tileset colors in the project. A good use of the “preview” palettes would be Day/Night tints, for example.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getPrimaryTilesetPalettePreview</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getPrimaryTilesetPalettePreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the primary tileset of the currently-opened map.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setPrimaryTilesetPalettePreview</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em>, <emclass="sig-param">colors</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setPrimaryTilesetPalettePreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the primary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
<li><p><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getPrimaryTilesetPalettesPreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getPrimaryTilesetPalettesPreview</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getPrimaryTilesetPalettesPreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the primary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>array of arrays of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setPrimaryTilesetPalettesPreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setPrimaryTilesetPalettesPreview</code><spanclass="sig-paren">(</span><emclass="sig-param">palettes</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setPrimaryTilesetPalettesPreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the primary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getSecondaryTilesetPalettePreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSecondaryTilesetPalettePreview</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSecondaryTilesetPalettePreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the secondary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
</ul>
</dd>
<dtclass="field-even">Returns array</dt>
<ddclass="field-even"><p>array of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setSecondaryTilesetPalettePreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSecondaryTilesetPalettePreview</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em>, <emclass="sig-param">colors</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSecondaryTilesetPalettePreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the secondary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
<li><p><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getSecondaryTilesetPalettesPreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSecondaryTilesetPalettesPreview</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSecondaryTilesetPalettesPreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the secondary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>array of arrays of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setSecondaryTilesetPalettesPreview">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSecondaryTilesetPalettesPreview</code><spanclass="sig-paren">(</span><emclass="sig-param">palettes</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSecondaryTilesetPalettesPreview"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the secondary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getPrimaryTilesetPalette">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getPrimaryTilesetPalette</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getPrimaryTilesetPalette"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the primary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
</ul>
</dd>
<dtclass="field-even">Returns array</dt>
<ddclass="field-even"><p>array of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setPrimaryTilesetPalette">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setPrimaryTilesetPalette</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em>, <emclass="sig-param">colors</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setPrimaryTilesetPalette"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the primary tileset of the currently-opened map. This will permanently affect the palette and save the palette to disk.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
<li><p><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getPrimaryTilesetPalettes">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getPrimaryTilesetPalettes</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getPrimaryTilesetPalettes"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the primary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>array of arrays of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setPrimaryTilesetPalettes">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setPrimaryTilesetPalettes</code><spanclass="sig-paren">(</span><emclass="sig-param">palettes</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setPrimaryTilesetPalettes"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the primary tileset of the currently-opened map. This will permanently affect the palettes and save the palettes to disk.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getSecondaryTilesetPalette">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSecondaryTilesetPalette</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSecondaryTilesetPalette"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the secondary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
</ul>
</dd>
<dtclass="field-even">Returns array</dt>
<ddclass="field-even"><p>array of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setSecondaryTilesetPalette">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSecondaryTilesetPalette</code><spanclass="sig-paren">(</span><emclass="sig-param">paletteIndex</em>, <emclass="sig-param">colors</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSecondaryTilesetPalette"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the secondary tileset of the currently-opened map. This will permanently affect the palette and save the palette to disk.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>paletteIndex</strong> (<em>number</em>) – the palette index</p></li>
<li><p><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getSecondaryTilesetPalettes">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSecondaryTilesetPalettes</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSecondaryTilesetPalettes"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the secondary tileset of the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>array of arrays of colors. Each color is a 3-element RGB array</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setSecondaryTilesetPalettes">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSecondaryTilesetPalettes</code><spanclass="sig-paren">(</span><emclass="sig-param">palettes</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSecondaryTilesetPalettes"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the secondary tileset of the currently-opened map. This will permanently affect the palettes and save the palettes to disk.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.isPrimaryTileset">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">isPrimaryTileset</code><spanclass="sig-paren">(</span><emclass="sig-param">tilesetName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.isPrimaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified tileset is a primary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tilesetName</strong> (<em>string</em>) – the tileset name</p></li>
</ul>
</dd>
<dtclass="field-even">Returns boolean</dt>
<ddclass="field-even"><p>is a primary tileset</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.isSecondaryTileset">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">isSecondaryTileset</code><spanclass="sig-paren">(</span><emclass="sig-param">tilesetName</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.isSecondaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified tileset is a secondary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tilesetName</strong> (<em>string</em>) – the tileset name</p></li>
</ul>
</dd>
<dtclass="field-even">Returns boolean</dt>
<ddclass="field-even"><p>is a secondary tileset</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getPrimaryTileset">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getPrimaryTileset</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getPrimaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the primary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns string</dt>
<ddclass="field-odd"><p>primary tileset name</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setPrimaryTileset">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setPrimaryTileset</code><spanclass="sig-paren">(</span><emclass="sig-param">tileset</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setPrimaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the primary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tileset</strong> (<em>string</em>) – the tileset name</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getSecondaryTileset">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSecondaryTileset</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSecondaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the secondary tileset for the currently-opened map.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSecondaryTileset</code><spanclass="sig-paren">(</span><emclass="sig-param">tileset</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSecondaryTileset"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the secondary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tileset</strong> (<em>string</em>) – the tileset name</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumPrimaryTilesetMetatiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumPrimaryTilesetMetatiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumPrimaryTilesetMetatiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of metatiles in the primary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of metatiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMaxPrimaryTilesetMetatiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMaxPrimaryTilesetMetatiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMaxPrimaryTilesetMetatiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the maximum number of metatiles allowed in a primary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>maximum number of metatiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumSecondaryTilesetMetatiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumSecondaryTilesetMetatiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumSecondaryTilesetMetatiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of metatiles in the secondary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of metatiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMaxSecondaryTilesetMetatiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMaxSecondaryTilesetMetatiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMaxSecondaryTilesetMetatiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the maximum number of metatiles allowed in a secondary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>maximum number of metatiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumPrimaryTilesetTiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumPrimaryTilesetTiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumPrimaryTilesetTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of tiles in the primary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of tiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMaxPrimaryTilesetTiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMaxPrimaryTilesetTiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMaxPrimaryTilesetTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the maximum number of tiles allowed in a primary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>maximum number of tiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumSecondaryTilesetTiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumSecondaryTilesetTiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumSecondaryTilesetTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of tiles in the secondary tileset for the currently-opened map.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of tiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMaxSecondaryTilesetTiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMaxSecondaryTilesetTiles</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMaxSecondaryTilesetTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the maximum number of tiles allowed in a secondary tileset.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>maximum number of tiles</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumTilesInMetatile">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumTilesInMetatile</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumTilesInMetatile"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of tiles in a metatile. Will be either <codeclass="docutils literal notranslate"><spanclass="pre">8</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">12</span></code> depending on <codeclass="docutils literal notranslate"><spanclass="pre">enable_triple_layer_metatiles</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of tiles in a metatile</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getNumMetatileLayers">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getNumMetatileLayers</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getNumMetatileLayers"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of layers in a metatiles. Will be either <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code> depending on <codeclass="docutils literal notranslate"><spanclass="pre">enable_triple_layer_metatiles</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>number of layers in a metatile</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileLayerOrder">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileLayerOrder</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileLayerOrder"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the order that metatile layers are rendered.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>array of layers. The bottom layer is represented as 0.</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileLayerOrder">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileLayerOrder</code><spanclass="sig-paren">(</span><emclass="sig-param">order</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileLayerOrder"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the order that metatile layers are rendered.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>order</strong> (<em>array</em>) – array of layers. The bottom layer is represented as 0.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileLayerOpacity</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileLayerOpacity"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the opacities that metatile layers are rendered with.</p>
<ddclass="field-odd"><p>array of opacities for each layer. The bottom layer is the first element.</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileLayerOpacity">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileLayerOpacity</code><spanclass="sig-paren">(</span><emclass="sig-param">opacities</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileLayerOpacity"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the opacities that metatile layers are rendered with.</p>
<li><p><strong>opacities</strong> (<em>array</em>) – array of opacities for each layer. The bottom layer is the first element.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileLabel">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileLabel</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileLabel"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the label for the specified metatile.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
</ul>
</dd>
<dtclass="field-even">Returns string</dt>
<ddclass="field-even"><p>the label</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileLabel">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileLabel</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">label</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileLabel"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the label for the specified metatile. A label can only consist of letters, numbers, and underscores.</p>
<p><strong>Warning:</strong> This function writes directly to the project. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>label</strong> (<em>string</em>) – the label</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileLayerType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileLayerType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileLayerType"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the layer type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Middle/Top, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Bottom/Middle, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Bottom/Top.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the layer type</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileLayerType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileLayerType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">layerType</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileLayerType"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the layer type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Middle/Top, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Bottom/Middle, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Bottom/Top.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>layerType</strong> (<em>number</em>) – the layer type</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileEncounterType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileEncounterType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileEncounterType"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the encounter type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: None, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Land, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Water</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the encounter type</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileEncounterType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileEncounterType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">encounterType</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileEncounterType"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the encounter type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: None, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Land, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Water</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>encounterType</strong> (<em>number</em>) – the encounter type</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileTerrainType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileTerrainType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileTerrainType"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the terrain type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: None, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Grass, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Water, <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code>: Waterfall</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the terrain type</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileTerrainType">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileTerrainType</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">terrainType</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileTerrainType"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the terrain type for the specified metatile. <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: None, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Grass, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Water, <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code>: Waterfall</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>terrainType</strong> (<em>number</em>) – the terrain type</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileBehavior">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileBehavior</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileBehavior"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the behavior for the specified metatile.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
</ul>
</dd>
<dtclass="field-even">Returns number</dt>
<ddclass="field-even"><p>the behavior</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileBehavior">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileBehavior</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">behavior</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileBehavior"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the behavior for the specified metatile.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>behavior</strong> (<em>number</em>) – the behavior</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMetatileTile">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileTile</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tileIndex</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileTile"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the tile at the specified index of the metatile.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tileIndex</strong> (<em>number</em>) – index of the tile to get</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMetatileTiles</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tileStart = 0</em>, <emclass="sig-param">tileEnd = -1</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMetatileTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the tiles in the specified range of the metatile.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tileStart</strong> (<em>number</em>) – index of the first tile to get. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (the first tile)</p></li>
<li><p><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to get. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code> (the last tile)</p></li>
</ul>
</dd>
<dtclass="field-even">Returns array</dt>
<ddclass="field-even"><p>array of tiles in the specified range. Each tile is an object of the form <codeclass="docutils literal notranslate"><spanclass="pre">{tileId,</span><spanclass="pre">xflip,</span><spanclass="pre">yflip,</span><spanclass="pre">palette}</span></code></p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileTile">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileTile</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tileIndex</em>, <emclass="sig-param">tileId</em>, <emclass="sig-param">xflip</em>, <emclass="sig-param">yflip</em>, <emclass="sig-param">palette</em>, <emclass="sig-param">forceRedraw = true</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileTile"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tile at the specified index of the metatile.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tileIndex</strong> (<em>number</em>) – index of the tile to set</p></li>
<li><p><strong>tileId</strong> (<em>number</em>) – new tile’s value</p></li>
<li><p><strong>xflip</strong> (<em>boolean</em>) – whether the new tile is flipped horizontally</p></li>
<li><p><strong>yflip</strong> (<em>boolean</em>) – whether the new tile is flipped vertically</p></li>
<li><p><strong>palette</strong> (<em>number</em>) – new tile’s palette number</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="id1">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileTile</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tileIndex</em>, <emclass="sig-param">tile</em>, <emclass="sig-param">forceRedraw = true</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#id1"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tile at the specified index of the metatile. This is an overloaded function that takes a single tile as a JavaScript object instead of each of the tile’s properties individually.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tileIndex</strong> (<em>number</em>) – index of the tile to set</p></li>
<li><p><strong>tile</strong> (<em>{tileId,xflip,yflip,palette}</em>) – the new tile</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMetatileTiles">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileTiles</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tileId</em>, <emclass="sig-param">xflip</em>, <emclass="sig-param">yflip</em>, <emclass="sig-param">palette</em>, <emclass="sig-param">tileStart = 0</em>, <emclass="sig-param">tileEnd = -1</em>, <emclass="sig-param">forceRedraw = true</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMetatileTiles"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tiles in the specified range of the metatile. All tiles in the specified range will be set using the same given values.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tileId</strong> (<em>number</em>) – new tiles’ value</p></li>
<li><p><strong>xflip</strong> (<em>boolean</em>) – whether the new tiles are flipped horizontally</p></li>
<li><p><strong>yflip</strong> (<em>boolean</em>) – whether the new tiles are flipped vertically</p></li>
<li><p><strong>palette</strong> (<em>number</em>) – new tiles’ palette number</p></li>
<li><p><strong>tileStart</strong> (<em>number</em>) – index of the first tile to set. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (the first tile)</p></li>
<li><p><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to set. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code> (the last tile)</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="id2">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMetatileTiles</code><spanclass="sig-paren">(</span><emclass="sig-param">metatileId</em>, <emclass="sig-param">tiles</em>, <emclass="sig-param">tileStart = 0</em>, <emclass="sig-param">tileEnd = -1</em>, <emclass="sig-param">forceRedraw = true</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#id2"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tiles in the specified range of the metatile. This is an overloaded function that takes an array of tiles as JavaScript objects instead of each of the tile properties individually.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>metatileId</strong> (<em>number</em>) – id of target metatile</p></li>
<li><p><strong>tiles</strong> (<em>array</em>) – array of tiles to set. Each tile is an object of the form <codeclass="docutils literal notranslate"><spanclass="pre">{tileId,</span><spanclass="pre">xflip,</span><spanclass="pre">yflip,</span><spanclass="pre">palette}</span></code>. If the array does not have sufficient objects to set all the tiles in the specified range then the remaining tiles will be set with all default values.</p></li>
<li><p><strong>tileStart</strong> (<em>number</em>) – index of the first tile to set. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> (the first tile)</p></li>
<li><p><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to set. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">-1</span></code> (the last tile)</p></li>
<li><p><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>. Redrawing the map view is expensive, so set to <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <codeclass="docutils literal notranslate"><spanclass="pre">map.redraw()</span></code>.</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getGridVisibility</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getGridVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the visibility of the map grid overlay.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setGridVisibility</code><spanclass="sig-paren">(</span><emclass="sig-param">visible</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setGridVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the map grid overlay.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getBorderVisibility</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getBorderVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the visibility of the map’s border.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setBorderVisibility</code><spanclass="sig-paren">(</span><emclass="sig-param">visible</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setBorderVisibility"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the map’s border.</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getSmartPathsEnabled</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getSmartPathsEnabled"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setSmartPathsEnabled</code><spanclass="sig-paren">(</span><emclass="sig-param">enabled</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setSmartPathsEnabled"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getBaseGameVersion</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getBaseGameVersion"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the project’s base game version.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns string</dt>
<ddclass="field-odd"><p><codeclass="docutils literal notranslate"><spanclass="pre">"pokeruby"</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">"pokefirered"</span></code>, or <codeclass="docutils literal notranslate"><spanclass="pre">"pokeemerald"</span></code></p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getCustomScripts">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getCustomScripts</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getCustomScripts"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of paths to custom scripts.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns array</dt>
<ddclass="field-odd"><p>string array of custom scripts paths</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMainTab">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMainTab</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMainTab"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the index of the currently selected main tab. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Map, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Events, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Header, <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code>: Connections, <codeclass="docutils literal notranslate"><spanclass="pre">4</span></code>: Wild Pokemon).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns number</dt>
<ddclass="field-odd"><p>current main tab index</p>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.setMainTab">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMainTab</code><spanclass="sig-paren">(</span><emclass="sig-param">tab</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMainTab"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the currently selected main tab. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Map, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Events, <codeclass="docutils literal notranslate"><spanclass="pre">2</span></code>: Header, <codeclass="docutils literal notranslate"><spanclass="pre">3</span></code>: Connections, <codeclass="docutils literal notranslate"><spanclass="pre">4</span></code>: Wild Pokemon).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tab</strong> (<em>number</em>) – index of the tab to select</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.getMapViewTab">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">getMapViewTab</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.getMapViewTab"title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the index of the currently selected map view tab. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Metatiles, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Collision).</p>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setMapViewTab</code><spanclass="sig-paren">(</span><emclass="sig-param">tab</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setMapViewTab"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the currently selected map view tab. Tabs are indexed from left to right, starting at 0 (<codeclass="docutils literal notranslate"><spanclass="pre">0</span></code>: Metatiles, <codeclass="docutils literal notranslate"><spanclass="pre">1</span></code>: Collision).</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>tab</strong> (<em>number</em>) – index of the tab to select</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">registerAction</code><spanclass="sig-paren">(</span><emclass="sig-param">functionName</em>, <emclass="sig-param">actionName</em>, <emclass="sig-param">shortcut = ""</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.registerAction"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a JavaScript function to an action that can be manually triggered in Porymap’s <codeclass="docutils literal notranslate"><spanclass="pre">Tools</span></code> menu. Optionally, a keyboard shortcut (e.g. <codeclass="docutils literal notranslate"><spanclass="pre">"Ctrl+P"</span></code>) can also be specified, assuming it doesn’t collide with any existing shortcuts used by Porymap. The function specified by <codeclass="docutils literal notranslate"><spanclass="pre">functionName</span></code> must have the <codeclass="docutils literal notranslate"><spanclass="pre">export</span></code> keyword.</p>
<li><p><strong>functionName</strong> (<em>string</em>) – name of the JavaScript function</p></li>
<li><p><strong>actionName</strong> (<em>string</em>) – name of the action that will be displayed in the <codeclass="docutils literal notranslate"><spanclass="pre">Tools</span></code> menu</p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">setTimeout</code><spanclass="sig-paren">(</span><emclass="sig-param">func</em>, <emclass="sig-param">delayMs</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.setTimeout"title="Permalink to this definition">¶</a></dt>
<dd><p>This behaves essentially the same as JavaScript’s <codeclass="docutils literal notranslate"><spanclass="pre">setTimeout()</span></code> that is used in web browsers or NodeJS. The <codeclass="docutils literal notranslate"><spanclass="pre">func</span></code> argument is a JavaScript function (NOT the name of a function) which will be executed after a delay. This is useful for creating animations or refreshing the overlay at constant intervals.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>func</strong> (<em>function</em>) – a JavaScript function that will be executed later</p></li>
<li><p><strong>delayMs</strong> (<em>number</em>) – the number of milliseconds to wait before executing <codeclass="docutils literal notranslate"><spanclass="pre">func</span></code></p></li>
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">log</code><spanclass="sig-paren">(</span><emclass="sig-param">message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.log"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <codeclass="docutils literal notranslate"><spanclass="pre">[INFO]</span></code>. This is useful for debugging custom scripts.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>message</strong> (<em>string</em>) – the message to log</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.warn">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">warn</code><spanclass="sig-paren">(</span><emclass="sig-param">message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.warn"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <codeclass="docutils literal notranslate"><spanclass="pre">[WARN]</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Arguments</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>message</strong> (<em>string</em>) – the message to log</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="js function">
<dtid="map.error">
<codeclass="sig-prename descclassname">map.</code><codeclass="sig-name descname">error</code><spanclass="sig-paren">(</span><emclass="sig-param">message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#map.error"title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <codeclass="docutils literal notranslate"><spanclass="pre">[ERROR]</span></code>.</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.