setTokenPitVBL: Difference between revisions
m (Added description; fleshed out the rest of the page) |
m (Added description; fleshed out the rest of the page) |
(No difference)
|
Latest revision as of 23:59, 5 June 2023
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
setTokenPitVBL() Function
Note: This function can only be used in a Trusted Macro
Usage
setTokenPitVBL(jsonarray)
setTokenPitVBL(jsonarray, id)
This function is used to attach the Pit VBL passed in as a JSON object to a token. The JSON object may be be created by calling getTokenVBL() (or similar) on a different token, and may also be used with any of the drawVBL() or eraseVBL() functions.
Token VBL of any kind moves with the token, can be set under the VBL tab on the Token Editor Dialog and is colored YELLOW. Normal VBL is static, can be created with the VBL drawing tools or with the use of the VBL functions, and is colored BLUE.
The method
parameter in the JSON object must use one of the following (a link is provided for descriptions of each):
DOUGLAS_PEUCKER_SIMPLIFIER
(see Wikipedia),TOPOLOGY_PRESERVING_SIMPLIFIER
(see sample Java implementation notes),VW_SIMPLIFIER
(see Wikipedia), orNONE
.
Parameters
vbl
- A JSON object containing the VBL to be added to the token. Use getTokenVBL(), getTokenHillVBL(), or getTokenPitVBL() to get VBL from another token.id
- OPTIONAL: The tokenid
which becomes the container for the Pit VBL being set. Defaults to the Current Token.
Example
[h: vbl = getTokenVBL("Door, Steel")]
[h: setTokenPitVBL(vbl, "Door, Wood")]
Erase Hill VBL from a token:
[r: finalVblData = "{'shape':'none'}"]
[r: setTokenPitVBL(finalVblData)]
Auto-generate Hill 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: setTokenPitVBL(options)]