setLayer: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
setLayer(layer) | setLayer(layer) | ||
setLayer(layer, id) | setLayer(layer, id) | ||
setLayer(layer, id, mapname) | setLayer(layer, id, forceshape) | ||
setLayer(layer, id, forceshape, mapname) | |||
</source> | </source> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|layer|The layer to move the [[Token]] to.}} | {{param|layer|The layer to move the [[Token]] to.}} | ||
{{param|id|The token {{code|id}} of the token which has its layer set, defaults to the [[Current Token]].}} | {{param|id|The token {{code|id}} of the token which has its layer set, defaults to the [[Current Token]].}} | ||
{{param|forceshape|}}If {{true}}, change the token shape type to TOP_DOWN if the layer is "Object", and to a shape reflecting its image if the layer is "Token". Defaults to {{true}}. | |||
{{param|mapname|The name of the map to find the token. Defaults to the current map.}} | {{param|mapname|The name of the map to find the token. Defaults to the current map.}} | ||
Revision as of 06:10, 16 August 2019
setLayer() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.3b48
Sets the Map Layer that a Token is on.
The Map Layer is one of:
TOKEN
GM
also known as HiddenOBJECT
BACKGROUND
Usage
setLayer(layer)
setLayer(layer, id)
setLayer(layer, id, forceshape)
setLayer(layer, id, forceshape, mapname)
Parameters
layer
- The layer to move the Token to.id
- The tokenid
of the token which has its layer set, defaults to the Current Token.forceshape
- Iftrue
(1
), change the token shape type to TOP_DOWN if the layer is "Object", and to a shape reflecting its image if the layer is "Token". Defaults totrue
(1
).mapname
- The name of the map to find the token. Defaults to the current map.
Examples
When an NPC token is dead, send it to the Object layer, otherwise leave it where it is.
[h: layerName = getLayer()]
[h: layerName = if(state.Dead&&isNPC(), "OBJECT", layerName)]
[h: setLayer(layerName)]
Toggle a token between the Hidden and Token layers.
[h: layerName = getLayer()]
[h: layerName = if(layerName=="GM", "TOKEN", "GM")]
[h: setLayer(layerName)]
See Also
Version Changes
- 1.3b51 - Added
id
parameter option. - 1.5.4 - Added
mapname
parameter option.