removeToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Initial write-up.)
 
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 3: Line 3:
|name=removeToken
|name=removeToken
|trusted=true
|trusted=true
|version=1.3b53
|version=1.3b51
|description=
|description=
Removes a token from the current map.
Removes a token from the current map.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
removeToken(id)
removeToken(tokenRef)
</source>
removeToken(tokenRef, mapRef)
</syntaxhighlight>
'''Parameter'''
'''Parameter'''
{{param|id|The id of the token to remove.}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token to remove.}}
{{param|mapRef|The Name or ID of the map where the token is.}}
{{Note|Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.}}


One caveat, you can remove the impersonated token in a macro but if you do so you must make sure not to use any macro functions that refer to the deleted token or you will cause errors.
One caveat, you can remove the impersonated token in a macro but if you do so you must make sure not to use any macro functions that refer to the deleted token or you will cause errors.
==changes==
{{change|1.8.0|Added {{code|mapname}} parameter option.}}


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

Latest revision as of 23:59, 17 May 2024

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

removeToken() Function

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

Introduced in version 1.3b51
Removes a token from the current map.

Usage

removeToken(tokenRef)
removeToken(tokenRef, mapRef)

Parameter

  • tokenRef - Either the token id or Token Name of the token to remove.
  • mapRef - The Name or ID of the map where the token is.
Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.


One caveat, you can remove the impersonated token in a macro but if you do so you must make sure not to use any macro functions that refer to the deleted token or you will cause errors.

changes

  • 1.8.0 - Added mapname parameter option.