getVisible: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Function getVisible==
{{stub|Examples of usage.}}
{{TrustedOnlyFunction}}
{{MacroFunction
Returns 1 if the [[Token:visible to players|visible to players]] flag is set on the [[Token:Current Token|Current Token]] otherwise returns 0. The [[Token:visible to players|visible to players]] flag has two meanings, on a normal [[Token:Token|Token]] players will only be able to see the [[Token:Token|Token]] if it is set (when all other things like [[Map:Fog of War|Fog of War]] etc are taken into account). If it is a [[Token:LibToken|LibToken]] then it determines if players can call [[Macro:Macros|Macros]] using [[Macro:Roll:macro | [macro(...): ...] ]].
|name=getVisible
|version=1.3b40
|description=
Returns {{true}} if the [[Introduction_to_Tokens#Visible_to_Players|visible to players]] flag is set on a [[Token]] otherwise returns {{false}}. The [[Introduction to Tokens#Visible to Players|visible to players]] flag has two meanings, on a normal [[Token]] players will only be able to see the [[Token]] if it is set (when all other things like [[Fog of War|Fog of War]] etc are taken into account). If it is a [[Library Token]] then it determines if players can call Macros using {{roll|macro}}.


===Usage===
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: isVis2Players = getVisible()]
getVisible()
</source>
</syntaxhighlight>
<syntaxhighlight lang="mtmacro" line>
getVisible(tokenRef)
</syntaxhighlight>
'''Parameter'''
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token that has its player visibility checked, defaults to the [[Current Token]]. {{TrustedParameter}} }}
{{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.}}
 
|also=
[[setVisible|setVisible()]]
 
|changes=
{{change|1.3b51|No longer a trusted function, added {{code|id}} parameter option.}}
 
}}
[[Category:Token Function]]

Latest revision as of 16:42, 14 May 2024

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

getVisible() Function

Introduced in version 1.3b40
Returns true(1) if the visible to players flag is set on a Token otherwise returns false(0). The visible to players flag has two meanings, on a normal Token players will only be able to see the Token if it is set (when all other things like Fog of War etc are taken into account). If it is a Library Token then it determines if players can call Macros using [macro():].

Usage

getVisible()
getVisible(tokenRef)

Parameter

  • tokenRef - Either the token id or Token Name of the token that has its player visibility checked, defaults to the Current Token.

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

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.


See Also

Version Changes

  • 1.3b51 - No longer a trusted function, added id parameter option.