getLights: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Fixing broken wikiLinks, pointing to Lights and Sights tutorial)
Line 2: Line 2:
|name=getLights
|name=getLights
|version=1.3b48
|version=1.3b48
|description=Returns a string list containing the names of the [[Map:light source{{!}}light source]]s that are turned on for the [[Current Token]]. The type of the value returned depends on the delimiter parameter.  
|description=Returns a string list containing the names of the [[Introduction to Lights and Sights|light source]]s that are turned on for the [[Current Token]]. The type of the value returned depends on the delimiter parameter.  


|usage=
|usage=
Line 14: Line 14:


'''Parameters'''
'''Parameters'''
{{param|type|The [[LightSource:light source type|light source type]], (e.g. "Generic", "D20"). If set to "*", all light sources are returned. Defaults to "*".}}
{{param|type|The light source type, (e.g. "Generic", "D20"). If set to "*", all light sources are returned. Defaults to "*".}}
{{param|delim|The delimiter used to separate values in the [[Macros:string list{{!}}string list]]. If set to "json", a [[JSON Array]] is returned. Defaults to ",".}}
{{param|delim|The delimiter used to separate values in the [[Macros:string list{{!}}string list]]. If set to "json", a [[JSON Array]] is returned. Defaults to ",".}}
{{param|id|The token {{code|id}} of the token to change the light sources, defaults to the [[Current Token]]. {{TrustedParameter}} }}
{{param|id|The token {{code|id}} of the token to change the light sources, defaults to the [[Current Token]]. {{TrustedParameter}} }}
Line 20: Line 20:


|examples=
|examples=
To get a [[Macros:string list{{!}}string list]] of all of the [[LightSource:light source]]s that the current [[Token:token{{!}}token]] has on.
To get a [[Macros:string list{{!}}string list]] of all of the [[Introduction to Lights and Sights|light source]]s that the current [[Token:token{{!}}token]] has on.
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[getLights()]
[getLights()]
</source>
</source>


To get a [[Macros:string list{{!}}string list]] of the [[LightSource:light source]]s that the current [[Token:token{{!}}token]] has on with the [[LightSource:type{{!}} lighet source type]] of "Generic".
To get a [[Macros:string list{{!}}string list]] of the [[Introduction to Lights and Sights|light source]]s that the current [[Token:token{{!}}token]] has on with the light source type of "Generic".
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[getLights("Generic")]
[getLights("Generic")]

Revision as of 02:13, 6 February 2021

getLights() Function

Introduced in version 1.3b48
Returns a string list containing the names of the light sources that are turned on for the Current Token. The type of the value returned depends on the delimiter parameter.

Usage

getLights()
getLights(type)
getLights(type, delim)
getLights(type, delim, id)
getLights(type, delim, id, mapname)

Parameters

  • type - The light source type, (e.g. "Generic", "D20"). If set to "*", all light sources are returned. Defaults to "*".
  • delim - The delimiter used to separate values in the string list. If set to "json", a JSON Array is returned. Defaults to ",".
  • 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.

Examples

To get a string list of all of the light sources that the current token has on.
[getLights()]

To get a string list of the light sources that the current token has on with the light source type of "Generic".

[getLights("Generic")]

Version Changes

  • 1.3b49 - Added "json" delimiter option.
  • 1.5.4 - Added id and mapname parameter options.