clearLights: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Function clearLights==
{{MacroFunction
|name=clearLights
|version=1.3b48
|description=Turns off all of the [[Introduction to Lights and Sights|light source]]s for the [[Current Token]].


Clears all of the [[LightSource:light source|light source]]s for the[[Token:Current Token|Current Token]].
|usage=
<syntaxhighlight lang="mtmacro" line>
clearLights()
clearLights(tokenRef)
clearLights(tokenRef, mapname)
</syntaxhighlight>


'''Usage'''
'''Parameters'''
<source lang="mtmacro" line>
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token for which to turn off all light sources, defaults to the [[Current Token]]. {{TrustedParameter}} }}
{{param|mapname|The name 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=
To turn off all of the light sources for the current token.
<syntaxhighlight lang="mtmacro" line>
[h: clearLights()]
[h: clearLights()]
</source>
</syntaxhighlight>
 
To turn off all the lights sources on the map you could run the following script, note you will have to be the GM or run it
as part of a trusted macro.
<syntaxhighlight lang="mtmacro" line>
Ok Kids lights out!
[h,foreach(tok, getTokens()), code: { [token(tok): clearLights()]}]
</syntaxhighlight>
 
|changes=
{{change|1.5.4|Added {{code|id}} and {{code|mapname}} parameter options.}}
 
}}
[[Category: Light Function]]

Latest revision as of 20:36, 12 May 2024

clearLights() Function

Introduced in version 1.3b48
Turns off all of the light sources for the Current Token.

Usage

clearLights()
clearLights(tokenRef)
clearLights(tokenRef, mapname)

Parameters

  • tokenRef - Either the token id or Token Name of the token for which to turn off all light sources, 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.
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

To turn off all of the light sources for the current token.
[h: clearLights()]

To turn off all the lights sources on the map you could run the following script, note you will have to be the GM or run it as part of a trusted macro.

Ok Kids lights out!
[h,foreach(tok, getTokens()), code: { [token(tok): clearLights()]}]

Version Changes

  • 1.5.4 - Added id and mapname parameter options.