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

Text showing up in box depending of character sheet variables

Hi folks, Is there an easy way to make so that a text shows up in a box if a condition is met? Say I have a box on the sheet where the value can either be "1" or nul. If its 1, I'd like the box to say "STR - Primary" or something like that. If nul, then "STR - non Primary" should be written. Its for a Castles & Crusades game, if anyone is wondering Thanks in advance
1589184987
GiGs
Pro
Sheet Author
API Scripter
This can be done with a sheet worker. Let's say the box has an attribute name of "box" for simplicity, and the attribute whose value youre checking is called "toggle" Check if your sheet's html has a section that starts <script type="text/worker"> If it doesnt, create this at the very bottom of your sheet <script type="text/worker"> </script> Then copy the following sheet worker and put it between the <script and </script> lines: on("change:toggle", function() {     getAttrs(["toggle"], function(values) {         let checking = values.toggle;         let text = (checking === "1") ? "STR - Primary" : "STR - non Primary";         setAttrs({             box: text         });     }); }); That should do it. Just change the word each instance of the world toggle to the name of the attribute you check, and the box  to the name of the attribute where the text goes. 
Cool, thanks for the reply, is this feasible with macros as well?
1589194611
GiGs
Pro
Sheet Author
API Scripter
Macros on their own cant change anything on a character sheet. But as a Pro user you have access to API scripts, and could use chatSetAttrs, Ammo, or similar scripts to alter attributes on the character sheet.