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

Chat menu button inside a roll template which displays another roll template with the result, in the html?

1654086256

Edited 1654086355
Daniel S.
Pro
Sheet Author
I've been going through all the Roll20 wiki articles on Chat Menus, Roll Templates, Macros, etc. I so far have figured out how to make a chat menu within another roll template in an html button, like so. &lt;button type="roll" value= &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '&amp;{template:default} {{name=@{character_name} @{weapon} }} {{attack=[[2d6 + @{skirmishattack}]] [[2d6 + @{skirmishattack}]][[2d6 + @{skirmishattack}]]}} {{Damage=@{cutdamage} , @{thrustdamage} + [[1d6]][[1d6]][[1d6]]}} {{Extra Damage Dice= [1](`/r 1d6) [2](`/r 2d6) [3](`/r 3d6) [4](`/r 4d6) [5](`/r 5d6) [6](`/r 6d6) }} {{Reach=@{range}}} {{Defense=[[2d6 + @{skirmishdefense}]][[2d6 + @{skirmishdefense}]][[2d6 + @{skirmishdefense}]]}} {{Parry/Block=@{parryblock}}} {{Notes=@{other}}} ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name="roll_weaponrepeatingbutton"&gt;&lt;/button&gt;&lt;/span&gt; It displays this, so each number in "extra damage dice" is a button that rolls that many d6's. <a href="https://capture.dropbox.com/mLX9sCJ2uBWWpqX4" rel="nofollow">https://capture.dropbox.com/mLX9sCJ2uBWWpqX4</a> I think it's possible get the dice rolled to show up in their own template, as I've seen it done on another forum post here. That way what the dice are can be clearly labelled in the chat. <a href="https://app.roll20.net/forum/post/10847041/need-help-with-chat-menu-button" rel="nofollow">https://app.roll20.net/forum/post/10847041/need-help-with-chat-menu-button</a> Not sure what I'm missing. I tried putting a second &amp;{template} in the middle but that definitely didn't work.&nbsp; &lt;button type="roll" value= &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '&amp;{template:default} {{name=@{character_name} @{weapon} }} {{attack=[[2d6 + @{skirmishattack}]] [[2d6 + @{skirmishattack}]][[2d6 + @{skirmishattack}]]}} {{Damage=@{cutdamage} , @{thrustdamage} + [[1d6]][[1d6]][[1d6]]}} {{Extra Damage Dice= [1](`/r 1d6) [2](`/r 2d6) [3](&amp;{template:default} {{name=Damage}} {{dmg=`/r 3d6}}) [4](`/r 4d6) [5](`/r 5d6) [6](`/r 6d6) }} {{Reach=@{range}}} {{Defense=[[2d6 + @{skirmishdefense}]][[2d6 + @{skirmishdefense}]][[2d6 + @{skirmishdefense}]]}} {{Parry/Block=@{parryblock}}} {{Notes=@{other}}} ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name="roll_weaponrepeatingbutton"&gt;&lt;/button&gt;&lt;/span&gt; Maybe I have to use hidden attributes somehow like the aforementioned forum link? Or there's a solution I missed somewhere. Thanks for any help.
1654091673

Edited 1654091741
GiGs
Pro
Sheet Author
API Scripter
I assume you are referring to this: {{Extra Damage Dice= [1](`/r 1d6) [2](`/r 2d6) [3](`/r 3d6) [4](`/r 4d6) [5](`/r 5d6) [6](`/r 6d6) }} You need to replace those literal dice rolls with button calls, and include hidden buttons on your sheet. So your sheet might have(not sure what fields you need, but something like this): &lt;button type="roll" name="roll_dice1" class="hidden" value="&amp;{template:default} {{name=1d6}} {{roll=[[1d6]]}}"&gt;&lt;/button&gt; Repeat for 2-6 dice buttons. Then replace the extra damage dice part of the original roll with {{Extra Damage Dice= [1](~dice1) [2](~dice2) [3](~dice3) [4](~dice4) [5](~dice5) [6](~dice6) }}
1654136151
Daniel S.
Pro
Sheet Author
Very cool, I'll give this a try. Thanks.
1654156011
GiGs
Pro
Sheet Author
API Scripter
I just created a detailed guide for this: <a href="https://cybersphere.me/buttons-that-create-other-buttons/" rel="nofollow">https://cybersphere.me/buttons-that-create-other-buttons/</a>
1654159120
Daniel S.
Pro
Sheet Author
Awesome! Thanks!
1654161399
Daniel S.
Pro
Sheet Author
Worked like a charm. Ran into an error at first, but once I added the "~repeating_weapon_" prefix on the&nbsp; [4](~dice4) part it worked nicely.
1654163680
GiGs
Pro
Sheet Author
API Scripter
Excellent. I should have notioced it was in a repeating section, from the button name in your first post.