js:MapTool.tokens

From RPTools Wiki
Revision as of 19:18, 7 October 2021 by LPerkins (talk | contribs) (Created page with "{{Experimental}} {{MacroFunction |name=MapTool.tokens.getSelectedTokens |trusted=true |version=1.10.0 |description= Returns a javascript array containing the selected tokens....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

 This article describes a feature or macro function that is experimental and may be subject to change.


MapTool.tokens.getSelectedTokens() Function

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

Introduced in version 1.10.0
Returns a javascript array containing the selected tokens.

Usage

let a = MapTool.tokens.getSelectedTokens();

Parameters

  • return - An array containing all selected tokens.


MapTool.tokens.getSelected() Function

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

Introduced in version 1.10.0
Like getSelectedTokens(), but only returns the first token.

Usage

let token = MapTool.tokens.getSelected();

Parameters

  • return - The first selected token, or null if no token is selected.


MapTool.tokens.getTokenByID() Function

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

Introduced in version 1.10.0
Returns the token specified.

Usage

let token = MapTool.tokens.getTokenByID(tid);

Parameters

  • tid - String containing a valid token ID.
  • return - The token with specified ID.
  • throws - ArrayIndexOutOfBounds exception if the token cannot be found.


MapTool.tokens.getMapTokens() Function

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

Introduced in version 1.10.0
Returns a list of all tokens on all maps.

Usage

let token = MapTool.tokens.getMapTokens();
let token = MapTool.tokens.getMapTokens(name);

Parameters

  • name - A string containing the name of the map to search for tokens.
  • return - A list containing all tokens on every map.

See Also

JS: MapTool.chat
JS: MapTool.clientInfo
JS: MapTool.tokens
JS: Tokens
JS: MTScript

js.eval()