Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Script:Marking Conditions"

From Roll20 Wiki

Jump to: navigation, search
Line 6: Line 6:
 
|lastmodified=2015-01-09}}
 
|lastmodified=2015-01-09}}
  
The following script creates the API commands <code>!mark</code>, <code>!unmark</code>, and <code>!clearmark</code>
+
'''Marking Conditions''' creates the API commands <code>!mark</code>, <code>!unmark</code>, and <code>!clearmark</code>
 
<br clear="all">
 
<br clear="all">
  
==== Syntax ====
+
=== Syntax ===
<blockquote style="border:1px #0088ee solid;background:#eee;padding:0.5em">!mark ''tokenid'' [''status'' [''type'']]<br>
+
{{syntaxbox top|formal=true|Marking Conditions}}
!unmark ''tokenid'' [''status'' [''type'']]<br>
+
{{API command|mark}} {{API parameter|name=tokenid}} {{API parameter|name=status</em> {{API parameter|name=type|optional=true}}<em>|optional=true}}<br>
!clearmark ''tokenid''</blockquote>
+
{{API command|unmark}} {{API parameter|name=tokenid}} {{API parameter|optional=true|name=status</em> {{API parameter|optional=true|name=type}}<em>}}<br>
 +
{{API command|clearmark}} {{API parameter|name=tokenid}}
 +
{{Formal API command|
 +
{{token|S}} {{rarr}} {{API command|mark}} {{token|tokenid}} {{token|status|-}}
 +
{{token|S}} {{rarr}} {{API command|unmark}} {{token|tokenid}} {{token|status|-}}
 +
{{token|S}} {{rarr}} {{API command|clearmark}} {{token|tokenid|-}}
 +
{{token|tokenid}} {{rarr}} {{string|-}}
 +
{{token|status}} {{rarr}} {{epsilon}}
 +
{{token|status}} {{rarr}} {{string}}{{token|damage|-}}
 +
{{token|damage}} {{rarr}} {{epsilon}}
 +
{{token|damage}} {{rarr}} acid<br>
 +
{{token|damage}} {{rarr}} cold<br>
 +
{{token|damage}} {{rarr}} fire<br>
 +
{{token|damage}} {{rarr}} force<br>
 +
{{token|damage}} {{rarr}} lightning<br>
 +
{{token|damage}} {{rarr}} necrotic<br>
 +
{{token|damage}} {{rarr}} poison<br>
 +
{{token|damage}} {{rarr}} psychic<br>
 +
{{token|damage}} {{rarr}} radiant<br>
 +
{{token|damage}} {{rarr}} thunder
 +
}}
 +
{{syntaxbox end}}
  
{| class="wikitable"
+
{{param description top}}
|-
+
{{param description|name=tokenid|value=ID of a token object. This can be obtained with <code>@{target{{!}}token_id}</code> or <code>@{selected{{!}}token_id}</code>.}}
! Parameter
+
{{param description|name=status|value=Optional. Either the name of a [[API:Objects#Graphic (Token/Map/Card/Etc.)|statusmarker icon]], or else one of many aliases to D&D 4e conditions.
! Values
+
|-
+
| ''tokenid''
+
| The ID of the token to mark. Use <code><nowiki>@{target|token_id}</nowiki></code> or <code><nowiki>@{selected|token_id}</nowiki></code> to get this value.
+
|-
+
| ''status''
+
| (Optional) A D&D 4e status (except for dying, helpless, unconscious, insubstantial, or surprised) or the name of a [[API:Objects#Graphic (Token/Map/Card/Etc.)|statusmarker icon]]. The script has several aliases for the statuses. For example, immobilized, immobile, and immob all correspond to the same marker.
+
  
If ''status'' is not specified, the purple statusmarker will be used.
+
 
|-
+
If ''status'' is not specified, the purple statusmarker will be used.}}
| ''type''
+
{{param description|name=type|value=Optional. A D&D 4e damage type. Only used if ''status'' is "ongoing", "damage", or "dam". If supplied, should be one of:
| (Optional) A D&D 4e damage type. Only used if ''status'' is ''ongoing'', ''damage'', or ''dam''. One of:
+
 
* acid
 
* acid
 
* cold
 
* cold
Line 39: Line 52:
 
* radiant
 
* radiant
 
* thunder
 
* thunder
If ''type'' is not specified, a statusmarker to represent untyped damage will be used.
+
If ''type'' is not specified, a statusmarker to represent untyped damage will be used.}}
|}
+
{{param description bottom}}
  
 
The <code>!mark</code> command will set a marker, while the <code>!unmark</code> command will clear it. <code>!clearmark</code> will clear all markers from the token.
 
The <code>!mark</code> command will set a marker, while the <code>!unmark</code> command will clear it. <code>!clearmark</code> will clear all markers from the token.
  
==== Examples ====
+
==== Conditions and Aliases ====
'''!mark @{target|token_id} brown'''
+
The available ''status'' aliases and the D&D 4e conditions they map to are listed below.
<blockquote>This will set the brown marker on the target token.</blockquote>
+
  
'''!mark @{target|token_id} immob'''
+
{| class="wikitable"
<blockquote>This will set the 'immobilize' icon to the target token.</blockquote>
+
|-
 
+
! Condition
'''!mark @{selected|token_id} ongoing fire'''
+
! Aliases
<blockquote>This will mark the selected token with ongoing fire damage.</blockquote>
+
! Condition
 
+
! Aliases
'''!unmark @{selected|token_id}'''
+
|- style="vertical-align:top"
<blockquote>This will remove the purple (default) statusmarker from the selected token.</blockquote>
+
| style="width:100px" | '''Blinded'''
 
+
| style="width:200px" | blinded<br>blind
'''!clearmark @{selected|token_id}'''
+
| style="width:100px" | '''Prone'''
<blockquote>This will remove all markers from the selected token.</blockquote>
+
| style="width:200px" | prone
 
+
|- style="vertical-align:top"
[[Category:API Commands|Marking Conditions]]
+
|| '''Dazed'''
 +
|| dazed<br>daze
 +
|| '''Restrained'''
 +
|| restrained
 +
|- style="vertical-align:top"
 +
|| '''Deafened'''
 +
|| deafened<br>deaf
 +
|| '''Slowed'''
 +
|| slowed<br>slow
 +
|- style="vertical-align:top"
 +
|| '''Dominated'''
 +
|| dominated<br>dominate
 +
|| '''Stunned'''
 +
|| stunned<br>stun
 +
|- style="vertical-align:top"
 +
|| '''Immobilized'''
 +
|| immobilized<br>immobile<br>immob
 +
|| '''Weakened'''
 +
|| weakened<br>weak
 +
|- style="vertical-align:top"
 +
|| '''Marked'''
 +
|| marked<br>mark
 +
|| '''Ongoing Damage'''
 +
|| ongoing<br>damage<br>dam
 +
|- style="vertical-align:top"
 +
|| '''Petrified'''
 +
|| petrified<br>petrify<br>stone
 +
|| '''Dying<br>Helpless<br>Unconscious<br>Insubstantial<br>Surprised'''
 +
| style="width:200px" | '''''Marking Conditions''' explicitly does not handle these statuses, and will generate an error message if you try to use one.''
 +
|}

Revision as of 22:47, 9 January 2015

API ScriptAuthor: Brian
Version: 3.0
Last Modified: 2015-01-09
Code: Marking Conditions
Dependencies: splitArgs
Conflicts: None

Marking Conditions creates the API commands !mark, !unmark, and !clearmark

Syntax

!mark <tokenid> [status [type]]
!unmark <tokenid> [status [type]]
!clearmark <tokenid>
Formally:

S → !mark tokenid status
S → !unmark tokenid status
S → !clearmark tokenid
tokenidstring
status → ε
statusstringdamage
damage → ε
damage → acid
damage → cold
damage → fire
damage → force
damage → lightning
damage → necrotic
damage → poison
damage → psychic
damage → radiant
damage → thunder

Parameter Values
tokenid ID of a token object. This can be obtained with @{target|token_id} or @{selected|token_id}.
status Optional. Either the name of a statusmarker icon, or else one of many aliases to D&D 4e conditions.


If status is not specified, the purple statusmarker will be used.

type Optional. A D&D 4e damage type. Only used if status is "ongoing", "damage", or "dam". If supplied, should be one of:
  • acid
  • cold
  • fire
  • force
  • lightning
  • necrotic
  • poison
  • psychic
  • radiant
  • thunder

If type is not specified, a statusmarker to represent untyped damage will be used.

The !mark command will set a marker, while the !unmark command will clear it. !clearmark will clear all markers from the token.

Conditions and Aliases

The available status aliases and the D&D 4e conditions they map to are listed below.

Condition Aliases Condition Aliases
Blinded blinded
blind
Prone prone
Dazed dazed
daze
Restrained restrained
Deafened deafened
deaf
Slowed slowed
slow
Dominated dominated
dominate
Stunned stunned
stun
Immobilized immobilized
immobile
immob
Weakened weakened
weak
Marked marked
mark
Ongoing Damage ongoing
damage
dam
Petrified petrified
petrify
stone
Dying
Helpless
Unconscious
Insubstantial
Surprised
Marking Conditions explicitly does not handle these statuses, and will generate an error message if you try to use one.