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

Show Repeating Value Available?

Hey there. I've been working on a custom sheet of mine. I've searched the forums with no success, so am posting if anyone can help me with this. I have made roll buttons for the repeating sections of my sheet, such as attacks and abilities, and am looking for a way to have them listed when called from an API command button. For instance, I want my 'Attacks' roll button if pressed, to spawn API command buttons in chat for each existing repeating weapon. So far I have only been able to get them to spawn specific weapons, when manually listing the value of 'x' for "repeating_weapon_$X_roll". How would I go about having only the existing values of 'x' be shown?
hmmm...
1511261573
Jakob
Sheet Author
API Scripter
You have to either construct the list of buttons from the sheet using sheet workers, or via an API script. Here's what a sheet worker would do: you would watch for changes to, say, the attacks repeating section, and then write an extra attribute, say "attacks_macro", whose value are ability command buttons for all existing attacks, one after another. Then your attacks button could just use the attacks_macro variable to spit out all existing attacks. The 5EShaped sheet and the Pathfinder sheet both do something like this.
Thanks for the reply. I already have an "attacks_macro" set up, my problem is wanting to know how to go about having repeating attacks added, and removed from the macro, when they are created or deleted. I guess I'll just keep searching. Thanks.
1511277164
Jakob
Sheet Author
API Scripter
Yes, I'm aware of what you're trying to do. My suggestion was to have an attribute   "attacks_macro" that contains the actual text of the macro, and which you can keep up to date via sheet workers. Then the text of the  macro  (resp.ability) would just contain @{attacks_macro} rather than containing the actual list of ability command buttons. And via sheet workers, you can have the value of @{attacks_macro} be something like [Sword](~charid|repeating_weapons_-abcdef_attack), [Bow](~charid|repeating_weapons_-ghijkl_attack) and so on, with all the data pulled from the sheet via sheet workers. And then the ability is just e.g. /w @{character_name} @{attacks_macro} or as a global macro /w @{selected|character_name} @{selected|attacks_macro} (of course, you can upgrade this visually with roll templates or whatever you want). Makes sense now?
Yes. That makes much more sense now. I've added it in and have got it working. Thanks a bunch. :)