setTokenSnapToGrid: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 4 users not shown)
Line 6: Line 6:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
setTokenSnapToGrid(snap)
setTokenSnapToGrid(snap)
setTokenSnapToGrid(snap, id)
setTokenSnapToGrid(snap, id)
</source>
setTokenSnapToGrid(snap, id, mapRef)
</syntaxhighlight>


'''Parameters'''
'''Parameters'''
{{param|snap|A value {{true}} or {{false}}.}}
{{param|snap|A value {{true}} or {{false}}.}}
{{param|id|The id of the token to set its snap behaviour.}}
{{param|id|The id of the token to set its snap behaviour.}}
{{param|mapRef|The Name or ID of the map to find the token.  Defaults to the current map.}}


|example=
|example=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: setTokenSnapToGrid(0)]
[h: setTokenSnapToGrid(0)]
[h: setTokenSnapToGrid(1, currentToken())]</source>
[h: setTokenSnapToGrid(1, currentToken())]</syntaxhighlight>
}}
 
|changes=
{{change|1.5.4|Added {{code|mapname}} parameter option.}}
 
|also=
|also=
[[func|isSnapToGrid]]
{{func|isSnapToGrid}}
}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Latest revision as of 23:59, 14 March 2023

setTokenSnapToGrid() Function

Introduced in version 1.4
Sets the "snap to" behaviour for the Current Token or a specified token.

Usage

setTokenSnapToGrid(snap)
setTokenSnapToGrid(snap, id)
setTokenSnapToGrid(snap, id, mapRef)

Parameters

  • snap - A value true(1) or false(0).
  • id - The id of the token to set its snap behaviour.
  • mapRef - The Name or ID of the map to find the token. Defaults to the current map.

Example

[h: setTokenSnapToGrid(0)]
[h: setTokenSnapToGrid(1, currentToken())]

See Also

Version Changes

  • 1.5.4 - Added mapname parameter option.