selectTokens: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page SelectTokens to selectTokens: Converting page titles to lowercase) |
No edit summary |
||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
selectTokens() | selectTokens() | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
selectTokens(id, add) | selectTokens(id, add) | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
selectTokens(tokens, add, delim) | selectTokens(tokens, add, delim) | ||
</ | </syntaxhighlight> | ||
'''Parameter''' | '''Parameter''' | ||
Line 24: | Line 24: | ||
|example= | |example= | ||
To select a single token with the name "Adventurer": | To select a single token with the name "Adventurer": | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:selectTokens("Adventurer")] | [h:selectTokens("Adventurer")] | ||
</ | </syntaxhighlight> | ||
To select a list of [[Token]]s using a [[String List]], replacing the current selection | To select a list of [[Token]]s using a [[String List]], replacing the current selection | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:selectTokens("Adventurer, Orc 2, Goblin 1", 0, ",")] | [h:selectTokens("Adventurer, Orc 2, Goblin 1", 0, ",")] | ||
</ | </syntaxhighlight> | ||
To select a list of [[Token]]s using a [[JSON Array]], adding the specified tokens to the current set of selected [[Token]]s: | To select a list of [[Token]]s using a [[JSON Array]], adding the specified tokens to the current set of selected [[Token]]s: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:selectTokens("['Adventurer', 'Orc 2', 'Goblin 1']", 1, "json")] | [h:selectTokens("['Adventurer', 'Orc 2', 'Goblin 1']", 1, "json")] | ||
</ | </syntaxhighlight> | ||
|also= | |also= |
Revision as of 21:11, 14 March 2023
selectTokens() Function
• Introduced in version 1.3b68
Selects one or more visible tokens on the map.
Usage
selectTokens()
selectTokens(id, add)
selectTokens(tokens, add, delim)
Parameter
id
- the id string or token name of a specific token to select (the examples below use token names, but IDs are also permitted); if left blank all visible tokens are selected.add
- if the value of add istrue(1)
, the selections will be added to the current set of selected tokens; if the value isfalse(0)
currently selected tokens will be deselected before new tokens are selected. Defaults to false.tokens
- a String List of tokens to select.delim
- Specifies the delimiter used in the string list that is supplied. If the delimiter is "json", then the value fortokens
may be a JSON Array instead. Note: if using a JSON Array or String List, bothadd
anddelim
must be specified.
Example
To select a single token with the name "Adventurer":
[h:selectTokens("Adventurer")]
To select a list of Tokens using a String List, replacing the current selection
[h:selectTokens("Adventurer, Orc 2, Goblin 1", 0, ",")]
To select a list of Tokens using a JSON Array, adding the specified tokens to the current set of selected Tokens:
[h:selectTokens("['Adventurer', 'Orc 2', 'Goblin 1']", 1, "json")]
See Also
Version Changes
- 1.3b68 - Function added.