switchToken

From RPTools Wiki
Revision as of 15:57, 13 September 2020 by Phergus (talk | contribs)
Jump to navigation Jump to search

switchToken() Function

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

Introduced in version 1.3b48
Changes the Current Token for the remainder of the Macro.

In practice, "the remainder of the Macro" is the same as the variable scope. Thus, if a macro is running as a user defined function (see defineFunction() ) with a new scope, switchToken will only apply until the end of the current macro. Once control passes back to the calling macro, the Current Token reverts back to what it was before the external macro was called ( as a function ). If a defineFunction() does not create a new variable scope for the called macro, then effects of switchToken persist when control passes back to the calling macro.

Note: You cannot switch to a token on a different map.

Usage

switchToken(tokenId)