From RPTools Wiki
Jump to navigation Jump to search

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

setTokenCoverVBL() Function

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

Introduced in version 1.15
Sets the Cover VBL of a token to that given in the JSON object parameter.


setTokenCoverVBL(jsonarray, id)

This function is used to attach the Cover 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.


  • vbl - A JSON object containing the VBL to be added to the token. Use getTokenVBL(), getTokeCoverVBL(), or similar to get VBL from another token.
  • id - OPTIONAL: The token id which becomes the container for the Cover VBL being set. Defaults to the Current Token.


Transfer Cover VBL from one token to another:
[h: vbl = getTokenVBL("Door, Steel")]
[h: setTokenCoverVBL(vbl, "Door, Wood")]

Erase Cover VBL from a token:

[r: finalVblData = "{'shape':'none'}"]
[r: setTokenCoverVBL(finalVblData)]

Auto-generate Cover 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: setTokenCoverVBL(options)]

See Also