setTokenVBL: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{MacroFunction |name=setTokenVBL |proposed=false |trusted=true |version=1.4.1.6 |description=sets the VBL of a token to that given as a parameter |usage= <source lang="mtmac...") |
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= | |description=Sets the VBL of a token to that given in the JSON object parameter. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
setTokenVBL(vbl, id) | setTokenVBL(vbl, id) | ||
</ | </syntaxhighlight> | ||
This function | This function is used to attach the TOKEN VBL passed in as a JSON object to a token. The JSON object may be be created by calling {{func|getTokenVBL}} on a different token and may also be used with {{func|drawVBL}} or {{func|eraseVBL}}. | ||
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. | |||
The {{code|method}} parameter in the JSON object must use one of the following: {{code|DOUGLAS_PEUCKER_SIMPLIFIER}}, {{code|TOPOLOGY_PRESERVING_SIMPLIFIER}}, {{code|VW_SIMPLIFIER}}, or {{code|NONE}}. | |||
'''Parameters''' | '''Parameters''' | ||
Line 17: | Line 21: | ||
{{param|id|OPTIONAL: The token {{code|id}} of the token for which you want to set this setting, defaults to the [[Current Token]]. }} | {{param|id|OPTIONAL: The token {{code|id}} of the token for which you want to set this setting, defaults to the [[Current Token]]. }} | ||
|example= | |||
Transfer VBL from one Token to another | |||
<syntaxhighlight lang="mtmacro"> | |||
[h: vbl = getTokenVBL("Door, Steel")] | |||
[h: setTokenVBL(vbl, "Door, Wood")] | |||
</syntaxhighlight><br /> | |||
Erase VBL from Token | |||
<syntaxhighlight lang="mtmacro"> | |||
[r: finalVblData = "{'shape':'none'}"] | |||
[r: setTokenVBL(finalVblData)] | |||
</syntaxhighlight><br /> | |||
Auto-generate VBL for the [[Current Token]] | |||
[h: | <syntaxhighlight lang="mtmacro"> | ||
[h: setTokenVBL( | [h: options = json.set("{}", "shape", "auto", "sensitivity", 10, "inverse", 0, "level", 2, "method", "DOUGLAS_PEUCKER_SIMPLIFIER", "r", 0, "g", 0, "b", 0, "a", 255)] | ||
</ | [h: setTokenVBL(options)] | ||
</syntaxhighlight><br /> | |||
|also= | |also= | ||
[[Introduction to Vision Blocking ]], {{func|getTokenVBL}} | [[Introduction to Vision Blocking ]], {{func|getTokenVBL}}, {{func|drawVBL}}, {{func|eraseVBL}} | ||
|changes= | |||
* '''1.9.0''' - VBL method must use the enum values {{code|DOUGLAS_PEUCKER_SIMPLIFIER}}, {{code|TOPOLOGY_PRESERVING_SIMPLIFIER}}, {{code|VW_SIMPLIFIER}}, or {{code|NONE}}. | |||
* '''1.6.0''' - Added support for auto-generation of VBL with {{code|shape:auto}}. | |||
}} | }} | ||
[[Category:Miscellaneous Function]] | [[Category:Miscellaneous Function]] | ||
[[Category:VBL Function]] | [[Category:VBL Function]] |
Latest revision as of 23:59, 14 March 2023
setTokenVBL() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.4.1.6
Sets the VBL of a token to that given in the JSON object parameter.
Usage
setTokenVBL(vbl, id)
This function is used to attach the TOKEN VBL passed in as a JSON object to a token. The JSON object may be be created by calling getTokenVBL() on a different token and may also be used with drawVBL() or eraseVBL().
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.
The method
parameter in the JSON object must use one of the following: DOUGLAS_PEUCKER_SIMPLIFIER
, TOPOLOGY_PRESERVING_SIMPLIFIER
, VW_SIMPLIFIER
, or NONE
.
Parameters
vbl
- A JSON object containing thevbl
to be added to the token. Use getTokenVBL() to get VBL from another token.id
- OPTIONAL: The tokenid
of the token for which you want to set this setting, defaults to the Current Token.
Example
Transfer VBL from one Token to another
[h: vbl = getTokenVBL("Door, Steel")]
[h: setTokenVBL(vbl, "Door, Wood")]
Erase VBL from Token
[r: finalVblData = "{'shape':'none'}"]
[r: setTokenVBL(finalVblData)]
Auto-generate VBL for the Current Token
[h: options = json.set("{}", "shape", "auto", "sensitivity", 10, "inverse", 0, "level", 2, "method", "DOUGLAS_PEUCKER_SIMPLIFIER", "r", 0, "g", 0, "b", 0, "a", 255)]
[h: setTokenVBL(options)]
See Also
Version Changes
- 1.9.0 - VBL method must use the enum values
DOUGLAS_PEUCKER_SIMPLIFIER
,TOPOLOGY_PRESERVING_SIMPLIFIER
,VW_SIMPLIFIER
, orNONE
. - 1.6.0 - Added support for auto-generation of VBL with
shape:auto
.