hasLightSource: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Macros:Functions:hasLightSource moved to hasLightSource: Moved out of Macros namespace)
m (Added MacroFunction template and Light Function category)
Line 1: Line 1:
==Function hasLightSource==
{{MacroFunction
 
|name=hasLightSource
|description=
Returns 1 if the [[Token:Current Token|Current Token]] has any [[LightSource:light source|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 [[LightSource:light source|light source]] is on. If only the first argument is passed it will return 1 if any [[LightSource:light source|light source]] of that [[LightSource:light source type|light source type]] is on. If both arguments are passed to the function it will return 1 if the [[LightSource:light source|light source]] with the specified name and specified [[LightSource:light source type|light source type]] is on.
Returns 1 if the [[Token:Current Token|Current Token]] has any [[LightSource:light source|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 [[LightSource:light source|light source]] is on. If only the first argument is passed it will return 1 if any [[LightSource:light source|light source]] of that [[LightSource:light source type|light source type]] is on. If both arguments are passed to the function it will return 1 if the [[LightSource:light source|light source]] with the specified name and specified [[LightSource:light source type|light source type]] is on.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: hasLight = hasLightSource()]
[h: hasLight = hasLightSource()]
Line 17: Line 18:
If delim is specified then it is used to separate the values in the list, if it is not specified then it defaults to ','.
If delim is specified then it is used to separate the values in the list, if it is not specified then it defaults to ','.


===Examples===
|examples=
Check to see if any light source is on.
Check to see if any light source is on.
<source lang="mtmacro" line>
<source lang="mtmacro" line>
Line 32: Line 33:
[h: l = hasLightSource("D20")
[h: l = hasLightSource("D20")
</source>
</source>
}}
[[Category:Light Function]]

Revision as of 04:07, 8 March 2009

hasLightSource() Function

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

[h: hasLight = hasLightSource()]
[h: hasLight = hasLightSource(type)]
[h: hasLight = hasLightSource(type, name)]

Where


If delim is specified then it is used to separate the values in the list, if it is not specified then it defaults to ','.

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")