isBarVisible: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Corrected "examples" header.) |
No edit summary |
||
(9 intermediate revisions by 5 users not shown) | |||
Line 3: | Line 3: | ||
|version=1.3b46 | |version=1.3b46 | ||
|description= | |description= | ||
Returns {{true}} if the specified [[Token Bar]] on the [[Current Token]] is visible, or {{false}} if it is not. | Returns {{true}} if the specified [[Introduction to Bars|Token Bar]] on the [[Current Token]] is visible, or {{false}} if it is not. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
isBarVisible(bar) | isBarVisible(bar) | ||
</ | isBarVisible(bar, tokenRef) | ||
isBarVisible(bar, tokenRef, mapRef) | |||
</syntaxhighlight> | |||
'''Parameters''' | '''Parameters''' | ||
{{param|bar|A string that contains the name of the bar that has its visibility checked.}} | {{param|bar|A string that contains the name of the bar that has its visibility checked.}} | ||
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token which has its bar checked, defaults to the [[Current Token]]. {{TrustedParameter}} }} | |||
{{param|mapRef|The Name or ID of the map to find the token. Defaults to the current map.}} | |||
{{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.}} | |||
|examples= | |examples= | ||
Displays {{code|The health bar is visible!}} if the bar named {{code|Health}} is set to visible; otherwise it displays {{code|The health bar is not visible!}}. | Displays {{code|The health bar is visible!}} if the bar named {{code|Health}} is set to visible; otherwise it displays {{code|The health bar is not visible!}}. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[if(isBarVisible("Health"), code: | [if(isBarVisible("Health")), code: | ||
{ | { | ||
The health bar is visible! | The health bar is visible! | ||
Line 21: | Line 27: | ||
The health bar is not visible! | The health bar is not visible! | ||
}] | }] | ||
</ | </syntaxhighlight> | ||
Toggles the visibility of the bar named {{code|Fatigue}}. | Toggles the visibility of the bar named {{code|Fatigue}}. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: setBarVisible("Fatigue", !isBarVisible("Fatigue"))] | [h: setBarVisible("Fatigue", !isBarVisible("Fatigue"))] | ||
[h: abort(0)] | [h: abort(0)] | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
Line 33: | Line 39: | ||
{{func|getBar}}, | {{func|getBar}}, | ||
{{func|setBar}} | {{func|setBar}} | ||
|changes= | |||
{{change|1.5.7|Added {{code|id}} and {{code|mapname}} parameter options.}} | |||
}} | }} | ||
==Related Pages== | |||
* [[HP and Health Bars]] | |||
* [[bar.name|The <code>bar.name</code> special variable]] | |||
[[Category:Bar Function]] | [[Category:Bar Function]] |
Latest revision as of 23:59, 11 May 2024
isBarVisible() Function
• Introduced in version 1.3b46
Returns
true
(1
) if the specified Token Bar on the Current Token is visible, or false
(0
) if it is not.Usage
isBarVisible(bar)
isBarVisible(bar, tokenRef)
isBarVisible(bar, tokenRef, mapRef)
Parameters
bar
- A string that contains the name of the bar that has its visibility checked.tokenRef
- Either the tokenid
or Token Name of the token which has its bar checked, defaults to the Current Token.Note: This parameter can only be used in a Trusted Macro.
mapRef
- The Name or ID of the map to find the token. Defaults to the current map.
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.
Examples
Displays
The health bar is visible!
if the bar named Health
is set to visible; otherwise it displays The health bar is not visible!
.
[if(isBarVisible("Health")), code:
{
The health bar is visible!
};{
The health bar is not visible!
}]
Toggles the visibility of the bar named Fatigue
.
[h: setBarVisible("Fatigue", !isBarVisible("Fatigue"))]
[h: abort(0)]
See Also
Version Changes
- 1.5.7 - Added
id
andmapname
parameter options.