setLight: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Function setLight==
{{MacroFunction
|name=setLight
|version=1.3b48
|description=
Sets the [[Introduction to Lights and Sights|light source]]s of the [[Current Token|Current Token]]. If the value is {{false}} then the [[Introduction to Lights and Sights|light source]] is turned off; otherwise, it is turned on.


Sets the [[Map:light source|light source]]s of the [[Token:Current Token|Current Token]]. If the value is 0 then the [[Map:light source|light source]] is turned off otherwise it is turned on.
|usage=
<syntaxhighlight lang="mtmacro" line>
setLight(type, name, value)
setLight(type, name, value, id)
setLight(type, name, value, id, mapname)
</syntaxhighlight>


===Usage===
'''Parameters'''
<source lang="mtmacro" line>
{{param|type|The light source type, (e.g. "Generic", "D20").}}
[h: lights = setLight(type, name, value)]
{{param|name|The name of the [[Introduction to Lights and Sights|light source]].}}
</source>
{{param|value|If {{true}} sets the light on, if {{false}} turns it off.}}
Where
{{param|id|The token {{code|id}} of the token to change the light sources, defaults to the [[Current Token]]. {{TrustedParameter}} }}
* type is the [[LightSource:type |type of light source]] (e.g. "Generic" or "D20").  
{{param|mapname|The name of the map to find the token. Defaults to the current map.}}
* name is the name of the [[LightSource:Light Source|Light Source]] to change (e.g. "Candle - 5").


|example=
<syntaxhighlight lang="mtmacro" line>
[h: setLight("D20", "Candle - 5", 1)]
</syntaxhighlight>


===Examples===
|changes=
<source lang="mtmacro" line>
{{change|1.5.4|Added {{code|id}} and {{code|mapname}} parameter options.}}
[h: setLight("D20", "Candle - 5", 1)]
 
</source>
}}
[[Category:Light Function]]
[[Category:Token Function]]

Latest revision as of 03:03, 22 August 2023

setLight() Function

Introduced in version 1.3b48
Sets the light sources of the Current Token. If the value is false(0) then the light source is turned off; otherwise, it is turned on.

Usage

setLight(type, name, value)
setLight(type, name, value, id)
setLight(type, name, value, id, mapname)

Parameters

  • type - The light source type, (e.g. "Generic", "D20").
  • name - The name of the light source.
  • value - If true(1) sets the light on, if false(0) turns it off.
  • id - The token id of the token to change the 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.

Example

[h: setLight("D20", "Candle - 5", 1)]


Version Changes

  • 1.5.4 - Added id and mapname parameter options.