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:Token Mod"

From Roll20 Wiki

Jump to: navigation, search
m (update link)
m
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The Aaron's TokenMod API Script.
+
{{script overview
 +
|name=TokenMod
 +
|author=[[Aaron|Aaron C. M.]]}}
 +
{{main|API:Script Index}}
  
TokenMod provides an interface to setting almost all settable properties of a token.
+
The Aaron's TokenMod API Script. '''TokenMod''' provides an interface to setting almost all changeable properties of a token. [[Players]] can also use it to edit [[tokens]] they control, with option to edit/target other's tokens.  
  
'''Commands:''' <code><nowiki>!token-mod <--help|--ignore-selected|--config|--on|--off|--flip|--set> <parameter> [<parameter> ...] ... [ --ids <token id> [<token id> ...]]</nowiki></code>
+
It's among the most popular APIs, and is quickly updated every time Roll20 makes new API keys accessible.
  
Full User documnetation can be found in the API Script dropdown menu when the script is selected.
+
* '''{{fpl|10136003/ Update v0.8.69  June 2021}}''' -- Support for Token Bar Location, Compact Token Bars,  Light Sensitivity Multiplier (UDL), and Night Vision Effect (UDL)
 +
* '''{{fpl|10255908/ Update 0.8.71 }}''' -- includes support for lightColor
  
The latest version can be found here: [https://github.com/shdwjk/Roll20API/tree/master/TokenMod GitHub link]
+
 
 +
'''Commands:''' <pre>!token-mod <--help|--ignore-selected|--config|--on|--off|--flip|--set> <parameter> [<parameter> ...] ... [ --ids <token id> [<token id> ...]]</pre>
 +
 
 +
'''Full user documentation''' can be found in the '''Help: TokenMod'''-Handout in-game, or by running the command '''<code>!token-mod --help</code>'''.
 +
 
 +
* {{repo|shdwjk/Roll20API/tree/master/TokenMod TokenMod sourcecode}} - lastest version
 +
* {{forum|post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area TokenMod Forum thread}}
 +
 
 +
==Config==
 +
Enable players to target/edit tokens they don't control(is also a button in the config menu):
 +
<pre>!token-mod --config players-can-ids|on
 +
</pre>
 +
 
 +
==Examples==
 +
Some examples of <code>!token-mod</code> commands, with possible explanations. Examples are taken from the forum thread or in-game documentation.
 +
 
 +
<pre style="overflow:auto;white-space:pre-wrap;" data-language="javascript">
 +
 
 +
!token-mod --on showname            // show nameplate
 +
!token-mod --set layer|gmlayer      // move to gmlayer
 +
!token-mod --set bar1_value|-3      // decrease value of bar 3 by 3
 +
!token-mod --set name|"Sir Thomas" bar1_value|23      //Setting a token's name to "Sir Thomas" and bar1 value to 23
 +
!token-mod --set represents|@{Bob|character_id} defaulttoken      // sets the default token for that character, a quick way to update the default token
 +
!token-mod --set statusmarkers|blue|broken-shield      //adds the 2 status markers to the token
 +
!token-mod --move 3g                // move token 3 grids in the current facing(up being default)
 +
!token-mod --move =90|2u          // moves 2 grids to the right(ignoring current facing)
 +
 
 +
//Various examples
 +
!token-mod --on showplayers_aura1 --set aura1_radius|35 aura1_color|0000ff //Turning on aura1 for players, setting it's radius to 35, setting it's color to blue
 +
!token-mod --set bar[[1d3]]_value|X statusmarkers|blue:[[1d9]]|green:[[1d9]] name:"[[1t[randomName]]]"    // use inline rolls to set values
 +
!token-mod --set width|25s height|35s    // 's' represent the unit of measurement for the page
 +
!token-mod --set scale|*2
 +
!token-mod --set imgsrc|https://s3.amazonaws.com/files.d20.io/images/4095816/086YSl3v0Kz3SlDAu245Vg/max.png?1400535580        // change token image
 +
 
 +
//Sidenumber Multi-sided tokens
 +
!token-mod --set currentside|2
 +
!token-mod --set currentside|+      //shift side by 1
 +
!token-mod --set currentside|*      //set random side
 +
 
 +
//Controlled by
 +
!token-mod --set controlledby|bob
 +
!token-mod --set controlledby|+susan|+tommy        //add susan & tommy to list
 +
!token-mod --set controlledby|=@{target|token_id}  //copy controlled by from other token
 +
!token-mod --set controlledby|                      //nobody
 +
!token-mod --set controlledby|all                  //all players
 +
 
 +
//Legacy DL examples
 +
!token-mod --set light_radius|40 light_dimradius|20 adv_fow_view_distance|30
 +
 
 +
//Chaining multiple TokenMod commands
 +
!token-mod {{
 +
  --set
 +
    represents|@{bob|character_id}
 +
    bar1_link|hp
 +
    bar2_link|speed
 +
    bar3_link|ac
 +
    controlledby|tom|sally|nancy
 +
    statusmarkers|blue:3|red:[[1d6]]
 +
    defaulttoken
 +
}}
 +
 
 +
</pre>
 +
===Color Light dropdown===
 +
"a macro to change the light colour emitted by a token. Included are the basic colours and a collection of some others that I thought would be interesting." - {{fpl|10266190/ source}}
 +
 
 +
<pre style="overflow:auto;white-space:pre-wrap;">!token-mod ?{Colour|Black, --set lightColor#000000|Silver, --set lightColor#c0c0c0|Gray, --set lightColor#808080|White, --set lightColor#ffffff|Maroon, --set lightColor#800000|Red, --set lightColor#ff0000|Purple, --set lightColor#800080|Fuchsia, --set lightColor#9900ff|Pink, --set lightColor#ffc0cb|Green, --set lightColor#008000|Lime, --set lightColor#00ff00|Olive, --set lightColor#808000|Yellow, --set lightColor#ffff00|Navy, --set lightColor#000080|Blue, --set lightColor#0000ff|Teal, --set lightColor#008080|Aqua, --set lightColor#00ffff|Orange, --set lightColor#ffa500|-,
 +
|Aquamarine, --set lightColor#7fffd4|Coral, --set lightColor#ff7f50|Cornflowerblue, --set lightColor#6495ed|Crimson, --set lightColor#dc143c|Darkcyan, --set lightColor#008b8b|Darkgreen, --set lightColor#006400|Darkseagreen, --set lightColor#8fbc8f|Deeppink, --set lightColor#ff1493|Firebrick, --set lightColor#b22222|Gold, --set lightColor#ffd700|Goldenrod, --set lightColor#daa520|Lavender, --set lightColor#e6e6fa|Orangered, --set lightColor#ff4500|Saddlebrown, --set lightColor#8b4513|Salmon, --set lightColor#fa8072|Seagreen, --set lightColor#2e8b57|Skyblue, --set lightColor#87ceeb|Violet, --set lightColor#ee82ee|Wheat, --set lightColor#f5deb3|-,
 +
|Clear, --set lightColor#transparent|}
 +
</pre>
 +
 
 +
==See Also==
 +
* [[API:Script Index]] (partial) list of other APIs
 +
** [[Script:ChatSetAttr]]
 +
* [[Tokens]]
 +
** [[Link Token|Link Token to Sheet]]
 +
* [[Complete Guide to Rolls & Macros]]
 +
** [[Inline Rolls]]
 +
<br>
 
<br>
 
<br>
 
[[Category:User API Scripts]]
 
[[Category:User API Scripts]]
 +
[[Category:Tokens]]

Revision as of 18:33, 24 July 2021

API ScriptAuthor: Aaron C. M.
Code: TokenMod
Dependencies: None
Conflicts: None

Main Page: API:Script Index

The Aaron's TokenMod API Script. TokenMod provides an interface to setting almost all changeable properties of a token. Players can also use it to edit tokens they control, with option to edit/target other's tokens.

It's among the most popular APIs, and is quickly updated every time Roll20 makes new API keys accessible.

  • Update v0.8.69 June 2021(Forum) -- Support for Token Bar Location, Compact Token Bars, Light Sensitivity Multiplier (UDL), and Night Vision Effect (UDL)
  • Update 0.8.71 (Forum) -- includes support for lightColor


Commands:
!token-mod <--help|--ignore-selected|--config|--on|--off|--flip|--set> <parameter> [<parameter> ...] ... [ --ids <token id> [<token id> ...]]

Full user documentation can be found in the Help: TokenMod-Handout in-game, or by running the command !token-mod --help.

Contents

Config

Enable players to target/edit tokens they don't control(is also a button in the config menu):

!token-mod --config players-can-ids|on

Examples

Some examples of !token-mod commands, with possible explanations. Examples are taken from the forum thread or in-game documentation.


!token-mod --on showname            // show nameplate
!token-mod --set layer|gmlayer      // move to gmlayer
!token-mod --set bar1_value|-3      // decrease value of bar 3 by 3
!token-mod --set name|"Sir Thomas" bar1_value|23      //Setting a token's name to "Sir Thomas" and bar1 value to 23
!token-mod --set represents|@{Bob|character_id} defaulttoken      // sets the default token for that character, a quick way to update the default token
!token-mod --set statusmarkers|blue|broken-shield       //adds the 2 status markers to the token
!token-mod --move 3g                // move token 3 grids in the current facing(up being default)
!token-mod --move =90|2u           // moves 2 grids to the right(ignoring current facing)

//Various examples
!token-mod --on showplayers_aura1 --set aura1_radius|35 aura1_color|0000ff //Turning on aura1 for players, setting it's radius to 35, setting it's color to blue
!token-mod --set bar[[1d3]]_value|X statusmarkers|blue:[[1d9]]|green:[[1d9]] name:"[[1t[randomName]]]"     // use inline rolls to set values
!token-mod --set width|25s height|35s     // 's' represent the unit of measurement for the page
!token-mod --set scale|*2
!token-mod --set imgsrc|https://s3.amazonaws.com/files.d20.io/images/4095816/086YSl3v0Kz3SlDAu245Vg/max.png?1400535580        // change token image 

//Sidenumber Multi-sided tokens
!token-mod --set currentside|2
!token-mod --set currentside|+      //shift side by 1
!token-mod --set currentside|*      //set random side

//Controlled by
!token-mod --set controlledby|bob
!token-mod --set controlledby|+susan|+tommy        //add susan & tommy to list
!token-mod --set controlledby|=@{target|token_id}   //copy controlled by from other token
!token-mod --set controlledby|                      //nobody
!token-mod --set controlledby|all                   //all players

//Legacy DL examples
!token-mod --set light_radius|40 light_dimradius|20 adv_fow_view_distance|30

//Chaining multiple TokenMod commands
!token-mod {{
  --set
    represents|@{bob|character_id}
    bar1_link|hp
    bar2_link|speed
    bar3_link|ac
    controlledby|tom|sally|nancy
    statusmarkers|blue:3|red:[[1d6]]
    defaulttoken
}}

Color Light dropdown

"a macro to change the light colour emitted by a token. Included are the basic colours and a collection of some others that I thought would be interesting." - source(Forum)

!token-mod ?{Colour|Black, --set lightColor#000000|Silver, --set lightColor#c0c0c0|Gray, --set lightColor#808080|White, --set lightColor#ffffff|Maroon, --set lightColor#800000|Red, --set lightColor#ff0000|Purple, --set lightColor#800080|Fuchsia, --set lightColor#9900ff|Pink, --set lightColor#ffc0cb|Green, --set lightColor#008000|Lime, --set lightColor#00ff00|Olive, --set lightColor#808000|Yellow, --set lightColor#ffff00|Navy, --set lightColor#000080|Blue, --set lightColor#0000ff|Teal, --set lightColor#008080|Aqua, --set lightColor#00ffff|Orange, --set lightColor#ffa500|-,
|Aquamarine, --set lightColor#7fffd4|Coral, --set lightColor#ff7f50|Cornflowerblue, --set lightColor#6495ed|Crimson, --set lightColor#dc143c|Darkcyan, --set lightColor#008b8b|Darkgreen, --set lightColor#006400|Darkseagreen, --set lightColor#8fbc8f|Deeppink, --set lightColor#ff1493|Firebrick, --set lightColor#b22222|Gold, --set lightColor#ffd700|Goldenrod, --set lightColor#daa520|Lavender, --set lightColor#e6e6fa|Orangered, --set lightColor#ff4500|Saddlebrown, --set lightColor#8b4513|Salmon, --set lightColor#fa8072|Seagreen, --set lightColor#2e8b57|Skyblue, --set lightColor#87ceeb|Violet, --set lightColor#ee82ee|Wheat, --set lightColor#f5deb3|-,
|Clear, --set lightColor#transparent|}

See Also