getTokenMap: Difference between revisions
Jump to navigation
Jump to search
m (Add to 'Map' category.) |
m (Text replacement - "source>" to "syntaxhighlight>") |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
|name=getTokenMap | |name=getTokenMap | ||
|version=1.5.11 | |version=1.5.11 | ||
|trusted=true | |||
|description= | |description= | ||
Gets the list of map(s) where a token resides. The list is returned either as a string list, or as a [[JSON Array]]. | 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= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getTokenMap(name/ID) | getTokenMap(name/ID) | ||
getTokenMap(name/ID, delim) | getTokenMap(name/ID, delim) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
'''Parameters''' | '''Parameters''' | ||
Line 17: | Line 18: | ||
|example= | |example= | ||
Suppose a token named "Dragon" is on two maps, "Grasslands" and "Arid". The command | Suppose a token named "Dragon" is on two maps, "Grasslands" and "Arid". The command | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: getTokenMap("Dragon", "json")] | [r: getTokenMap("Dragon", "json")] | ||
</ | </syntaxhighlight> | ||
returns the JSON Array: | returns the JSON Array: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
["Grasslands","Arid"] | ["Grasslands","Arid"] | ||
</ | </syntaxhighlight> | ||
}} | }} | ||
[[Category:Token Function]] | [[Category:Token Function]] | ||
[[Category:Map Function]] | [[Category:Map Function]] |
Revision as of 20:45, 14 March 2023
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
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 tojson
, 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"]