hasLightSource: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Unifying Current Token red link.) |
No edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|version=1.3b48 | |version=1.3b48 | ||
|description= | |description= | ||
Returns 1 if the [[Current Token]] has any [[ | Returns 1 if the [[Current Token]] has any [[Introduction to Lights and Sights|light source]]s that match the criteria passed in or 0 if there are no matches. If no arguments are passed to the function then it will return 1 if any [[Introduction to Lights and Sights|light source]] is on. If only the first argument is passed it will return 1 if any light source of that light source type is on. If both arguments are passed to the function it will return 1 if the light source with the specified name and specified light source type is on. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
hasLightSource() | hasLightSource() | ||
hasLightSource(type) | hasLightSource(type) | ||
hasLightSource(type, name) | hasLightSource(type, name) | ||
hasLightSource(type, name, id) | |||
hasLightSource(type, name, id, mapname) | |||
</syntaxhighlight> | |||
'''Parameters''' | |||
{{param|type|The light source type, (e.g. "Generic", "D20"). If "*" is entered, all light sources types are checked. Defaults to "*".}} | |||
If | {{param|name|the name of the [[Introduction to Lights and Sights|light source]]. If "*" is entered, all light sources names are checked. Defaults to "*".}} | ||
{{param|id|The token {{code|id}} of the token which is checked for light sources, defaults to the [[Current Token]]. {{TrustedParameter}} }} | |||
{{param|mapname|The name of the map to find the token. Defaults to the current map.}} | |||
|examples= | |examples= | ||
Check to see if any light source is on. | Check to see if any light source is on. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: l = hasLightSource()] | [h: l = hasLightSource()] | ||
</ | </syntaxhighlight> | ||
Check to see if a "D20" lamp is on. | Check to see if a "D20" lamp is on. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: l = hasLightSource("D20", "Lamp - 15")] | [h: l = hasLightSource("D20", "Lamp - 15")] | ||
</ | </syntaxhighlight> | ||
Check to see if any "D20" light source is on. | Check to see if any "D20" light source is on. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: l = hasLightSource("D20") | [h: l = hasLightSource("D20") | ||
</ | </syntaxhighlight> | ||
|changes= | |||
{{change|1.5.4|Added {{code|id}} and {{code|mapname}} parameter options. Changed behavior if {{code|type}} or {{code|name}} are set to "*".}} | |||
}} | }} | ||
[[Category:Light Function]] | [[Category:Light Function]] |
Latest revision as of 16:01, 15 March 2023
hasLightSource() Function
• Introduced in version 1.3b48
Returns 1 if the Current Token has any light sources that match the criteria passed in or 0 if there are no matches. If no arguments are passed to the function then it will return 1 if any light source is on. If only the first argument is passed it will return 1 if any light source of that light source type is on. If both arguments are passed to the function it will return 1 if the light source with the specified name and specified light source type is on.
Usage
hasLightSource()
hasLightSource(type)
hasLightSource(type, name)
hasLightSource(type, name, id)
hasLightSource(type, name, id, mapname)
Parameters
type
- The light source type, (e.g. "Generic", "D20"). If "*" is entered, all light sources types are checked. Defaults to "*".name
- the name of the light source. If "*" is entered, all light sources names are checked. Defaults to "*".id
- The tokenid
of the token which is checked for 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.
Examples
Check to see if any light source is on.
[h: l = hasLightSource()]
Check to see if a "D20" lamp is on.
[h: l = hasLightSource("D20", "Lamp - 15")]
Check to see if any "D20" light source is on.
[h: l = hasLightSource("D20")
Version Changes
- 1.5.4 - Added
id
andmapname
parameter options. Changed behavior iftype
orname
are set to "*".