resetSize: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=setSize |trusted=true |version=1.3b48 |description= Resets the Size of a Token to the default for grid type of the map it occupies. See {{func|s...")
 
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=setSize
|name=resetSize
|trusted=true
|trusted=true
|version=1.3b48
|version=1.3b48
Line 7: Line 7:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
resetSize()
resetSize()
resetSize(id)
resetSize(tokenRef)
resetSize(id, mapname)
resetSize(tokenRef, mapRef)
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|id|The token {{code|id}} of the token to reset, defaults to the [[Current Token]].}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token to reset, defaults to the [[Current Token]].}}
{{param|mapName|Optional map name to find the token.  Defaults to current map.}}
{{param|mapRef|Optional.  Name or ID of the  map to find the token.  Defaults to current map.}}
{{Note|Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.}}


|examples=
|examples=
To reset the size of the current token to the default for the map:
To reset the size of the current token to the default for the map:
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: resetSize()]
[h: resetSize()]
</source>
</syntaxhighlight>


To reset the size of token '''Chocolate Moose''' on map '''Cadbury''':
To reset the size of token '''Chocolate Moose''' on map '''Cadbury''':
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: tok = "Chocolate Moose"]
[h: tok = "Chocolate Moose"]
[h: map = "Cadbury"]
[h: map = "Cadbury"]
[h: resetSize(tok, map)]
[h: resetSize(tok, map)]
</source>
</syntaxhighlight>


|also=
|also=

Latest revision as of 23:59, 17 May 2024

resetSize() Function

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

Introduced in version 1.3b48
Resets the Size of a Token to the default for grid type of the map it occupies. See setSize() for details about the default size for different grid types.

Usage

resetSize()
resetSize(tokenRef)
resetSize(tokenRef, mapRef)

Parameters

  • tokenRef - Either the token id or Token Name of the token to reset, defaults to the Current Token.
  • mapRef - Optional. Name or ID of the map to find the token. Defaults to current map.
Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.

Examples

To reset the size of the current token to the default for the map:
[h: resetSize()]

To reset the size of token Chocolate Moose on map Cadbury:

[h: tok = "Chocolate Moose"]
[h: map = "Cadbury"]
[h: resetSize(tok, map)]

See Also

Version Changes

  • 1.5.4 - Added mapName parameter option.