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

Roll button isn't picking up the correct value for an attribute

I have an attribute: <input type="number" name="attr_psionic_ability" value="15" /> and a roll button: <button   type="roll"   value="Save vs. Psionics: @{psionic_ability} [[d20>@{psionic_ability}]]"   name="roll_bonus_psionics" /> The roll button is in a repeating section, but the attribute I'm referring to is global. I can change the value in the input to anything, but when I make the roll it always uses "15" as the value. If I run it as a macro it works fine: /em @{selected|psionic_ability} [[d20>@{selected|psionic_ability}]] What am I doing wrong?
1626642220
GiGs
Pro
Sheet Author
API Scripter
It's possibly because yoiur button syntax is incorrect. It should be <button   type="roll"   value="Save vs. Psionics: @{psionic_ability} [[d20>@{psionic_ability}]]"   name="roll_bonus_psionics" ></button>
1626642640

Edited 1626643068
Grinning Gecko
Pro
Sheet Author
Unfortunately that didn't fix it. Same issue. I've tried referencing other global attributes, and they're all having the same issue. It seems whatever value the sheet loads with is what the roll uses, and doesn't pick up the current value. Actually that's not even true. Even if I change the value then reload my browser, it still seems to be using the default value set in the `value` attribute.
1626643042
GiGs
Pro
Sheet Author
API Scripter
Can you post the code for your full repeating section?
1626643251

Edited 1626643286
GiGs
Pro
Sheet Author
API Scripter
I just made a sheet, and this was the entire code: < input   type = "number"   name = "attr_psionic_ability"   value = "15"   /> < fieldset   class = "repeating_test" >           < button        type = "roll"      value = "Save vs. Psionics: @{psionic_ability} [[d20>@{psionic_ability}]]"      name = "roll_bonus_psionics"    ></ button >    </ fieldset > It worked perfectly. I changed the psionic_ability attribute to 20, and it was used correctly.
1626643468

Edited 1626644240
Grinning Gecko
Pro
Sheet Author
Forget the repeating section. It's not even working outside of a repeater for me: <input type="number" name="attr_psionic_ability" value="15" /> <button type="roll" value="Save vs. Psionics: @{psionic_ability} [[d20>@{psionic_ability}]]" name="roll_bonus_psionics" ></button> That's still giving me 15 every time, even if I change the value.
Interestingly, any dice rolls I have within repeaters referencing repeating values are working perfectly. I only have two rolls on the sheet that are using global values, and both of those seem to broken / referencing an old value. Creating a new character using the same sheet seems to resolve the issue though, so I guess there's something messed up in the data of the sheet I've been testing with.
1626648862
GiGs
Pro
Sheet Author
API Scripter
thats possible - sheet corruption does happen from time to time. When you have a glitch and everything seems to be coded correctly, it's always a good idea to check with a separate character.
1626666367
Oosh
Sheet Author
API Scripter
Did you maybe have your <input name="attr_bonus_psionic"> HTML inside the repeating section at some point, even accidentally? That might've created the attribute inside the repeating row on that sheet, and is now getting grabbed instead of your non-repeating version.
Oosh said: Did you maybe have your <input name="attr_bonus_psionic"> HTML inside the repeating section at some point, even accidentally? That might've created the attribute inside the repeating row on that sheet, and is now getting grabbed instead of your non-repeating version. Ah, that's entirely possible. I'll keep that in mind in the future.