findToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
(Function also accepts token ID as parameter.)
Line 3: Line 3:
|trusted=true
|trusted=true
|version=1.3b48
|version=1.3b48
|description=Finds a [[Token:token|token]] on the current [[Map:map|map]] by the [[Token:token|token]] name or GM name and returns its id. If the [[Token:token|token]] is not found then an empty string "" is returned.
|description=Finds a [[Token:token|token]] on the current [[Map:map|map]] by the [[Token:token|token]] name, GM name, or ID and returns its id. If the [[Token:token|token]] is not found then an empty string "" is returned.


|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
findToken(name)
findToken(name/ID)
</source>
</source>
'''Parameters'''
{{param|name/ID|Either the name of the token or the ID.}}


|example=
|example=
Line 16: Line 18:
</source>
</source>
}}
}}
[[Category:Find Function]]
[[Category:Find Function]][[Category:Token Function]]

Revision as of 02:46, 10 July 2019

findToken() Function

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

Introduced in version 1.3b48
Finds a token on the current map by the token name, GM name, or ID and returns its id. If the token is not found then an empty string "" is returned.

Usage

findToken(name/ID)

Parameters

  • name/ID - Either the name of the token or the ID.

Example

[h: id = findToken("Hero")]
[if (id == "", "Token not found!", "Token found")]