getTokens: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) (Updated with recent version changes.) |
Verisimilar (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{stub| | {{stub|Examples that use the newest additions.}} | ||
{{MacroFunction | {{MacroFunction | ||
|name=getTokens | |name=getTokens | ||
Line 34: | Line 34: | ||
*** {{code|from}} - A number specifying the minimum range that a token needs to be from the source. | *** {{code|from}} - A number specifying the minimum range that a token needs to be from the source. | ||
*** {{code|upto}} - A number specifying the maximum range that a token can be from the source. | *** {{code|upto}} - A number specifying the maximum range that a token can be from the source. | ||
** {{code|area}} - A JSON object.}} | ** {{code|area}} - A JSON object containing specific area information. | ||
*** {{code|token}} - An optional field that contain the name or id of the token that resides at the center of the area. Defaults to the current token. | |||
*** {{code|offsets}} - A JSON array of JSON objects that specify each individual cell that make up the area. | |||
**** {{code|x}} - The relative {{code|x}} position of the cell in relation to the {{code|token}} field. Measured in cells. | |||
**** {{code|y}} - The relative {{code|y}} position of the cell in relation to the {{code|token}} field. Measured in cells.}} | |||
|example= | |example= |
Revision as of 00:22, 23 March 2009
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
This article needs: Examples that use the newest additions.
getTokens() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.3b48
Gets a list containing the ids of all the tokens on the current map, or all the tokens that match the specified conditions. The type of the value returned depends on the delimiter parameter.
Usage
getTokens()
getTokens(delim)
getTokens(delim, conditions)
Parameters
delim
- The delimiter used to sepearate the values in the String List that is returned, defaults to","
. If"json"
is specified, a JSON array is returned instead of a String List.conditions
- A JSON object that contains various conditions that the tokens must fullfill. All conditions are optional.setStates
- A JSON array of states the token must have.unsetStates
- A JSON array of states the token must not have.npc
- If the token must be a NPC, set totrue
(1
) orfalse
(0
).pc
- If the token must be a PC, set totrue
(1
) orfalse
(0
).selected
- If the token must be selected, set totrue
(1
) orfalse
(0
).impersonated
- If the token must be impersonated, set totrue
(1
) orfalse
(0
).current
- If the token must be the current token, set totrue
(1
) orfalse
(0
).owned
- If the token must be owned by a player, set totrue
(1
) orfalse
(0
).visible
- If the token must be visible to players, set totrue
(1
) orfalse
(0
).range
- A JSON object with range conditions, all range conditions are optional.token
- The id or name of the source token that the distance is measured from, defaults to the current token.distancePerCell
- If the Distance Per Cell multiplier should be used, set totrue
(1
) orfalse
(0
).from
- A number specifying the minimum range that a token needs to be from the source.upto
- A number specifying the maximum range that a token can be from the source.
area
- A JSON object containing specific area information.token
- An optional field that contain the name or id of the token that resides at the center of the area. Defaults to the current token.offsets
- A JSON array of JSON objects that specify each individual cell that make up the area.x
- The relativex
position of the cell in relation to thetoken
field. Measured in cells.y
- The relativey
position of the cell in relation to thetoken
field. Measured in cells.
Example
You can use the following code to print out the ids of all of the tokens on the current map.
[h: ids = getTokens()]
[foreach(id, ids, "<br>"): id]
Version Changes
- 1.3b49 - Added
json
delimiter option. - 1.3b51 - Added
conditions
parameter.