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

get the value from a roll_button in a repeating section

1558126897
GiGs
Pro
Sheet Author
API Scripter
Does the API have any access the values of buttons on a character sheet (defined as roll_name, not attr_name)? Specifically, can you iterate through the roll buttons in a repeating section and grab their values?
1558127145

Edited 1558127229
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
No, the roll buttons are a weird shadow version of abilities. They work like abilities, but do not exist in any form that the API can see, let alone work with. EDIT: What are you looking to do? There may be other work arounds.
1558128094
GiGs
Pro
Sheet Author
API Scripter
I had an idea to make a chat menu script. It would scan a named repeating section on a selected character sheet, grab each button's value, and the name value for the row, and output a chat menu for that sections actions. But if there's no access to the button value, i cant see how to do that.  Do you have any ideas for workarounds? I noticed in another thread the pathfinder sheet has a hidden attribute to hold the button value, which looked like a clever way of giving access to this text, but needed the sheet to be written with it in mind. I dont think most sheets do that.
1558129354
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, great minds think alike. I'm working on a menu maker script as well. I'm going with user defined menu templates. Not sure how well it's going to work yet.
1558129757
GiGs
Pro
Sheet Author
API Scripter
Hehe. There have been so many posts lately where the response has been "use a chat menu instead" it's only natural we would think of it.
1558130329

Edited 1558130346
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
probably. So, I'm still not sure that my method is going to work, but what I'm going for is that the user would create a template on the script's character sheet in a format something like this: &{template:npcaction} {{description= **Melee:** !s{repeating_attack_$X_atkrange: } [@{repeating_attack_$X_name}](~repeating_attack_$X_roll) !e{repeating_attack_$X_atkrange} **Ranged:** !s{repeating_attack_$X_atkrange:ft;loose} [@{repeating_attack_$X_name}](~repeating_attack_$X_roll) !e{repeating_attack_$X_atkrange} }} The bolded sections are my prototype start/end markers and filters to control which rows to add to that area of the macro (in the above a melee vs ranged section). This is still very much a prototype though.
1558131820
GiGs
Pro
Sheet Author
API Scripter
I'll be interested to see how it turns out.
1558239265
Finderski
Pro
Sheet Author
Compendium Curator
So...you can use those buttons as part of ability command buttons.  For the Savage Worlds Tabbed sheet I've been working on a stat block feature that will output a "chat menu". If you know the names of the buttons (or have a way of deriving them), you could do something like this: [Athletics @{selected|athletics_display}](~selected|tAthleticsRoll) That creates a "button" called Athletics (which also displays the skills stat value, e.g. d6) and when you click it, it rolls the sheet button called roll_tAthleticsRoll So, in that situation, you don't need to know the value of the roll button, because you're calling the roll button directly. I may just not be understanding what you're wanting to do...
1558241574

Edited 1558241604
GiGs
Pro
Sheet Author
API Scripter
That was the first approach I tried, and it works for normal buttons, but doesnt seem to work for buttons in a repeating section. At least, I've had no success getting them to work on the couple of sheets I've tried. Have you managed that?
1558242846
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, buttons for repeating sections work just fine. Given a repeating section called attack and a roll button called roll: [Some Name here](~character Name|repeating_attack_$0_roll) will create a roll button to call the roll of the first item in the section. You can also replace $0 with a specific row id to hard lock the button to a specific row's roll button.
1558246302

Edited 1558246710
GiGs
Pro
Sheet Author
API Scripter
This is weird (and embarrassing). I've tested it now on the pathfinder sheet, and it's working. But on my own sheet, the one I've done most of my testing on, it's not working. This is the string I'm using now [Test](~Henchknights|repeating_npcCombat_$0_npcCombatbtn) those are named correctly. I'm getting No ability was found for %{Henchknights|repeating_npcCombat_npcCombatbtn} I have no idea why its not working. Any ideas what could cause this? I have tried with all lower case, and with correct UUIDs (for example -KbCtl06OCpCav5Lb-bb). No luck.
1558252015

Edited 1558252115
GiGs
Pro
Sheet Author
API Scripter
I may have found a bug, or maybe this is something I just didnt know. It seems if you have an uppercase letter in a repeating sections name, it breaks this feature. The funny thing is, the buttons work on the sheet, but if you drag them to the macro bar, or type them in chat, they dont work. When you drag them to the macro bar, the upper case letters change to lower case, and the button is non-fucntional. When typing in chat, neither lower case nor upper case are recognised. So, just make sure the repeating section names are lower case (the bit to the left of the id - individual field names to the right of the id work fine either way). It looks like no data is lost or hidden by changing the section name to lower case, too, which is a relief. Thanks Findersky. This is great - I can make my universal chat menu script. I had a working prototype, before i thought this feature didn't work, and switched over to the approach I used in the pathfinder chat menu script.
1558258832
Finderski
Pro
Sheet Author
Compendium Curator
GiGs said: Thanks Findersky. This is great - I can make my universal chat menu script. I had a working prototype, before i thought this feature didn't work, and switched over to the approach I used in the pathfinder chat menu script. Happy to repay the favor, though it seems like you and Scott C did most of the heavy lifting...I just mentioned something you were already aware of. LOL