setLayer: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Updated with recent version changes.) |
(Added examples of use, removed Stub note) |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=setLayer | |name=setLayer | ||
Line 23: | Line 22: | ||
{{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]].}} | ||
|examples= | |||
When an NPC token is dead, send it to the Object layer, otherwise leave it where it is. | |||
<source lang="mtmacro" line> | |||
[h: layerName = getLayer()] | |||
[h: layerName = if(state.Dead&&isNPC(), "OBJECT", layerName)] | |||
[h: setLayer(layerName)] | |||
</source> | |||
Toggle a token between the Hidden and Token layers. | |||
<source lang="mtmacro" line> | |||
[h: layerName = getLayer()] | |||
[h: layerName = if(layerName=="GM", "TOKEN", "GM")] | |||
[h: setLayer(layerName)] | |||
</source> | |||
|also= | |also= |
Revision as of 01:56, 28 April 2009
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)
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.
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.