sendToBack: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added note about current bug in 1.3.b63)
No edit summary
Line 10: Line 10:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
sendToBack()
sendToBack()
</source>
<source lang="mtmacro" line>
sendToBack(id)
sendToBack(id)
sendToBack(id, mapname)
</source>
</source>
'''Parameter'''
'''Parameter'''
{{param|id|The token {{code|id}} or name of the token that has its z-order changed, defaults to the [[Current Token]]. {{TrustedParameter}} }}
{{param|id|The token {{code|id}} or name of the token that has its z-order changed, defaults to the [[Current Token]]. {{TrustedParameter}} }}
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}


|examples=
|examples=
Line 37: Line 38:
|changes=
|changes=
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.3b51|Added {{code|id}} parameter option.}}
{{change|1.5.4|Added {{code|mapname}} parameter option.}}


}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Revision as of 20:35, 15 August 2019

sendToBack() Function

Introduced in version 1.3b48
Adjust the z-order (or draw order) of the Token so that it is drawn before all other Tokens on the same Map Layer, this has the effect of making the Token appear to be in back of the other Tokens as it will be obscured by other Tokens on the same Map Layer in the same location. As of 1.3.b63 there appears to be a bug in which token states are not rendered properly after calling sendToBack or bringToFront. As a work-around, macros should change the token ordering first, then turn states on or off.

Usage

sendToBack()
sendToBack(id)
sendToBack(id, mapname)

Parameter

  • id - The token id or name of the token that has its z-order changed, defaults to the Current Token.

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

  • mapname - The name of the map to find the token. Defaults to the current map.

Examples

Sends the Current Token to the lowest z-order.
[h: sendToBack()]

Sends all of the selected tokens to the lowest z-order.

[h: tokens = getSelected()]
[h, foreach(id, tokens, ""), code:
{
    [h: sendToBack(id)]
}]

See Also

Version Changes

  • 1.3b51 - Added id parameter option.
  • 1.5.4 - Added mapname parameter option.