js:MapTool: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "Within the javascript environment used by {{code|js.eval}}, {{code|MapTool}} is the main entry point for manipulating tokens or maps, sending chat messages, running macros, an...")
 
m (Conversion script moved page Js:MapTool to js:MapTool: Converting page titles to lowercase)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Within the javascript environment used by {{code|js.eval}}, {{code|MapTool}} is the main entry point for manipulating tokens or maps, sending chat messages, running macros, and so on.  This page details the attributes and functions available on the {{code|MapTool}} object.
{{Experimental}}
Within the javascript environment used by {{func|js.eval}}, {{code|MapTool}} is the main entry point for manipulating tokens or maps, sending chat messages, running macros, and so on.  This page details the attributes available on the {{code|MapTool}} object.


{{MacroFunction
|name=MapTool.getSelectedTokens
|trusted=true
|version=1.9.4
|description=
Returns a javascript array containing the selected tokens. 


|usage=
<source lang="javascript" line>
let a = MapTool.getSelectedTokens();
</source>
'''Parameters'''
* {{code|return}} - An array containing all selected tokens.
}}
{{MacroFunction
|name=MapTool.getSelected
|trusted=true
|version=1.9.4
|description=
Like {{code|getSelectedTokens()}}, but only returns the first token.
|usage=
<source lang="javascript" line>
let token = MapTool.getSelected();
</source>
'''Parameters'''
* {{code|return}} - The first selected token, or {{code|null}} if no token is selected.
}}
{{MacroFunction
|name=MapTool.getTokenByID
|trusted=true
|version=1.9.4
|description=
Returns the token specified.
|usage=
<source lang="javascript" line>
let token = MapTool.getTokenByID(tid);
</source>
'''Parameters'''
* {{code|tid}} - String containing a valid token ID.
* {{code|return}} - The token with specified ID. 
* {{code|throws}} - ArrayIndexOutOfBounds exception if the token cannot be found.
}}




Line 66: Line 10:
[[js:MapTool.clientInfo|JS: MapTool.clientInfo]]<br/>
[[js:MapTool.clientInfo|JS: MapTool.clientInfo]]<br/>
[[js:MapTool.tokens|JS: MapTool.tokens]]<br/>
[[js:MapTool.tokens|JS: MapTool.tokens]]<br/>
[[js:MTScript|JS: MTScript]]
[[js:Token|JS: Tokens]]<br/>
[[js:MTScript|JS: MTScript]]<br/>
 
{{func|js.eval}}
[[Category:Javascript Function]]
[[Category:Javascript Function]]

Latest revision as of 23:59, 9 February 2023

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

Within the javascript environment used by js.eval(), MapTool is the main entry point for manipulating tokens or maps, sending chat messages, running macros, and so on. This page details the attributes available on the MapTool object.



See Also

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

js.eval()