setTokenOpacity: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=setTokenOpacity |version=1.4.2.0 |description=sets the opacity value of the corresponding token. |usage= <source lang="mtmacro" line> setTokenOpacity(...")
 
No edit summary
 
(11 intermediate revisions by 5 users not shown)
Line 2: Line 2:
|name=setTokenOpacity
|name=setTokenOpacity
|version=1.4.2.0
|version=1.4.2.0
|description=sets the opacity value of the corresponding token.   
|description=Sets the opacity value of the corresponding token.   


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro">
setTokenOpacity(value[id])
setTokenOpacity(value)
</source>
setTokenOpacity(value, id)
setTokenOpacity(value, id, mapRef)
</syntaxhighlight>


'''Parameters'''
'''Parameters'''
{{param|value|The value of the opacity to set, ranging from 0 (completely transparent) to 100 (completely opaque).}}
{{param|value|The value of the opacity to set, ranging from 0.0 (completely transparent) to 1.0 (completely opaque).  This must be a floating point value with leading zero if less than 1.0.}}
{{param|id|OPTIONAL: The token {{code|id}} of the token for which you want to retrieve the opacity, defaults to the [[Current Token]]. }}
{{param|id|OPTIONAL: The token {{code|id}} of the token for which you want to retrieve the opacity, defaults to the [[Current Token]]. }}
{{param|mapRef|OPTIONAL: The Name or ID of the map to find the token.  Defaults to the current map.}}
'''Returns'''
The opacity value that was set.
'''Note'''
If opacity is below about 20%, it becomes increasingly difficult to see the token. At 0%, it is completely invisible, even to the Gamemaster. If you can't find it, use the Map Explorer panel.


|example=
|example=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: setTokenOpacity(50, "Dragon")]
[h: setTokenOpacity(0.5, "Dragon")]
[h, token("Dragon"): setTokenOpacity(75)]
[h, token("Dragon"): setTokenOpacity(0.75)]
</source>
</syntaxhighlight>
 
|changes={{change|1.5.4|Added {{code|mapname}} parameter option.}}
}}
}}
[[Category:VBL Function]]
[[Category:VBL Function]]

Latest revision as of 23:59, 19 September 2023

setTokenOpacity() Function

Introduced in version 1.4.2.0
Sets the opacity value of the corresponding token.

Usage

setTokenOpacity(value)
setTokenOpacity(value, id)
setTokenOpacity(value, id, mapRef)

Parameters

  • value - The value of the opacity to set, ranging from 0.0 (completely transparent) to 1.0 (completely opaque). This must be a floating point value with leading zero if less than 1.0.
  • id - OPTIONAL: The token id of the token for which you want to retrieve the opacity, defaults to the Current Token.
  • mapRef - OPTIONAL: The Name or ID of the map to find the token. Defaults to the current map.

Returns The opacity value that was set.

Note If opacity is below about 20%, it becomes increasingly difficult to see the token. At 0%, it is completely invisible, even to the Gamemaster. If you can't find it, use the Map Explorer panel.

Example

[h: setTokenOpacity(0.5, "Dragon")]
[h, token("Dragon"): setTokenOpacity(0.75)]


Version Changes

  • 1.5.4 - Added mapname parameter option.