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

'Simple' API Chat Buttons (normally working, not in repeating section)

1596471477
Avalia
Sheet Author
While improving my Shadowrun 6th character sheet, I am facing a problem, I can't handle on my own. Help is appreciated ;) In the system there is some kind of "wild die", that alters the rules for the other dice depending on results (1, 2-4, 5-6) Thus, I created a first roll command to roll the relevant dice and let the user pick out the result: <button class="widesmallbutton" type="roll" name="@{skill_perception_total}" value="@{gm_toggle} &{template:wilddie}{{mainattribute=^{@{skill_perception_attribute}}}}{{secondattribute=^{skill_perception}}}{{wilddie=[[1d6cs>5cf<1]]}}{{note=[1](~skillperceptionone)}}{{note2=[2-4](~skillperceptiontwo)}}{{note3=[5-6](~skillperceptionthree)}}"> <span class="red" data-i18n="skill_short">Skill</span> </button> The three results are handled via invisible buttons: <button class="invisbutton" type="roll" name="roll_skillperceptionone" value="@{gm_toggle} &{template:roll}{{mainattribute=^{@{skill_perception_attribute}}}}{{secondattribute=^{skill_perception}}}{{wilddice=1}}{{dice=[[(@{skill_perception_total}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>6>6sd]]}}"></button> <button class="invisbutton" type="roll" name="roll_skillperceptiontwo" value="@{gm_toggle} &{template:roll}{{mainattribute=^{@{skill_perception_attribute}}}}{{secondattribute=^{skill_perception}}}{{wilddice=2-4}}{{dice=[[(@{skill_perception_total}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>5>5sd]]}}"></button> <button class="invisbutton" type="roll" name="roll_skillperceptionthree" value="@{gm_toggle} &{template:roll}{{mainattribute=^{@{skill_perception_attribute}}}}{{secondattribute=^{skill_perception}}}{{wilddice=5-6}}{{dice=[[(@{skill_perception_total}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>5>5sd+3]]}}"></button> This example works fine in the sheet, but once I am trying the same thing within repeating section, errors occur. I have tried the following: <button class="longbutton" type="roll" name="meleeweapon" value="@{gm_toggle} &{template:wilddie}{{mainattribute=^{skill_melee}}}{{specialisation=^{@{mwskill}}}}{{weaponname=@{melee_name}}}{{wilddie=[[1d6cs>5cf<1]]}}{{note=[1](~repeating_meleeweapons_meleeattackone)}}{{note2=[2-4](~repeating_meleeweapons_meleeattacktwo)}}{{note3=[5-6](~repeating_meleeweapons_meleeattackthree)}}"> <span class="red" data-i18n="attackroll">Angriffswurf</span> </button> <button class="invisbutton" type="roll" name="roll_repeating_meleeweapons_meleeattackone" value="@{gm_toggle} &{template:roll}{{mainattribute=^{skill_melee}}}{{wilddice=1}}{{dice=[[(@{melee_attack_pool}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>6>6sd]]}}"></button> <button class="invisbutton" type="roll" name="roll_repeating_meleeweapons_meleeattackone" value="@{gm_toggle} &{template:roll}{{mainattribute=^{skill_melee}}}{{wilddice=2-4}}{{dice=[[(@{melee_attack_pool}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>5>5sd]]}}"></button> <button class="invisbutton" type="roll" name="roll_repeating_meleeweapons_meleeattackone" value="@{gm_toggle} &{template:roll}{{mainattribute=^{skill_melee}}}{{wilddice=5-6}}{{dice=[[(@{melee_attack_pool}-1+@{use_wounds}+@{sustain_malus}+@{mod_roll})d6@{exploding_dice}cs>5>5sd+3]]}}"></button> The "wild die roll" (first part) works, but the second part yields the following error: Can someone give me a hint into the right direction? =)
1596474295

Edited 1596475822
GiGs
Pro
Sheet Author
API Scripter
For your button names, dont include the repeating section in the name. Don't do this: name="roll_repeating_meleeweapons_meleeattackone"  do this instead: name="roll_meleeattackone"  Exactly the same way you did with the attribute. For your longbutton , it looks like you are printing the invisibuttons in chat, so you do need to include the repeating section name in those buttons. So try the above change to your invisibuttons but leaving the longbutton code unchanged.
1596475586
Avalia
Sheet Author
Step 1: Remove the repeating section from the rolls - check. After doing so, the first button worked. Step 2: Noticing that they aren't all supposed to be meleeattackone *coughs* Step 3: Happiness. Everything works already. Thank you very much.
1596475806
GiGs
Pro
Sheet Author
API Scripter
hehe, great!