findToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==Function findToken==
{{MacroFunction
{{TrustedOnlyFunction}}
|name=findToken
|trusted=true
|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.


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.
|usage=
 
 
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: id = findToken(name)]
[h: id = findToken(name)]
</source>
</source>


===Examples===
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: id = findToken("Hero")]
[h: id = findToken("Hero")]
[if (id == "", "Token not found!", "Token found")]
[if (id == "", "Token not found!", "Token found")]
</source>
</source>
}}
[[Category:Token Function]]

Revision as of 02:09, 7 March 2009

findToken() Function

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

Finds a token on the current map by the token name or GM name and returns its id. If the token is not found then an empty string "" is returned.

Usage

[h: id = findToken(name)]

Example

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