setBarVisible: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function setBarVisible== Sets if the specified bar for the Current Token is visible or not. If the value is non zero then the Token:bar is visi...)
 
No edit summary
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Function setBarVisible==
{{MacroFunction
Sets if the specified [[Token:bar|bar]] for the [[Token:Current Token|Current Token]] is visible or not. If the value is non zero then the [[Token:bar|bar]] is visible, if it is 0 it is not visible.
|name=setBarVisible
|version=1.3b46
|description=
Sets if the specified [[Token:bar|bar]] for the [[Current Token]] is visible or not. If the value is non zero then the [[Token:bar|bar]] is visible, if it is 0 it is not visible.


===Usage===
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: setBarVisible(name, value)]
setBarVisible(name, value)
</source>
setBarVisible(name, value, id)
setBarVisible(name, value, id, mapname)
</syntaxhighlight>


===Examples===
'''Parameters'''
Make "health" [[Token:bar|bar]] for the [[Token:Current Token|Current Token]] visible.
{{param|bar|A string that contains the name of the bar that has its visibility set.}}
<source lang="mtmacro" line>
{{param|value|The visibility value of the bar, either 0 or 1.}}
[h: setBarVisible("health", 1)]
{{param|id|The token {{code|id}} of the token which has its bar visibility set, defaults to the [[Current Token]]. {{TrustedParameter}} }}
</source>
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}


Hide "health" [[Token:bar|bar]] for the [[Token:Current Token|Current Token]].
|examples=
<source lang="mtmacro" line>
Make "health" [[Token:bar|bar]] for the [[Current Token]] visible.
[h: setBarVisible("health", 0)]
<syntaxhighlight lang="mtmacro" line>
</source>
[h: setBarVisible("Health", 1)]
</syntaxhighlight>
 
Hide "health" [[Token:bar|bar]] for the [[Current Token]].
<syntaxhighlight lang="mtmacro" line>
[h: setBarVisible("Health", 0)]
</syntaxhighlight>
 
|also=
{{func|isBarVisible}},
{{func|getBar}},
{{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]]

Latest revision as of 21:08, 14 March 2023

setBarVisible() Function

Introduced in version 1.3b46
Sets if the specified bar for the Current Token is visible or not. If the value is non zero then the bar is visible, if it is 0 it is not visible.

Usage

setBarVisible(name, value)
setBarVisible(name, value, id)
setBarVisible(name, value, id, mapname)

Parameters

  • bar - A string that contains the name of the bar that has its visibility set.
  • value - The visibility value of the bar, either 0 or 1.
  • id - The token id of the token which has its bar visibility set, defaults to the Current Token.

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

  • mapname - The name of the map to find the token. Defaults to the current map.

Examples

Make "health" bar for the Current Token visible.
[h: setBarVisible("Health", 1)]

Hide "health" bar for the Current Token.

[h: setBarVisible("Health", 0)]

See Also

Version Changes

  • 1.5.7 - Added id and mapname parameter options.

Related Pages