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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Bug?] API Command Button output is Different than the Button it References...

1516484867

Edited 1516529837
Finderski
Pro
Sheet Author
Compendium Curator
Tried posting this is the Character Sheet Forum to see if anyone had thoughts, but no responses, so figured I'd post this here... Weird situation, and not sure if this is a but or something I'm doing wrong, but...I'm working on a sheetworker to output a stat block with clickable items to roll dice. Those clickable items refer to the actual sheet buttons, but things are different when using the API button (or when creating a macro using the shortcut to the button. First, here's the output: Notice in the Statblock, that Short Sword shows STR+1d4!+1, but when I click on that, the output shows Damage (Str+1d4!+0). The roll below that is from clicking the actual button on the character sheet and the Damage shows Str+1d4!+1. I get the same result as the API button if I create my own Ability with the following code: %{Efaa Etrob|repeating_meleeweapons_$0_ tMeleeWeapon } So, here's the code for the API button: **@{repeating_meleeweapons_$0_WeaponType}**: [STR+@{repeating_meleeweapons_$0_MeleeDieNum}d@{repeating_meleeweapons_$0_DmgType}+@{repeating_meleeweapons_$0_MDmgMod}](~repeating_meleeweapons_$0_ tMeleeWeapon ) Here's the HTML for the sheet button: <button type='roll' name='roll_ tMeleeWeapon ' value='@{skillwrt} @{defdTemplate} @{rolltMeleeWeapon}'></button> <input type='hidden' name='attr_rolltMeleeWeapon' value="{{name=@{character_name}}} {{weapon=@{WeaponType}}} {{damage_type=Str+@{MeleeDieNum}d@{DmgType}+@{MDmgMod}}} {{damage=@{rollMeleeWeapon}}} {{raise=@{DmgRaise}}} {{dmgmod=@{dmgmod}}} {{notes=@{meleeWNotes}}}" /> NOTE: This is not just cosmetic, either...hovering over the roll shows the +0 and +1 are reflected in the roll itself, too. Am I doing something wrong, or is this a bug with Roll20 that I need to report?
1516529902
Finderski
Pro
Sheet Author
Compendium Curator
I misspoke...it's actually an Ability Command Button I'm working with, not an API Command Button...the problem still persists as noted, however.
1516669283
Steve K.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The issue is that you've named a repeating and non-repeating attribute the same thing, which our  character sheet guide says not to do . So, when you're doing the dynamic reference of the ability with the $0 to reference it's index without the full context it's finding the non-repeating match because it appears first in the list and returning that value. The easiest solution would be to change the name of the "mdmgmod" on line 7567 of your sheet to not conflict with the repeating_MDmgMod on line 4951.
1516679627
Finderski
Pro
Sheet Author
Compendium Curator
Thanks...didn't realize I'd done that. :-/ 
1516736459

Edited 1516736602
Steve K.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Let us know if you run into any other weirdness or related issues. For this issue though I'm going to mark it resolved. In tangentially related news, the sheet is looking sharp, good work! Though you are creeping up toward a very high number of data attributes. over 1200. For performance reasons you might think about ways to minimize or cut down on total attributes for the long term health of the sheet.
1516736626
Finderski
Pro
Sheet Author
Compendium Curator
Definitely, mark it as resolved.  Steve K. said: In tangentially related news, the sheet is looking sharp, good work! Thanks! :)