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

Make inline roll display the roll instead of the result

Is there a way to make an inline roll print what was rolled instead of the result? I've got a character sheet with fields designed to contain entries like the following: Hit: [[1d10 + @{str_mod}]] damage, and the target is slowed until the end of your next turn. And there are buttons to display the content of this field in a roll template. I'd like to add another button that displays the content of the field without rolling anything, so that a player can click the button and show everyone what their ability does.
1595243698

Edited 1595243727
GiGs
Pro
Sheet Author
API Scripter
Is this a character sheet you are designing yourself? Or are you using one of the installed sheets? I''m wondering if you want a macro, or a feature built into the sheet.
Sorry, should have said: it's one I'm writing.
If there were a way to keep the roll template from actually rolling anything (so that it displayed the inline roll command instead), I think I could also get the desired functionality that way.
1595473939
GiGs
Pro
Sheet Author
API Scripter
You can avoid rolling anything by just not including the [[ ]] brackets.  So if you wanted to show something like this: Hit: [[1d10 + @{str_mod}]] damage, and the target is slowed until the end of your next turn. The best thing would be to separate the roll part out into an attribute. <input name="attr_attack_roll" value="1d10 + @{str_mod}" /> <input name="attr_attack_text" value="The target is slowed until the end of your next turn." Then in your button you would send these parts to the rolltemplate <button name="roll-attack" value="&{template:attack} {{name=whatever}} {{attack_roll_text=@{attack_roll}}} {{attack_roll=[[@{attack_roll}]]}} {{attack_text=@{attack_text}}}" ></button> Finally in your rolltemplate, you would bits of information defined above: name, roll, roll_text, attack_text, and any others, and would put them together in the arrangement you want. A very simple example: <rolltemplate class="sheet-rolltemplate-attack"> <div class="sheet-template-container"> <div class="sheet-template-header">{{name}}</div> <div class="sheet-template-row">Hit: {{attack_roll_text}}. {{attack_text}}</div> <div class="sheet-template-row"> Result: {{attack_roll}} </div> </rolltemplate> The trick is, to decide how you want the output to look, then decide how to build that. For things like this Hit: [[1d10 + @{str_mod}]] damage, and the target is slowed until the end of your next turn. Its best to break it up into parts, then rebuild it in the template.
I actually got it working by using a sheetworker and a hidden attribute: when the Hit or other text is updated, the sheetworker constructs an alternate version with any brackets removed. The button which displays the "non-rolled" text uses this alternate attribute.
1595492463
GiGs
Pro
Sheet Author
API Scripter
Thats a good way, keeps process simple.