Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Advertisement Create a free account

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

1512571723
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Craven said: keithcurtis said: Craven said: So i could have a floor token and under that a pit trap and use the macro to change the floor to trap on the map layer without going to that layer? That's a very good idea! You could even have a menu macro for a particular page that handles any number of object images. Pit traps, doors, cave-ins, and so on. Multisided tokens are useful also for lycanthropes and other shapeshifters, similar tokens that are kitted differently (goblin archers, v. goblin swordsmen), and mimics. I use one that has spell effects on different sides (fireball, darkness, etc.) With one command it changes the size and face of the token to duplicate the effect and area of the spell. Keith let me know what you come up with and post some screenshot. Like to see how this works. How about a  video and some code , instead? :)
I'm using this in conjunction with many of my players' spells to assign status overlay indicators when certain spells are used. I recently discovered while using 5E shaped sheets with 5E shaped companion script for increased API functionality that if "Special Effects" in a particular spell are turned off, the !token-mod language in the freeform section of a particular entry will work perfectly and modify the token. However, if "Special Effects" are turned on in a particular spell, so that spell effects are seen on the map when a spell is used, none of the !token-mod language is passed to the API and no token modifications are made.
1512604890
The Aaron
Forum Champion
API Scripter
After thinking about the way KeithCurtis is using this, I've added a couple of new arguments: Update v0.8.37 -- Added two new arguments: --current-page, --active-pages :and fixed a few types (Thanks Joe M. ) --current-page If you add this to the command, it will only adjust tokens on the page that the issuer is currently on. For Players this is either the page they've been split to, or the page the party ribbon is on if they've not been split. For GM's this is the last page they loaded (which is pretty much the page they are on, unless they've got it open in multiple windows and the last changed pages on a different window). This is most useful when working with character ids, as the character might be on many pages, but you might want to restrict changes to only the current page. --active-pages If you add this to the command, it will only adjust tokens on pages where there are people. This means just the pages that have the party ribbon on them, have a player split to them or are the last page the GM loaded (if the current player is the gm). Note that this will still make changes even if the players on those pages are logged out. This is most useful when working with character ids, as the character might be on many pages, but you might want to restrict changes to only the tokens that are on pages where people are.
1512606219
The Aaron
Forum Champion
API Scripter
FreeKnight said: I'm using this in conjunction with many of my players' spells to assign status overlay indicators when certain spells are used. I recently discovered while using 5E shaped sheets with 5E shaped companion script for increased API functionality that if "Special Effects" in a particular spell are turned off, the !token-mod language in the freeform section of a particular entry will work perfectly and modify the token. However, if "Special Effects" are turned on in a particular spell, so that spell effects are seen on the map when a spell is used, none of the !token-mod language is passed to the API and no token modifications are made. That sounds like a character sheet issue... If you want to try a spell with the Special Effects and one without them, both with TokenMod commands, then after each one, press up in chat and copy what it sent, you can paste those in a message here and we can try and tease out what the issue is.  It's probably something with the formatting of the Roll Template.
1512608050
keithcurtis said: Craven said: keithcurtis said: Craven said: So i could have a floor token and under that a pit trap and use the macro to change the floor to trap on the map layer without going to that layer? That's a very good idea! You could even have a menu macro for a particular page that handles any number of object images. Pit traps, doors, cave-ins, and so on. Multisided tokens are useful also for lycanthropes and other shapeshifters, similar tokens that are kitted differently (goblin archers, v. goblin swordsmen), and mimics. I use one that has spell effects on different sides (fireball, darkness, etc.) With one command it changes the size and face of the token to duplicate the effect and area of the spell. Keith let me know what you come up with and post some screenshot. Like to see how this works. How about a  video and some code , instead? :) Cool what are you using for the target token and can you share?
1512612863

Edited 1512612937
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The target token is just a 2x2 token with a dot in the middle. I'm working on setting the effects up for a Marketplace set. There are a number already there, but I don't think any really work with 5e templates properly.
1512613636
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: After thinking about the way KeithCurtis is using this, I've added a couple of new arguments: Update v0.8.37 -- Added two new arguments: --current-page, --active-pages :and fixed a few types (Thanks Joe M. ) --current-page If you add this to the command, it will only adjust tokens on the page that the issuer is currently on. For Players this is either the page they've been split to, or the page the party ribbon is on if they've not been split. For GM's this is the last page they loaded (which is pretty much the page they are on, unless they've got it open in multiple windows and the last changed pages on a different window). This is most useful when working with character ids, as the character might be on many pages, but you might want to restrict changes to only the current page. I thought that what you describe for --current-page was the existing default behavior. Does this mean that without that command, if I enlarge a token on one page, all instances of that token (referencing a character ID) across the game are enlarged?
1512614042

Edited 1512614629
The Aaron
Forum Champion
API Scripter
Correct, what you describe is the default behavior.  To be more clear, without either of the new arguments, every token representing a supplied character id on every page, including archived pages, would have whatever adjustment you described with the TokenMod command applied to it. 
1512623225
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks for the heads-up. I'll make sure to add that into any macros that require it. :)
1512678567
Xttapalotakettle said: It comes up on the script screen when I try to start up the sandbox.  If I'm in the campaign itself and I use the Torch mod it just doesn't do anything.  No errors on that side.   I'm also seeing this NaN error. In my case, the error is triggered whenever I attempt to set the light_dimradius to a negative number. (e.g. light_dimradius#=-5 ). It works fine if the number does not have the "-" character, (e.g. light_dimradius#=10 ).
1512679965
The Aaron
Forum Champion
API Scripter
hmmm..... Update v0.8.38 -- Fixed a bug that crept in around using negative numbers (Thanks Chris and Xttapalotakettle ) You can grab the fixed version now here:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/To" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/To</a>... or it will show up in the 1-click next week or so.
1512687153
Aaron, this is a great update. I have been using the Token Tables a ton lately, and will see what cool things the script can do with it. Question:&nbsp;What do you think about adding&nbsp;the "Advanced Fog of War" field to the script? It's onerous to adjust the token AFoW View Distance for various map scale situations, and TokenMod could address some of those pain points. Did I miss AFoW getting added?
1512687205
The Aaron
Forum Champion
API Scripter
As far as I know, those fields haven't been rolled out to the API yet. I did check for them and will add them as soon as they are exposed.
1512687331
The Aaron
Forum Champion
API Scripter
Confirmed those aren't available yet.
Very nice update, with the sides.&nbsp; Question: is there a way to set the side by the side name?&nbsp; I can picture situations where I'd have a lot of faces on a token (druid forms, for instance), and navigating by index could get... cumbersome, if not very inaccurate.&nbsp; Example - I have a token with four sides, Blue, Green, Red, Yellow.&nbsp; I can set that by index, sure, but what if I'm getting the 'side' by rolling the table, or maybe reading a sheet attribute? A very rough example - !token-set --set currentside|~@{Color-Name}?(Blue:1|Green:2|Red:3|Yellow:4)
1512737996
The Aaron
Forum Champion
API Scripter
That’s a cool idea, unfortunately all weight and name information from a Rollable Table is discarded when a Rollable Table Token is created. There isn’t even a direct link back to the table it was created from.&nbsp;
1512775605
Can you call from a macro to a macro on a character sheet and in-case it matters the character has a spaces in the name. Example john xavier lightforge Macro name tokenlight.
1512785532
The Aaron
Forum Champion
API Scripter
Like this: %{john xavier lightforge|tokenlight} should work.&nbsp;
1512956480
Is there some kind of specific condition a token must meet before you can set the image? I'm also guessing you can do this to more than one token. I'm having a hell of a time doing this to a new token, I'm trying to setup a token as if it where a druid and having multi sides but I can't get the token image to work more than once in my game.
1512959938
The Aaron
Forum Champion
API Scripter
What command are you using?&nbsp; The image needs to be in a User Library, if it's in the Marketplace Library, you'll need to download it and upload it to your User Library.&nbsp; Adding images to build a Multi-Sided token would look like this: !token-mod --set imgsrc|+http://SomeURLInYourImageLibrary/something/something/thumb.png?134123412 or !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} There is a bug with Roll20 where if you are using the @{target} specifier to get some information, you have to specify the --ids explicitly as the msg.selected will be empty.&nbsp; If you've got more than one token you're changing, something like this would work: !token-mod --set imgsrc|+@{target|source|token_id} --ids @{target|dest1|token_id} @{target|dest2|token_id} @{target|dest3|token_id} @{target|dest4|token_id} @{target|dest5|token_id} @{target|dest6|token_id} You can just click the same destination token several times if you have fewer than 6.
1512961485
Thank you Aaron, I finally figured out what I was doing wrong and now it works. You are great.
1512962754
The Aaron
Forum Champion
API Scripter
Ha! Glad you got it working!
1512965546
Kirsty
Pro
Sheet Author
I have now set up my druids with a "one click" macro for shifting shape. This script is amazing. It adjusts vision, token size and token image. Thank you. Seriously, you're the best, The Aaron.
1512970599
Gold
Forum Champion
Is there a way to Copy the Token settings (specifically the Emits Light and Has Sight settings), off of a token, and Clone / Paste those settings onto other tokens? In other words, a trick way to click a Token and generate the !token-mod --set code without needing to type out the script macro code? For example, if I have a Party of 6 PC tokens, and I manually set the Light settings on one of them. Is there a point-and-click way to clone those light settings onto the other 5 PC tokens, without hand-typing the code?&nbsp; I know the macro code must be so instinctive for The Aaron but I have to reopen the --help reference every time to get the syntax right.
1512977080
GiGs
Pro
Sheet Author
API Scripter
I dont think there's a way to copy like that, but what you can do is set up a macro with your desired settings, using selected, so you can just click the tokens you want to apply them to and run the macro If you have several common settings, you can set up an API menu button, so you have quick access to them all.
1512997012
The Aaron
Forum Champion
API Scripter
Awesome Kristy!&nbsp; That’s an interesting question, Gold. I could set each of the fields to take a token id to copy from, but you’d need to know the field name still so that doesn’t really help you. &nbsp;Probably creating macros is the best way to go, as G G suggests. I’ll think on it. :)
1513002428
Gold said: Is there a way to Copy the Token settings (specifically the Emits Light and Has Sight settings), off of a token, and Clone / Paste those settings onto other tokens? In other words, a trick way to click a Token and generate the !token-mod --set code without needing to type out the script macro code? For example, if I have a Party of 6 PC tokens, and I manually set the Light settings on one of them. Is there a point-and-click way to clone those light settings onto the other 5 PC tokens, without hand-typing the code?&nbsp; I know the macro code must be so instinctive for The Aaron but I have to reopen the --help reference every time to get the syntax right. Torch on !token-mod {{--set light_radius#40 light_dimradius#20 light_otherplayers#on light_losangle#|270 light_angle#360}} Torch off !token-mod --set light_radius| light_dimradius| light_otherplayers|off light_losangle|270
1513007855
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Gold said: For example, if I have a Party of 6 PC tokens, and I manually set the Light settings on one of them. Is there a point-and-click way to clone those light settings onto the other 5 PC tokens, without hand-typing the code?&nbsp; I know the macro code must be so instinctive for The Aaron but I have to reopen the --help reference every time to get the syntax right. Gold, what sheet are you using? I'm proceeding under the assumption that it is the 5e-OGL. If so, here is a macro that will produce this menu (If it is [Shaped], I have one with better formatting) : /w gm &{template:desc} {{desc=**GAME UTILITIES** **Nameplate** [Name On](!token-mod --set showplayers_name|yes showname|yes) | [Name Off](!token-mod --set showplayers_name|no showname|yes) **Light & Vision** [Snuff](!token-mod --set light_otherplayers|off light_radius|0 light_dimradius|0 light_angle|360) | [Sight](!token-mod --on showname light_hassight light_angle|360) | [Blind](!token-mod --off showname light_hassight light_angle|360) | [Spot](!token-mod --set light_otherplayers|on light_radius|1 light_dimradius|0 light_angle|360) | [GM](!token-mod --set light_otherplayers|off light_hassight|off light_radius|5 light_dimradius|5 light_angle|360) [Candle](!token-mod --set light_otherplayers|on light_radius|5 light_dimradius|0 light_angle|360) | [Lamp](!token-mod --set light_otherplayers|on light_radius|30 light_dimradius|15 light_angle|360) | [Torch](!token-mod --set light_otherplayers|on light_radius|40 light_dimradius|20 light_angle|360) [Hooded Lantern](!token-mod --set light_otherplayers|on light_radius|60 light_dimradius|30 light_angle|360) | [Bullseye Lantern](!token-mod --set light_otherplayers|on light_radius|120 light_dimradius|60 light_angle|90) [Darkvision](!token-mod --set light_otherplayers|off light_radius|60 light_dimradius|0 light_angle|360) | [DV90](!token-mod --set light_otherplayers|off light_radius|90 light_dimradius|0 light_angle|360) | [DV120](!token-mod --set light_otherplayers|off light_radius|120 light_dimradius|0 light_angle|360) |&nbsp; [*Light*](!token-mod --set light_otherplayers|on light_radius|40 light_dimradius|20 light_angle|360) | [*Daylight*](!token-mod --set light_otherplayers|on light_radius|120 light_dimradius|60 light_angle|360) | [*Faerie Fire*](!token-mod --set light_otherplayers|on light_radius|1 light_angle|3600 light_dimradius|0 statusmarkers|purple light_angle|360) **Status** [Blue](!token-mod --set statusmarkers|!blue) | [Purple](!token-mod --set statusmarkers|!purple) | [Pink](!token-mod --set statusmarkers|!pink) | [Yellow](!token-mod --set statusmarkers|!yellow) | [OFF](!token-mod --set statusmarkers|=dead|-dead) }}
1513069171
Gold
Forum Champion
@ G G @ TheAaron @ Craven @ keithcurtis Thank you for the suggestions. Yes I have some "regular" Light-situation macros set up, like Torch ON, Torch OFF. However, no, I'm not using 5E or the 5E sheet, I'm running more of a homebrew. I've been using a lot of different map scales, indoor & outdoor, such as expansive city maps, so I've been needing to re-configure light settings every week for the game. I've had PC's with Sight and Emit Light settings anything from 30 feet, to 1200 feet. It's depending on the map, not on which character --- I tend to give all the Characters matching settings for each new map-type. It's sort of a board-game / RPG / AD&D / dynamic-light-hide-and-seek, kind of game. I'll probably set-up a macro for Light with a variable. It would be nice some day to be able to click 1 token and say "Clone token settings" or "Clone selected token settings". It might be a future feature suggestion for TokenMod or it could be a different script on its own. I acknowledge that writing a new Macro each week for !token-mod is not necessarily difficult. It is a big time saver. But I just get tired of looking up the syntax and needing to type it properly each week before I can start replicating the settings across 5-10-20 tokens.
1513090384
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Whenever I have a situation like that, I usually set up a Google Sheet to parse the command for me, so that all I have to do is put a few variables into cells, then select and copy the resultant macro from the figured cell(s). It's more up-front work, but aves time and brain cells in the long run.
1513090524
vÍnce
Pro
Sheet Author
keithcurtis said: Whenever I have a situation like that, I usually set up a Google Sheet to parse the command for me, so that all I have to do is put a few variables into cells, then select and copy the resultant macro from the figured cell(s). It's more up-front work, but aves time and brain cells in the long run. Smart.&nbsp; Going to borrow that one.
Do you have that 5E Shaped of that cool looking utilities for sight...that looks awesome!
1513129080
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here it is. I trimmed out a lot of commands that call other macros in my game, but left the lighting and a couple of other functions. The full menu also controls the tracker and initiative, group checks, saves and damage, resets HP on mooks, bumps tokens into invisibility, and more. I like automation... /w gm &{template:5e-shaped} {{title=Game Utilities}} {{text_big= **Nameplate** [Name On](!token-mod --set showplayers_name|yes showname|yes) | [Name Off](!token-mod --set showplayers_name|no showname|yes) **Light & Vision** [Snuff](!token-mod --set light_otherplayers|off light_radius|0 light_dimradius|0 light_angle|360) | [Sight](!token-mod --on showname light_hassight light_angle|360) | [Blind](!token-mod --off showname light_hassight light_angle|360) | [Spot](!token-mod --set light_otherplayers|on light_radius|1 light_dimradius|0 light_angle|360) | [GM](!token-mod --set light_otherplayers|off light_hassight|off light_radius|5 light_dimradius|5 light_angle|360) [Candle](!token-mod --set light_otherplayers|on light_radius|5 light_dimradius|0 light_angle|360) | [Lamp](!token-mod --set light_otherplayers|on light_radius|30 light_dimradius|15 light_angle|360) | [Torch](!token-mod --set light_otherplayers|on light_radius|40 light_dimradius|20 light_angle|360) [Hooded Lantern](!token-mod --set light_otherplayers|on light_radius|60 light_dimradius|30 light_angle|360) | [Bullseye Lantern](!token-mod --set light_otherplayers|on light_radius|120 light_dimradius|60 light_angle|90) [Darkvision](!token-mod --set light_otherplayers|off light_radius|60 light_dimradius|0 light_angle|360) | [DV90](!token-mod --set light_otherplayers|off light_radius|90 light_dimradius|0 light_angle|360) | [DV120](!token-mod --set light_otherplayers|off light_radius|120 light_dimradius|0 light_angle|360) | [*Light*](!token-mod --set light_otherplayers|on light_radius|40 light_dimradius|20 light_angle|360) | [*Daylight*](!token-mod --set light_otherplayers|on light_radius|120 light_dimradius|60 light_angle|360) | [*Faerie Fire*](!token-mod --set light_otherplayers|on light_radius|1 light_angle|3600 light_dimradius|0 statusmarkers|purple light_angle|360) **Status** [Blue](!token-mod --set statusmarkers|!blue) | [Purple](!token-mod --set statusmarkers|!purple) | [Pink](!token-mod --set statusmarkers|!pink) | [Yellow](!token-mod --set statusmarkers|!yellow) | [OFF](!token-mod --set statusmarkers|=dead|-dead) }}
Worked like a charm! Thanks its beautiful!!!!!
1517198873
Aaron, Is there a simple tokenmod macro that will do damage to a group of monsters?
1517201454
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'm not the Aaron, but you might want to look into the GroupCheck script. It is available with One Click install on your campaign's API page. When combined with Apply Damage , you can select a group of tokens, have them all make individual saving throws, input the damage once and apply it to all selected tokens. Those who succeed will take half or no damage, as indicated when you invoke the script, those who fail will take the full brunt. Just a few clicks.
1517224673
Joe
Pro
Albert R. said: Aaron, Is there a simple tokenmod macro that will do damage to a group of monsters? Hi Albert, I’m also not Aaron, but you can easily do that with TokenMod using the macro &nbsp;“token-mod --set bar1_value|-?{Damage|0}”. If you want a set damage value instead of being asked, just replace “?{Damage|0}” with a number. By default all selected tokens will be affected. If you would like to pick a target after selecting the macro instead, you could do “!token-mod --set bar1_value|-?{Damage|0}&nbsp;--ids @{target|Target|token_id}”. Have fun!
1517233515
The Aaron
Forum Champion
API Scripter
Hi!&nbsp; I'm Aaron, but I really don't have anything to add to the above. =D
1518626783

Edited 1518627027
I'm running into a challenge with the API, and I know it has to be some thing small/simple that I'm missing. I'm attempting to use a rollable table token and alter the character sheet that is associated with when it switches. (I have a player playing a Jekyll/Hyde type character) here is what I am trying, but I keep getting no character was found for "whatever name I place there" !tokenmod --set represents|@{'Dr. Meranda Ink'|character_name} currentside|2 bar1_link|hit_points bar2_link|fatigue_points I also posted a thread on this on the Pro page but I didn't notice this forum so I apologize for double posting.&nbsp; Edit: This player is running with two separate character sheets, so I was trying to make a quick switch for when they "change"
1518628399
The Aaron
Forum Champion
API Scripter
Answered in the other thread, sorry for the delay.&nbsp; The issue is the command.&nbsp; It needs to start with !token-mod, not !tokenmod.&nbsp; Hopefully that sorts it out, if not, let me know.
1519465998

Edited 1519468868
Hi Aaron, may I request a small addition? I would like a delay command or parameter in TokenMod, which simply delays the execution of a command for a given time in milliseconds. I've done this with ChangeTokenImage for small animations. For example I stored several versions of a token with different opacity values in a rollable table and then switch them with ChangeTokenImage with increasing delays, which gives the effect of appearing or vanishing. By simply providing increasing delays I avoided the problem of asynchronous execution. To have this functionality with TokenMod would allow for example to grow or shrink creature effects. This is how my "animation" macros look like: !change-token-img --set 9 !change-token-img --set 10 --delay 400 !change-token-img --set 11 --delay 800 !change-token-img --set 12 --delay 1200 !change-token-img --set 13 --delay 1600 All I did was add a delay parameter to ChangeTokenImage and wrap the command execution in setTimeout(). I would do the same to TokenMod but TokenMod is a bit more complex ;)
1519472700
The Aaron
Forum Champion
API Scripter
Hmm. It might be better to write a script which would delay issuing API commands. You could then apply it to any commands without needing to modify them. You couldn’t use the selected tokens for the delayed commands, but TokenMod takes IDs in the command line, so you could do the conversion in your script.&nbsp;
1519477191

Edited 1519477239
I thought about that, I am just insecure about some aspects of the API. From what I saw in other scripts, sendChat is used to execute other commands. But I am not sure, if there is any kind of parsing and interpretation or special char replacement done to a macro or chat commands, before I get access to it in my script, or if I have to take care of any special chars before I use sendChat to send a command.
1519477935
The Aaron
Forum Champion
API Scripter
Subbing inline rolls is the only thing you should have to do.&nbsp; Would look something like this ( completely untested ) example: on('ready',function(){ &nbsp; &nbsp; "use strict"; &nbsp; &nbsp; const processInlinerolls = (msg) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; if(_.has(msg,'inlinerolls')){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _.chain(msg.inlinerolls) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reduce(function(m,v,k){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var ti=_.reduce(v.results.rolls,function(m2,v2){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(_.has(v2,'table')){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m2.push(_.reduce(v2.results,function(m3,v3){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m3.push(v3.tableItem.name); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m3; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },[]).join(', ')); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m2; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },[]).join(', '); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },{}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reduce(function(m,v,k){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m.replace(k,v); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },msg.content) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .value(); &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return msg.content; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }; &nbsp; &nbsp; on('chat:message',function(msg){ &nbsp; &nbsp; &nbsp; &nbsp; if('api' !== msg.type || !playerIsGM(msg.playerid) ){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; let args = processInlinerolls(msg.content).split(/\s+/); &nbsp; &nbsp; &nbsp; &nbsp; let ids = ((msg.selected && _.pluck(msg.selected,'_id')) || []); &nbsp; &nbsp; &nbsp; &nbsp; switch(args.shift()){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case '!delay': { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let amount = parseInt(args.shift()); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!_.isNaN(amount)){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _.delay(()=&gt;sendChat('',`${args.join(' ')} --ids ${ids.join('')}`), amount); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }); });
Sorry, not sure if I asked this before, is there a way using token mod to set the HP of a token to the max possible value - so take the 2d8+4 for example from the character sheet so 20HP as the mas and then use !token-mod --set bar1|[[value here]]
1520095169
The Aaron
Forum Champion
API Scripter
TokenMod can't calculate the maximum possible value for a formula, you'd need to have that 20 stored somewhere it could be referenced.
1520099550
Joe
Pro
I use the script&nbsp;LimitHP_MinMax: <a href="https://app.roll20.net/forum/permalink/4767673/" rel="nofollow">https://app.roll20.net/forum/permalink/4767673/</a> This should allow you to set a value like 999 as the value of bar 1, and have it be limited to the max value.&nbsp;
1520105622
The Aaron
Forum Champion
API Scripter
I think he's saying he wants to calculate that the maximum possible value of 2d8+4 is 20 and set that.
1520113194

Edited 1520113391
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Probably not what you are looking for but [[2d8r&lt;7 + 4]] should return 20. This re-rolls any die result of 7 or below.
1520113260
The Aaron
Forum Champion
API Scripter
So does [[2*8 + 4 ]] =D