getTokenMap

From RPTools Wiki
Revision as of 20:31, 14 March 2023 by Taustin (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")
Jump to navigation Jump to search

getTokenMap() Function

 Note: This function can only be used in a Trusted Macro

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

<syntaxhighlight lang="mtmacro" line> getTokenMap(name/ID) getTokenMap(name/ID, delim) </source> 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

<syntaxhighlight lang="mtmacro" line> [r: getTokenMap("Dragon", "json")] </source> returns the JSON Array: <syntaxhighlight lang="mtmacro" line> ["Grasslands","Arid"]

</source>