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 .
×
Create a free account

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

Question on the movement stuff you implemented in June for TokenMod...I wanted to run a mini-battle where the tokens are facing off with each other. Let's assume that I am using "overhead view" artwork for the tokens and want to match the depicted facing on the token artwork with the facing direction set by the commands in Token Mod. It appears the TokenMod considers the "up" direction on the map (lets just call it "North") as the default facing of the token. Is there a way to synchronize these 2 facings? Or do I need to implement something where I have an token image for each directional facing similar to that used in some of the old video games...and basically switch out images according to which direction I moved?
1596543213
The Aaron
Roll20 Production Team
API Scripter
You just need to add your facing angle to whatever and you intend to move in.  Here is drifting 3 units in the direction 35° to the right of forward assuming your token's facing is 180° off from the rotation handle. !token-mod --move [[180+35]]|3u If your tokens are facing away from the rotation handle, you can flip them horizontally and vertically to get them facing the  rotation handle: !token-mod --on fliph flipv --set rotation|+180
Hi First of all, thank you so much for all your dedication and time consuming API scripting you are sharing with the community. Much appreciated! Now back to my question ;)  Am playing around with TokenMod and UDL feature directional light . If am trying to create a light source which has bright and low light for the far end of the radius (i.e. Bullseye Lantern: 60 bright, 60 low; total 120ft)  only the defined bright light distance is covered by the "has_directional_bright_light" parameter, is that correct? Do I miss anything? Currently I set the low light to 0 and set 120 for bright. Sort of workaround I can think of. Cheers!
1596548568
The Aaron
Roll20 Production Team
API Scripter
I pulled the names from the code, so they are possibly a bit misleading.  I'll fix that in a future updated. has_directional_bright_light controls directional emitted light, both bright and dim.
Thanks for clarification Aaron and yes, it works as you described. Probably some UDL issues with large maps then. Or me producing typos. Cheers!
Hi Aaron, maybe a stupid question, but: what is the correct parameter for limit field of vision? I tried limit_field_of_vision_center and  directional_bright_light_total, but nothing changes. I am using the feature in the old system to create blindness (angle = 0) and back to vision (angle = 360) because this doesn't change all other vision settings. Thanks in advance Bernd
1597075494
The Aaron
Roll20 Production Team
API Scripter
are you setting  has_limit_field_of_vision  to on?
The Aaron said: are you setting  has_limit_field_of_vision  to on? It was already on in the token. But I didn't set it explicitely with token-mod. The inital setting before working the macro on it, was And I was going to use the option "Blinded" of the following macro to it: !token-mod {{ --set ?{Vision    |Torch, emits_bright#yes                 bright_light_distance#20                emits_low#yes                low_light_distance#20    |Darkvision, night_vision#yes                night_vision_distance#60                night_vision_tint##6aa84f    |See, limit_field_of_vision_center#360    |Blinded, limit_field_of_vision_center#0} }} I added the bloolean now, but to the same effect. It has nothing to with the feact, that this is a mere token, not tied to a character sheet, hasn't it?
1597101109
The Aaron
Roll20 Production Team
API Scripter
That should t make a difference. Have you logged in as a player controlling the token and verified the sight?  I'll have to give this a try when I'm on my computer. 
No, I was logged in as GM, not as player. As a player I shouldn't be allowed to use the script. And since it is simply a token without any permissions, as a player I can't see anything concerning it. Maybe a typo in my script? But I double-checked it with the token-mod help. I am not happy with this new dynamic lighting anyway and I really hope that they keep the old version as long as possible. There everything is fine for me and your magic script saves every minute of my day. It's so great to switch the PCs blind (e.g. in a Darkness spell's area) and reenable their individual visions with a click.
Bernd S. said: No, I was logged in as GM, not as player. As a player I shouldn't be allowed to use the script. And since it is simply a token without any permissions, as a player I can't see anything concerning it. Maybe a typo in my script? But I double-checked it with the token-mod help. I am not happy with this new dynamic lighting anyway and I really hope that they keep the old version as long as possible. There everything is fine for me and your magic script saves every minute of my day. It's so great to switch the PCs blind (e.g. in a Darkness spell's area) and reenable their individual visions with a click. I like using the same things.  I worked on a macro, don't know if I need to update it with all the monkeying around they've been doing with it.  But this is what I had shortly after it's second release: /w gm &{template:5e-shaped}{{title=Adjusting vision for **@{selected|token_name}**}}{{subheader=to token-mod's parameters of:}}{{text_big=?{Vision|Torch, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#20 low_light_distance#20 has_bright_light_vision#yes has_low_light_vision#yes emits_bright_light#yes emits_low_light#yes has_night_vision#no|Light Cantrip, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#20 low_light_distance#20 has_bright_light_vision#yes has_low_light_vision#yes emits_bright_light#yes emits_low_light#yes has_night_vision#no|Hooded Lantern, light_radius#60 light_dimradius#30 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#30 low_light_distance#30 has_bright_light_vision#yes has_low_light_vision#yes emits_bright_light#yes emits_low_light#yes has_night_vision#no|Bullseye Lantern (No UDL), light_radius#120 light_dimradius#60 light_angle#60 light_hassight#yes light_otherplayers#yes has_bright_light_vision#no|Lamp, light_radius#30 light_dimradius#15 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#15 low_light_distance#15 has_bright_light_vision#yes has_low_light_vision#yes emits_bright_light#yes emits_low_light#yes has_night_vision#no|Candle, light_radius#5 light_dimradius#=0 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#5 has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#yes emits_low_light#no has_night_vision#no|Darkvision (Std 60'), light_radius#60 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#yes night_vision_distance#60|Darkvision (90'), light_radius#90 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#yes night_vision_distance#90|Darkvision (Drow 120'), light_radius#120 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#yes night_vision_distance#120|Warlock Devil's Sight, light_radius#120 light_dimradius#=120 light_hassight#yes light_angle#360 light_otherplayers#no bright_light_distance#20 low_light_distance#20 has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#yes night_vision_distance#120|No light source(Dusk - No UDL), light_radius#120 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no bright_light_distance#20 low_light_distance#20 has_bright_light_vision#no|Fog (No UDL), light_radius#200 light_dimradius#=5 light_hassight#yes light_angle#360 light_otherplayers#no has_bright_light_vision#no|No light source (Human-Like Vision), light_radius#10 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#yes night_vision_distance#5|Blinded, light_hassight#no light_angle#360 light_otherplayers#no statusmarkers#+bleeding-eye has_bright_light_vision#no has_low_light_vision#no emits_bright_light#no emits_low_light#no has_night_vision#no|Flametongue Weapon, light_radius#40 light_dimradius#40 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#40 has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#yes emits_low_light#no has_night_vision#no|Sun Blade, light_radius#30 light_dimradius#30 light_hassight#yes light_angle#360 light_otherplayers#yes bright_light_distance#30 has_bright_light_vision#yes has_low_light_vision#no emits_bright_light#yes emits_low_light#no has_night_vision#no} }} !token-mod --set ?{Vision} Come to think of it, I think they fixed the directional light issue which I need for the Bullseye Lantern, I may be able to revisit this ....
1597161862

Edited 1597162072
Great thanks a lot for that script! I was on my way developing exactly such a thing for the new DL. But did you test it? I am pretty sure that your script is correct, but it doesn't work (for me), because I suspect the new DL system to be very buggy. For me, with the starting point: a token with directional sight (120°) and not emitting any light a burning fire (20ft bright light, 20 ft. low light) the result of setting the token Blinded is: directional sight is not updated bright light area is black (ok) low light area is visible (bad) directional sight isn't updated (bad) Blind and then Ctrl-L: And looking into the token shows that the vision is off (after the blinding), so it shouldn't see anything at all! Same with my script tests. Sometimes I was able to update the directional sight with an additional reload of the browser, but even that didn't help always. I tried it with firefox and chrome. I fear we won't get any further until roll20 fixes the new DL. Or I am doing something very wrong.
1597179525
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.61 -- Added ; as an alternative to : in status marker names and optional numbers.  (Thanks Maltodextrin) You can use a semicolon ( ; ) in place of a colon ( : ) to allow setting statuses with numbers from API Buttons. [Set some statuses](!token-mod --set statusmarkers|blue;0|red;3|green|padlock;2|broken-shield;7) Status Markers with a space in the name must be specified using the tag name, which appears in  [ ]  above. !token-mod --set statusmarkers|Mountain_Pass::1234568 You can use a semicolon ( ; ) in place of a colon ( : ) to allow setting statuses with numbers from API Buttons. [3 Mountain Pass](!token-mod --set statusmarkers|Mountain_Pass;;1234568;3)
Hey Guys, Still trying to re-work my macros I use with TokenMod to work with UDL instead of LDL.  Can anyone advise what I need to rename some of these to?  I've been reading this thread, but apparently i'm a dunce.  I'm assuming it's just renaming "light_radius" to "emits_bright" and whether or not I need low light, but i'm struggling. !token-mod --set ?{Vision|Torch, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes|Hooded Lantern, light_radius#60 light_dimradius#30 light_hassight#yes light_angle#360 light_otherplayers#yes|Bullseye Lantern, light_radius#120 light_dimradius#60 light_angle#60 light_hassight#yes light_otherplayers#yes|Lamp, light_radius#30 light_dimradius#15 light_hassight#yes light_angle#360 light_otherplayers#yes|Candle, light_radius#5 light_dimradius#=0 light_hassight#yes light_angle#360 light_otherplayers#yes|Darkvision, light_radius#60 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Darkvision (90'), light_radius#90 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Warlock Devil's Sight, light_radius#120 light_dimradius#=120 light_hassight#yes light_angle#360 light_otherplayers#no|No light source(Dusk), light_radius#120 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Fog, light_radius#200 light_dimradius#=5 light_hassight#yes light_angle#360 light_otherplayers#no|No light source, light_radius#5 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Blinded, light_hassight#no light_angle#360 light_otherplayers#no}
1597240903

Edited 1597241005
The Aaron
Roll20 Production Team
API Scripter
Here is the first entry translated: Vision|Torch,has_bright_light_vision#yes emits_bright_light#yes bright_light_distance#20 emits_low_light#yes low_light_distance#20 has_limit_field_of_vision#yes limit_field_of_vision_center#0 limit_field_of_vision_total#360 That should get you started... Here's details on the settings: Updated Dynamic Lighting Boolean Properties has_bright_light_vision  is the UDL version of  light_hassight . It controls if a token can see at all, and must be turned on for a token to use UDL. You can also use the alias  bright_vision . has_night_vision  controls if a token can see without emitted light around it. This was handled with  light_otherplayers  in the old light system. In the new light system, you don't need to be emitting light to see if you have night vision turned on. You can also use the alias  night_vision . emits_bright_light  determines if the configured  bright_light_distance  is active or not. There wasn't a concept like this in the old system, it would be synonymous with setting the  light_radius  to 0, but now it's not necessary. You can also use the alias  emits_bright . emits_low_light  determines if the configured  low_light_distance  is active or not. There wasn't a concept like this in the old system, it would be synonymous with setting the  light_dimradius  to 0 (kind of), but now it's not necessary. You can also use the alias  emits_low . Updated Dynamic Lighting Radius Properties night_vision_distance  lets you set how far away a token can see with no light. You need to have  has_night_vision  turned on for this to take effect. You can also use the alias  night_distance . bright_light_distance  lets you set how far bright light is emitted from the token. You need to have  has_bright_light_vision  turned on for this to take effect. You can also use the alias  bright_distance . low_light_distance  lets you set how far low light is emitted from the token. You need to have  has_bright_light_vision  turned on for this to take effect. You can also use the alias  low_distance . Night vision tint uses the field  night_vision_tint : !token-mod --set night_vision_tint|#ff0000 It uses the standard color options from the help that you'd use for aura and tint colors. Directional Light has three settings: has_directional_bright_light  -- boolean value, on sets a limit, off is 360 light. directional_bright_light_center  -- degrees, this is just like rotation.  0 is straight out the top of the token (think, in the direction of the rotation handle).  0-360 sets the direction clockwise around the token. directional_bright_light_total  -- this is a circle segment like in Legacy Dynamic Lighting for the light_angle and light_losangle.  It will be centered on the directional_bright_light_center angle with half on either side. Setting the light to come out of the right of the token (90º) in a 60º arc ( +/- 30º from 90, from 60º to 120º): !token-mod {{ --on has_directional_bright_light --set directional_bright_light_center|90 directional_bright_light_total|60 }} For vision, there are 6 settings that mirror the above for regular and night vision ( But see the important caveat below! ): has_limit_field_of_vision  -- turns on limiting of regular vision. has_limit_field_of_night_vision  -- turns on limiting of night vision. limit_field_of_vision_center   -- center for regular vision, 0 is straight up, 0-360 is clockwise around the token. limit_field_of_night_vision_center   -- center for night vision, 0 is straight up, 0-360 is clockwise around the token. limit_field_of_vision_total  -- width of the arc for regular vision, centered on the direction of regular vision. limit_field_of_night_vision_total  -- width of the arc for night vision, centered on the direction of night vision. Important Caveat:  The user interface for tokens only has 3 settings for the above, an on-off that sets both the limits on or off, a center that sets both centers, and a total that sets both totals.  For full compatibility, you'll want to set each of these in pairs.  For the moment, I have left them separate because you can do some neat (and bizarre) things with them set separately.  It doesn't completely work, but I want to see what people can do with it and maybe we can make a compelling argument for it working as we'd expect (or maybe a future update will see some neat enhancements).  Note that saving changes on the Token GUI will force the pairs to be identical. Setting vision limits like the GUI: !token-mod {{ --on has_limit_field_of_vision has_limit_field_of_night_vision --set limit_field_of_vision_center|90 limit_field_of_night_vision_center|90 limit_field_of_vision_total|60 limit_field_of_night_vision_total|60 }}
Wow, awesome - thank you!   I have some work cut out for me.  BTW, after converting some pages on a server to mess around with from LDL to UDL, things got real laggy.  Is that the same experience for others?
Ryan S. said: Wow, awesome - thank you!   I have some work cut out for me.  BTW, after converting some pages on a server to mess around with from LDL to UDL, things got real laggy.  Is that the same experience for others? Yep
Directional Light has three settings: has_directional_bright_light  -- boolean value, on sets a limit, off is 360 light. directional_bright_light_center  -- degrees, this is just like rotation.  0 is straight out the top of the token (think, in the direction of the rotation handle).  0-360 sets the direction clockwise around the token. directional_bright_light_total  -- this is a circle segment like in Legacy Dynamic Lighting for the light_angle and light_losangle.  It will be centered on the directional_bright_light_center angle with half on either side. Setting the light to come out of the right of the token (90º) in a 60º arc ( +/- 30º from 90, from 60º to 120º): !token-mod {{ --on has_directional_bright_light --set directional_bright_light_center|90 directional_bright_light_total|60 }} For vision, there are 6 settings that mirror the above for regular and night vision ( But see the important caveat below! ): has_limit_field_of_vision  -- turns on limiting of regular vision. has_limit_field_of_night_vision  -- turns on limiting of night vision. limit_field_of_vision_center   -- center for regular vision, 0 is straight up, 0-360 is clockwise around the token. limit_field_of_night_vision_center   -- center for night vision, 0 is straight up, 0-360 is clockwise around the token. limit_field_of_vision_total  -- width of the arc for regular vision, centered on the direction of regular vision. limit_field_of_night_vision_total  -- width of the arc for night vision, centered on the direction of night vision. Important Caveat:  The user interface for tokens only has 3 settings for the above, an on-off that sets both the limits on or off, a center that sets both centers, and a total that sets both totals.  For full compatibility, you'll want to set each of these in pairs.  For the moment, I have left them separate because you can do some neat (and bizarre) things with them set separately.  It doesn't completely work, but I want to see what people can do with it and maybe we can make a compelling argument for it working as we'd expect (or maybe a future update will see some neat enhancements).  Note that saving changes on the Token GUI will force the pairs to be identical. Thanks a lot for this clarification of the parameters, especially that there are more than on UI. Bizarre effect: my way to set one with darkvison blind (vision angle = 0) blinds him only for light. So he can't see where light is, but without light he see with darkvision :-)
1597252545
The Aaron
Roll20 Production Team
API Scripter
Oh?  Can you post your macro, I'd like to take a look at that.
1597253782

Edited 1597253949
The Aaron said: Oh?  Can you post your macro, I'd like to take a look at that. Sure. It's just for starters, several options have to be added, but the most important are there. My main intention is to be able to blind people because that's always fun and there are so many possibilities: Darkness, Cloudkill, Fog Cloud, Sleet Storm, .... Unfortunately in the new system it is necessary to have two see/blind options for normal/darkvision characters.  !token-mod {{ --set ?{Vision    |Torch, emits_bright#yes                 bright_light_distance#20                emits_low#yes                low_light_distance#20    |Darkvision, night_vision#yes                night_vision_distance#60                night_vision_tint##6aa84f    |See Normal, has_limit_field_of_vision#yes                 limit_field_of_vision_total#360    |Blinded Normal, has_limit_field_of_vision#yes                 limit_field_of_vision_total#0    |See Darkvision, has_limit_field_of_night_vision#yes                limit_field_of_night_vision_total#360                limit_field_of_vision_total#360    |Blinded Darkvision, has_limit_field_of_night_vision#yes                limit_field_of_night_vision_total#0                limit_field_of_vision_total#0} }} If you omit ' limit_field_of_vision_total#0 ' part in 'Blinded Darkvision' you have this strange effect, that light sources are black (black light :-) ) but you see in the dark. As if light blinds you.
1597272858

Edited 1597272965
Bernd S. said: Ryan S. said: Wow, awesome - thank you!   I have some work cut out for me.  BTW, after converting some pages on a server to mess around with from LDL to UDL, things got real laggy.  Is that the same experience for others? Yep So even in UDL, AFoW creates hella lag.  check...
Bernd S. said: The Aaron said: Oh?  Can you post your macro, I'd like to take a look at that. Sure. It's just for starters, several options have to be added, but the most important are there. My main intention is to be able to blind people because that's always fun and there are so many possibilities: Darkness, Cloudkill, Fog Cloud, Sleet Storm, .... Unfortunately in the new system it is necessary to have two see/blind options for normal/darkvision characters.  !token-mod {{ --set ?{Vision    |Torch, emits_bright#yes                 bright_light_distance#20                emits_low#yes                low_light_distance#20    |Darkvision, night_vision#yes                night_vision_distance#60                night_vision_tint##6aa84f    |See Normal, has_limit_field_of_vision#yes                 limit_field_of_vision_total#360    |Blinded Normal, has_limit_field_of_vision#yes                 limit_field_of_vision_total#0    |See Darkvision, has_limit_field_of_night_vision#yes                limit_field_of_night_vision_total#360                limit_field_of_vision_total#360    |Blinded Darkvision, has_limit_field_of_night_vision#yes                limit_field_of_night_vision_total#0                limit_field_of_vision_total#0} }} If you omit ' limit_field_of_vision_total#0 ' part in 'Blinded Darkvision' you have this strange effect, that light sources are black (black light :-) ) but you see in the dark. As if light blinds you. I had this same issue and couldn't figure it out, but this makes sense.  It was a large black circle.
One could try to use this as a feature. My idea was: If the characters get into a foggy area and you want them to see only let's say 200ft., you could set the 'light vision' off, so that they don't profit from other light sources. Additionally you could then set night vision on for 200 ft. They wouldn't see any light sources, but they could see 200 ft. into the fog. Rare occasion maybe, but it might work then.
Is there a way to apply damage and healing to bar 1 to put in a macro. I’m thinking a pop up which asks for a number, positive for damage, negative for healing (or vice versa) which then applies it to the token. Is this possible?
1597501249

Edited 1597501284
The Aaron
Roll20 Production Team
API Scripter
Definitely. There is a lot more you can do than this, but this is the simplest example: !token-mod --set bar1_current|+?{Adjustment}!
1597515263

Edited 1597519284
Thank you so much! It worked perfectly!
Is there any way I can set the "represents" option to the current token's name? For instance, I have some "Fake NPCs" (I call those some tokens added randomly that have different names but no character sheet associated). However, they have become so continuous in my campaign I've decided to make a character sheet, albeit basic, for each one of them (with stats and everything). Since they already have their Token Names, I was thinking about doing something along the lines of: !token-mod --set represents|name But of course, that's just going to interpret I want it to represent the CharSheet named "name" and not what I actually want to, which is to have every token represent the Char Sheet named after their Token Name. Is there any way around this?
1597541778

Edited 1597542503
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Assuming token name and character name are the same: !token-mod --set represents|@{selected|token_name} should do it. However, I'm not sure about characters with spaces in their names. The Aaron likely has thought of this and you need to wrap the name in quotes or curly braces or bacon or something.
1597542527

Edited 1597543343
keithcurtis said: Assuming token name and character nae are the same: !token-mod --set represents|@{selected|token_name} should do it. However, I'm not sure about characters with spaces in their names. The Aaron likely has thought of this and you need to wrap the name in quotes or curly braces or bacon or something. I feel braindead today since it was so simple. Thank you!!
Is there a way to find out who controls a token?
1597879213
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Through macros, token mod commands, or manual checks? I assume token-mod, given the thread, but thought it best to check. It is possible to check through the API.
1597884679
The Aaron
Roll20 Production Team
API Scripter
It could be done with the API, but it's not a feature of TokenMod. 
I ran into a new issue last night in my game. I use TokenMod for its ability to number tokens of basic, unnamed minions. So far this has been very useful for me to track individual tokens of the same creature type/same sheet. Normally each token's stats can be tracked individually (ie. changes made to Minon 1's token HP don't change Minon 2's token HP). Last night, however, I ran into something that makes me think there is a new bug. I had several tokens from a sheet with character name "Worker." Each token was Worker 1, Worker 2, etc. Trouble was, when I changed the HP on one token it changed on  all  of the tokens. Cue me having to go to scratch paper mid-combat to track HP. Is this a known issue and if so is there a work around?
1598233813
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It sounds like the Bar was still linked to the sheet, rather than just based on it. This is a common setup error: Here is the wiki article on  Linking Tokens to Journals Here is a  video  which demoes the procedure
Is there a way to modify a bar value and restrict it between 0 and max when the max value contains text in parentheses? I'm trying to use the following command, where bar3_max is set to 3(heropoints) !token-mod --set bar3_value|-1! but it crashes the API with this error: Error: Firebase.update failed: First argument contains NaN in property 'bar3_value' at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186) at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at J.update (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave (/home/node/d20-api-server/api.js:877:27) at later (/home/node/d20-api-server/node_modules/underscore/underscore.js:888:31) at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7)
1598386210
The Aaron
Roll20 Production Team
API Scripter
Hmm.. I'll have to take a look at that.
Is there a way to make a macro to set a number on the token. I want to use it to track the altitude of a flying creature, so I can click a macro on my bar and change the value, and it automatically sets the token's markers to that value. E.g. I can put in 40, and it puts up a 4 and a 0.
1598892112

Edited 1598892231
Greg S. said: Is there a way to make a macro to set a number on the token. I want to use it to track the altitude of a flying creature, so I can click a macro on my bar and change the value, and it automatically sets the token's markers to that value. E.g. I can put in 40, and it puts up a 4 and a 0. Yes, you can do this: !token-mod --set statusmarkers|fluffy-wing:?{number} or directly with e.g. 4 !token-mod --set statusmarkers|fluffy-wing:4 If you use token-mod there's an amazingly good documentation 'Help: TokenMod' as a handout.
Bernd is spot on. fly up to 99 feet... !token-mod --set statusmarkers|fluffy-wing|?fluffy-wing[1]:?{How many 10s?}|fluffy-wing[2]:?{How many 1s?} If you need something more. Fly up to 999 feet !token-mod --set statusmarkers|fluffy-wing|?fluffy-wing[1]:?{How many 100s?}|fluffy-wing[2]:?{How many 10s?}|fluffy-wing[3]:?{How many 1s?}
1598900582
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Alternatively, depending on your system, it might be easier to do it in 5ft increments (i.e. number of squares of elevation), which will handle everything up to 45 feet ("9" squares). It makes range easy to figure too.
BilBo 2 said: Bernd is spot on. fly up to 99 feet... !token-mod --set statusmarkers|fluffy-wing|?fluffy-wing[1]:?{How many 10s?}|fluffy-wing[2]:?{How many 1s?} If you need something more. Fly up to 999 feet !token-mod --set statusmarkers|fluffy-wing|?fluffy-wing[1]:?{How many 100s?}|fluffy-wing[2]:?{How many 10s?}|fluffy-wing[3]:?{How many 1s?} Yeah I know. :-) I tried that too, but this way the token gets a bit crowded ;-)
1598962287
The Aaron
Roll20 Production Team
API Scripter
The status markers only support a single digit each.  You could append the height to the name of the token: !token-mod --set name|"@{selected|character_name} [25ft]"
1598976574

Edited 1598988193
The Aaron said: The status markers only support a single digit each.  You could append the height to the name of the token: !token-mod --set name|"@{selected|character_name} [25ft]" Wow. That's a great idea. Thanks! I put it this way: I created two macros: Fly: !token-mod --set name|"(^?{height} ft.)" --on showname --on showplayers_name Land: !token-mod --set name|"@{selected|character_name}" --off showname --off showplayers_name Works fantastic. Thanks for the suggestion!
Is the field for bar location available through Token mod? I have a macro that does absolutely all of what I want except this one field, seems to be manual only if you want to change it. I am thinking that it's not accessible.
1599316589
GiGs
Pro
Sheet Author
API Scripter
It's one of the settings roll20 hasnt made available to the API yet. It's very irritating they havent, but until they do, no script can set that value.
Okay, new to using this API and I got a very newb question. If I want to set a bubble to link to a journals HP how do I get the API to fill in both boxes for the bubble. When I put in  --set bar3_link|hp it only fills in one of the boxes 
1599488312

Edited 1599488328
The Aaron
Roll20 Production Team
API Scripter
If you're setting it on an NPC using the 5e Monster Manual or similar, their hp attribute doesn't have a current hp filled in.  You can use the reset functionality to copy the max value to the current value: !token-mod {{ --set bar3_link|hp bar3_reset| }} That will cause it to copy the max value to the current value after linking it to hp.  Note that if you're doing this for an NPC, you probably want to unlink the bar so that all your NPCs of the same type don't share a single pool of hit points.  You can't do that in a single command, unfortunately.  You could set the bar to just the value using: !token-mod {{ --set bar1|@{SOME CREATURE|hp} }} bar1 will set the current and max values to the same thing.  This is only viable if you are setting up a single creature type with it since you have to reference the character directly, but I imagine you're already doing that if you're linking anyway.