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

Need Help With Final Button

This is the last thing I have to do with my character sheet before it is ready to be used in an actual game. I'm so excited! The thing that I'm having a problem with is an attack roll with a damage button in the chat. When I click the damage button, it rolls everything correctly but it doesn't look quite right and I'm not sure how to fix it or CSS it.  This is how it looks in the chat: This is the HTML for the attack roll: < button type = "roll" class = "attack-button" name = "roll_attack" value = "@{whispertoggle}&{template:default}{{name=@{character_name}}}{{Roll=[[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]] | [[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]]}}{{@{atkname}=[Damage] (! 
 [[@{dmgbase} + @{dmgattr} + @{dmgmod} ]] ) }}" class = "sheet-attack-button" > < span name = "attr_atkname" ></ span > </ button > (Optional) Bonus brownies points for anyone who can help me with getting the money total to stop at 2 decimal places: Here is the HTML: < div class = "totalbox" > < div class = "totalheader" > Total(G) </ div > < input type = "number" name = "attr_totalgalleons" class = "total-galleons" value = "(@{knuts}/100) + (@{sickles}/10) + (@{galleons}) + (@{rubies}*10)" disabled > </ div >
1651431346
GiGs
Pro
Sheet Author
API Scripter
Try this value="round(100*(@{knuts}/100 + @{sickles}/10 + @{galleons} + @{rubies}*10))/100"
1651432319
GiGs
Pro
Sheet Author
API Scripter
I just realised I focussed on your bonus question. If you want to change the way the chat output appears, you'll need to create a rolltemplate for your sheet. That can be complicated but gives you full control of the apperaance - you'll have to check the wiki for creating rolltemplates.
1651432495

Edited 1651432528
GiGs
Pro
Sheet Author
API Scripter
If your issue is the roll code appearing at the bottom of your screenshot, the problem seems to be with the formatting of your damage output, and you havent included the code for that button so there's no way for readers to fix it.
I'll check out the wiki for the rolltemplates, but I did post the code for the button. This is the code for the attack roll on the character sheet: < button type = "roll" class = "attack-button" name = "roll_attack" value = "@{whispertoggle}&{template:default}{{name=@{character_name}}}{{Roll=[[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]] | [[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]]}}{{@{atkname}= [Damage] (! 
 [[@{dmgbase} + @{dmgattr} + @{dmgmod} ]] ) }} " class = "sheet-attack-button" > < span name = "attr_atkname" ></ span > </ button > Inside the attack roll is this code for the chat button: [Damage](! 
 [[@{dmgbase} + @{dmgattr} + @{dmgmod} ]] ) }} As for the bonus question, 10 brownie points for you lol thank you.
1651433994
GiGs
Pro
Sheet Author
API Scripter
Thats the code for the attack button, but as I understand it (I may be misunderstanding), your issue is when people click the damage button. What's the code for that? Thanks for the brownie points :)
1651434067

Edited 1651434113
GiGs
Pro
Sheet Author
API Scripter
Oh, I think I see the issue -  you've included the code for the damage button in the button itself. You shouldn't do that. You should create another hidden button in your sheet, and have your button call that instead.
1651434765
GiGs
Pro
Sheet Author
API Scripter
Here's a simple example:      < button type = "roll" name = "roll_attack" value = "&{template:default}{{name=@{character_name}}}{{Button=[Whatever](~damage)}}" >         Attack     </ button >     < button type = "roll" name = "roll_damage" class = "hidden" value = "&{template:default}{{name=@{character_name}}}{{Output=yay}}" >         Damage     </ button > The first button appears on the character sheet, and when you click it includes the button to trigger the second button. Note in your code, you have a syntax error. You have class twice - only one of those will be used, the other will be ignored. You can combine classes in the same class argument, simply separate them with commas, like so: class="attack-button sheet-attack-button" It might matter in this case, since they are similar they might be the same class. But it's handy to know. Also class="hidden" is a special roll20 class, that will hide the element.
I didn't realize I had class in there twice. Thanks for pointing that out. I rewrote the code for the buttons like so: < button type = "roll" class = "attack-button" name = "roll_attack" value = "@{whispertoggle}&{template:default}{{name=@{character_name}}}{{Roll=[[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]] | [[d20 + @{atkattr_base} + @{atkprofflag} + @{atkmagic} + @{atkmod}]]}} {{@{atkname}=[Damage](~damage)}}" > < span name = "attr_atkname" ></ span > </ button > < button type = "roll" name = "roll_damage" class = "hidden" value = "&{template:default}{{name=Damage}}{{Output=[[@{dmgbase} + @{dmgattr} + @{dmgmod}]]}}" > Damage </ button > Not entirely sure what went wrong here...
1651441660
GiGs
Pro
Sheet Author
API Scripter
Looks like the button is inside a repeating section, which there was no way to tell before. That requires a slightly different syntax. Try this: {{@{atkname}=[Damage](~repeating_attack_damage)}}
Sorry about that. I didn't know that being inside a repeating section made a difference but now I know. It works now so thank you very much!
1651443386
GiGs
Pro
Sheet Author
API Scripter
Roll20 has a lot of gotchas to trip you up - repeating sections are often cultpits :)
I just want to say thanks, GiGs. My sheet is basically done now and I'm just doing proof reads to fix any spelling errors and stuff like that. Super excited to show my friends the new sheet we will be using from now on in our Harry Potter game. I'll try to learn some more advance coding for the next sheet I try to make and I'll be reading your blog for any helpful tips.