canSeeToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Text replacement - "source>" to "syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
Line 13: Line 13:


|usage=
|usage=
<source lang="mtmacro">
<syntaxhighlight lang="mtmacro">
canSeeToken(target)
canSeeToken(target)
canSeeToken(target, source)
canSeeToken(target, source)
Line 25: Line 25:
|example=
|example=


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
<!-- Dragon token partially hidden by VBL from current token. -->
<!-- Dragon token partially hidden by VBL from current token. -->
[r: canSeeToken("Dragon")]
[r: canSeeToken("Dragon")]
Line 35: Line 35:
</syntaxhighlight>
</syntaxhighlight>
Returns:
Returns:
<source lang="javascript">
<syntaxhighlight lang="javascript">
["TOP_LEFT", "TOP_RIGHT", "CENTER"]
["TOP_LEFT", "TOP_RIGHT", "CENTER"]
[]
[]

Revision as of 18:56, 14 March 2023

canSeeToken() Function

Introduced in version 1.3b77
Returns a json array of the points visible on the target token from the source token as an enumerated list. Default source is Current Token. The enumerated list will contain zero to five of the following values:
  • TOP_RIGHT
  • BOTTOM_RIGHT
  • TOP_LEFT
  • BOTTOM_LEFT
  • CENTER
When a token is not visible, an empty json array is returned: '[]'

Usage

canSeeToken(target)
canSeeToken(target, source)
canSeeToken(target, source, mapname)

Parameters

  • target - Either the token ID or name of the target token.
  • source - Either the token ID or name of the source, i.e. viewing token.
  • mapname - The name of the map to find the two tokens. Defaults to the current map.

Example

<!-- Dragon token partially hidden by VBL from current token. -->
[r: canSeeToken("Dragon")]
<!-- Troll token completely hidden from Elf token. -->
[r: canSeeToken("Troll","Elf")]
<!-- Troll token visible to Hero token. -->
[r: canSeeToken("Troll","Token")]

Returns:

["TOP_LEFT", "TOP_RIGHT", "CENTER"]
[]
["TOP_LEFT", "BOTTOM_LEFT", "TOP_RIGHT", "BOTTOM_RIGHT", "CENTER"]

See Also

Version Changes

  • 1.5.4 - Added mapname parameter option.