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

Token Bar 4 API Access

Just curious if there is an official timeline or ETA on when the 4th Token Bar/Bubble will be available to the API and accessible to Scripts?
1759435838
Gold
Forum Champion
I support this and have been asking for it too Bring Bar/Bubble4 into all the same capability as 1-2-3
1759438415
Andrew R.
Pro
Sheet Author
Use the Help Center and Send a request to get Roll20 staff attention. 
Andrew R. said: Use the Help Center and Send a request to get Roll20 staff attention.  Thanks Andrew - I totally didn't think to use that outside of Bug Report/weird interface problems! 😫
1759439261
Andrew R.
Pro
Sheet Author
Cynically, this Bar 4 feature gives off the same vibes as the Token Tooltip feature in that it’s a half done job. I suspect a summer intern did it, and no other Dev cares. 
Hey folks!  Mod Scripts do in fact currently have access to bar4 on tokens, and should be accessible in all the same ways as the other bars (just replace `bar1` with `bar4` so e.g. `bar4_value` or `bar4_max`) Additionally, the current Campaign setting for number of token bubbles is available on the campaign object, and you can watch for it with something like this: on('change:campaign:tokenBubbleMax',(obj,prev)=>{ if(obj.get('tokenBubbleMax') !== prev.tokenBubbleMax) { gotTokenBubbleMaxChange = true; } }); Apologies for the delay in documentation on this; the API support for this feature was released a short while ago, but we haven't yet updated the requisite locations.  They'll be updated soon!
1759447817
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Jeff!
Jeff L. said: Hey folks!  Mod Scripts do in fact currently have access to bar4 on tokens, and should be accessible in all the same ways as the other bars (just replace `bar1` with `bar4` so e.g. `bar4_value` or `bar4_max`) Additionally, the current Campaign setting for number of token bubbles is available on the campaign object, and you can watch for it with something like this: on('change:campaign:tokenBubbleMax',(obj,prev)=>{ if(obj.get('tokenBubbleMax') !== prev.tokenBubbleMax) { gotTokenBubbleMaxChange = true; } }); Apologies for the delay in documentation on this; the API support for this feature was released a short while ago, but we haven't yet updated the requisite locations.  They'll be updated soon! Thanks Jeff - I just use  the Scripts, so was more interested in making sure functionality with things like TokenMod, etc. was a possibility down the road. (And, to be honest, I just test by running TokenMod tests - something like *--set bar4_value|X* - once every couple of days to see if it's implemented) Glad to see it is accessible though, appreciate the Team's work!
1759461554
The Aaron
Roll20 Production Team
API Scripter
Sorry about the delay, I'll get TokenMod updated and deployed this weekend.
1759618451
The Aaron
Roll20 Production Team
API Scripter
Bar4 is now available in TokenMod:&nbsp;<a href="https://app.roll20.net/forum/permalink/12526894/" rel="nofollow">https://app.roll20.net/forum/permalink/12526894/</a>
1759626108
Gold
Forum Champion
Thanks, that is great, and should prove useful configuring or re-configuring a number of Tokens.&nbsp;
Thanks Aaron! (I hope my initial question/request/shout-out didn't come off as whiney or impatient! - I apologise if it sounded that way 😞🙏)
1759766358
timmaugh
Forum Champion
API Scripter
The Metascript Toolbox has also been updated to utilize the fourth bubble. Specifically, Fetch will return the value of the bubble with any of: bar4 bar4_value bar4_current ...the link with either of... bar4_link link4 ...and the max value with either of: bar4_max max4 Just pair those with a token reference in a Fetch syntax structure... such as: @(selected.bar4) @(Bob the Hirsuite.bar4_max) @(@{target|Use Targeting to get ID|token_id}.max4) Also, SelectManager will let you use the 4th bar in criteria for {&amp;select} tags using either&nbsp; max4 &nbsp;or&nbsp; bar4 . Examples of that usage would look like... ...selecting all tokens on the page with a bar4 value greater than 0: {&amp;select *, +bar4&gt;0} ...or... {&amp;select *, -bar4&lt;=0} ...selecting all tokens whose names begin "Skeleton", which have a bar4 under 8: {&amp;select Skeleton*, +bar4&lt;8} {&amp;select Skeleton*, -bar4&gt;=8}
1759772417
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You folks are too cool! Thanks The Aaron and timmaugh!
1759816640
The Aaron
Roll20 Production Team
API Scripter
Jukite said: Thanks Aaron! (I hope my initial question/request/shout-out didn't come off as whiney or impatient! - I apologise if it sounded that way ) Not at all! &nbsp;Thanks for the reminder to publish it. =D
Aaron, is there a way that I can use TokenMod to update all the tokens in my game to set Bar4 to a certain value? (example: AC) Thank you The Aaron said: Jukite said: Thanks Aaron! (I hope my initial question/request/shout-out didn't come off as whiney or impatient! - I apologise if it sounded that way ) Not at all! &nbsp;Thanks for the reminder to publish it. =D
The easiest way to do this is if you have a 'Tokens' page in your game (many modules include this) that has all of the NPCs on a single page, then you can just Ctrl-A on the page and run TokenMod with the bar4 link command: !token-mod --set bar4_link|ac Otherwise TokenMod doesn't have a native way to select all tokens in your game, but if you have installed the Metascript toolbox , then&nbsp; you can do this with&nbsp; TokenMod + SelectManager + Fetch + ZeroFrame . (I'm not 100% sure on the syntax here and I don't have time to test it out at the moment.) !forselected(^) token-mod {{ &nbsp;&nbsp;--ids {&amp; select *} &nbsp; --set &nbsp; bar4_link|ac }} You might want to adjust the macro to differentiate between PCs and NPCs if you are using the 'npc_ac' attribute for them instead of 'ac'.
1760559663
timmaugh
Forum Champion
API Scripter
Yep... If I can hop in to help with the syntax of what Jarren is suggesting... First, install TokenMod and the Metascript Toolbox. That will get all the scripts you need. Then you have to answer if you want to *link* bar4 to an attribute (probably not for mook tokens, but maybe for some player tokens), or if you want to put a static value in the bar (the same for everyone), or if you want to put an independent value into each token's bar4 (introducing some bit of randomness. To update all PC tokens to use the attribute "ac"... !forselected token-mod --set bar4_link|ac {&amp;select *, +pc} To update all NPC tokens to use the attribute "npc_ac"... !forselected token-mod --set bar4_link|npc_ac {&amp;select *, +npc} To update all mook-skeleton (based on the character sheet named "Skeleton" but individually named to start "Skeleton" plus an identifier like a number) tokens to have the value of the npc_ac field without using the link... !forselected token-mod --set bar4_max|@{Skeleton|npc_ac|max} bar4_value|@{Skeleton|npc_ac|max} {&amp;select Skeleton*} To give all such Skeleton mooks a current value of npc_ac that is less universal (by an individual roll of 1d4): !forselected(^) token-mod --set bar4_max|@{Skeleton|npc_ac|max} bar4_value|[^\[^\ @{Skeleton|npc_ac|max} + 1 + [^[^1d4^]^] /^]/^] {&amp;select Skeleton*} Various combinations of the techniques employed above can service most situations, so if you don't understand any of them or have a situation that is slightly different than what I addressed, post back and I can try to help more.
Thank you very much, I will make use of those suggestions and figure out a way.&nbsp; &nbsp; &nbsp;I think the easiest would be for me to drag the ones I want out to a page and do it that way.&nbsp; That way I can choose which ones to NOT do it on.&nbsp; &nbsp; Thank you!
1760570901
The Aaron
Roll20 Production Team
API Scripter
What they said!&nbsp; Just be sure to store the default token again when you're done.&nbsp; If you want to do it for all tokens representing the character the currently selected token does, you can do: !token-mod --set bar4_link|ac defaulttoken --ids @{selected|character_id}