getTokenVBL: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Fixed typo in usage.)
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 4: Line 4:
|trusted=true
|trusted=true
|version=1.4.1.6
|version=1.4.1.6
|description=gets the VBL attached to a token
|description=Gets the VBL attached to a token as a JSON object.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
getTokenVBL(id)
getTokenVBL(tokenRef)
</source>
</syntaxhighlight>


This function can be used to transfer TOKEN VBL to a different token. Token VBL moves with the token, can be set under the VBL tab on the token edit menu and is colored YELLOW. Normal VBL is static, can be created with the VBL drawing tools or with the use of VBL functions and is colored BLUE.
This macro function is used used to get a JSON object describing the TOKEN VBL attached to a token. The returned JSON object can then be used with {{func|setTokenVBL}}, {{func|drawVBL}}or {{func|eraseVBL}}.
 
Token VBL is attached to and moves with the token.  It can be set (or cleared) under the VBL tab on the Edit Token dialog and is colored YELLOW. Normal VBL is static, can be created with the VBL drawing tools or with the use of VBL functions and is colored BLUE.


'''Parameters'''
'''Parameters'''
{{param|id|OPTIONAL: The token {{code|id}} of the token for which you want to set this setting, defaults to the [[Current Token]]. }}
{{param|tokenRef|OPTIONAL: Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token for which you want to get the VBL. Defaults to the [[Current Token]]. }}
 
{{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.}}
 


''Example:''<source lang="mtmacro">
''Example:''<syntaxhighlight lang="mtmacro">
[h: vbl = getTokenVBL("Door, Steel")]
[h: vbl = getTokenVBL("Door, Steel")]
[h: setTokenVBL(vbl, "Door, Wood")]
[h: setTokenVBL(vbl, "Door, Wood")]
</source><br />
</syntaxhighlight><br />


|also=
|also=
[[Introduction to Vision Blocking ]], {{func|setTokenVBL}}
[[Introduction to Vision Blocking ]], {{func|setTokenVBL}}, {{func|drawVBL}} or {{func|eraseVBL}}
}}
}}
[[Category:Miscellaneous Function]]
[[Category:Miscellaneous Function]]
[[Category:VBL Function]]
[[Category:VBL Function]]

Latest revision as of 23:59, 14 May 2024

getTokenVBL() Function

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

Introduced in version 1.4.1.6
Gets the VBL attached to a token as a JSON object.

Usage

getTokenVBL(tokenRef)

This macro function is used used to get a JSON object describing the TOKEN VBL attached to a token. The returned JSON object can then be used with setTokenVBL(), drawVBL()or eraseVBL().

Token VBL is attached to and moves with the token. It can be set (or cleared) under the VBL tab on the Edit Token dialog and is colored YELLOW. Normal VBL is static, can be created with the VBL drawing tools or with the use of VBL functions and is colored BLUE.

Parameters

  • tokenRef - OPTIONAL: Either the token id or Token Name of the token for which you want to get the VBL. Defaults to the Current Token.
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.


Example:

[h: vbl = getTokenVBL("Door, Steel")]
[h: setTokenVBL(vbl, "Door, Wood")]



See Also