setSize: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(18 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{stub|Examples of usage.}}
{{MacroFunction
{{MacroFunction
|name=setSize
|name=setSize
Line 5: Line 4:
|version=1.3b48
|version=1.3b48
|description=
|description=
Sets the [[Size]] of a [[Token]].
Sets the size of a [[Token]] with one of the defined sizes according to each Grid Type. {{Note|The names of each size are based on the type of grid the map uses. The sizes can be found on the [[Token Size]] page.}} "Free" or "Native" are also valid values.


The valid sizes for square grids are ('''Medium''' = 1 full cell):
|usage=
<syntaxhighlight lang="mtmacro" line>
setSize(size)
setSize(size, id)
setSize(size, id, mapname)
</syntaxhighlight>
'''Parameters'''
{{param|size|A [[Token Size]] to set the token to. Can be "Free" or "Native" as well.}}
{{param|id|The token {{code|id}} of the token which will have its [[Token Size]] set. Defaults to the [[Current Token]].}}
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}
 
The sizes available on the for Square grid maps are:
* {{code|Fine}}
* {{code|Fine}}
* {{code|Diminutive}}
* {{code|Diminutive}}
Line 17: Line 27:
* {{code|Gargantuan}}
* {{code|Gargantuan}}
* {{code|Colossal}}
* {{code|Colossal}}
 
&nbsp;
The valid sizes for hex grids are ('''Medium''' = 1 full cell):
* {{code|1/6}}
* {{code|1/4}}
* {{code|1/3}}
* {{code|1/2}}
* {{code|2/3}}
* {{code|Medium}}
* {{code|Large}}
* {{code|Huge}}
 
The valid sizes for gridless maps are:
* {{code|-11}}
* {{code|-10}}
* {{code|-9}}
* ...
* {{code|18}}
* {{code|19}}
* {{code|20}}
{{Clarify|It would be nice to include pictures that demonstrate how the grid cells are composed; at least for the hex grids.}}
 
|usage=
<source lang="mtmacro" line>
setSize(size)
</source>
<source lang="mtmacro" line>
setSize(size, id)
</source>
'''Parameters'''
{{param|size|The [[Size]] to set the token to.}}
{{param|id|The token {{code|id}} of the token which has its [[Size]] set, defaults to the [[Current Token]].}}


|examples=
|examples=
* To set the size of the current token to {{code|Medium}}:
To set the size of the current token to {{code|Medium}}:
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: setSize("Medium")]
[h: setSize("Medium")]
</source>
</syntaxhighlight>


* To set the size of the current token to whatever string is stored in the macro variable '''mySize''':
To set the size of the current token to whatever string is stored in the macro variable '''mySize''':
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: mySize = "Large"]
[h: mySize = "Large"]
[h: setSize(mySize)]
[h: setSize(mySize)]
</source>
</syntaxhighlight>


|also=
|also=
[[getSize|getSize()]]
{{func|getSize}}  [[resetSize|resetSize()]]


|changes=
|changes=
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.5.4|Added {{code|mapname}} parameter option.}}


}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Latest revision as of 18:08, 16 April 2024

setSize() Function

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

Introduced in version 1.3b48
Sets the size of a Token with one of the defined sizes according to each Grid Type.
The names of each size are based on the type of grid the map uses. The sizes can be found on the Token Size page.
"Free" or "Native" are also valid values.

Usage

setSize(size)
setSize(size, id)
setSize(size, id, mapname)

Parameters

  • size - A Token Size to set the token to. Can be "Free" or "Native" as well.
  • id - The token id of the token which will have its Token Size set. Defaults to the Current Token.
  • mapname - The name of the map to find the token. Defaults to the current map.

The sizes available on the for Square grid maps are:

  • Fine
  • Diminutive
  • Tiny
  • Small
  • Medium
  • Large
  • Huge
  • Gargantuan
  • Colossal

 

Examples

To set the size of the current token to Medium:
[h: setSize("Medium")]

To set the size of the current token to whatever string is stored in the macro variable mySize:

[h: mySize = "Large"]
[h: setSize(mySize)]

See Also

Version Changes

  • 1.3b51 - Added id parameter option.
  • 1.5.4 - Added mapname parameter option.