getTokenMap: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
{{param|delim|The delimiter used in the string list returned, defaults to {{code|","}}. If set to {{code|json}}, then a JSON array is returned.}}
{{param|delim|The delimiter used in the string list returned, defaults to {{code|","}}. If set to {{code|json}}, then a JSON array is returned.}}


|example=
Suppose a token named "Dragon" is on two maps, "Grasslands" and "Arid". The command
<source lang="mtmacro" line>
[r: getTokenMap("Dragon", "json")]
</source>
returns the JSON Array:
<source lang="mtmacro" line>
["Grasslands","Arid"]
</source>
}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Revision as of 15:01, 22 January 2020

getTokenMap() Function

Introduced in version 1.5.11
Gets the list of map(s) where a token resides. The list is returned either as a string list, or as a JSON Array.

Usage

getTokenMap(name/ID)
getTokenMap(name/ID, delim)

Parameters Parameters

  • name/ID - Either the name of the token or the ID.
  • delim - The delimiter used in the string list returned, defaults to ",". If set to json, then a JSON array is returned.

Example

Suppose a token named "Dragon" is on two maps, "Grasslands" and "Arid". The command
[r: getTokenMap("Dragon", "json")]

returns the JSON Array:

["Grasslands","Arid"]