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

Help! Lost in die roll template hell....

So I'm kind of at my wits end. I've tried to understand custom sheet die roll templates , but I must be stupid. I have no clue how these work. I do understand how die roll buttons work (that's pretty clear). The problem is, I can't seem to make the die roll button do what I need. I am making a custom sheet with a homebrew system that calculates damage based on how much the difficulty of the attack was exceeded. The best I can do is this atrocity: <button class="sheet-hpistol" type="roll" name="hpistol" value="&{template:default} {{name=Heavy Pistol - @{CName}}} {{Attack/Damage=[[(1d20+@{Handguns}-?{Difficulty?|0})*3]]}}"> Heavy Pistol</button><br /> While this works, in a VERY clunky and ugly fashion, a miss results in a negative value (yuck). Plus, I'd really like a separate value to be displayed for the score (total) on the die roll, the difficulty (which is input by the user) and the resulting damage. A result kind of like this would be great: Any help on this would be GREATLY appreciated. I am way over my head here. :(
1598173401
GiGs
Pro
Sheet Author
API Scripter
Try this: &{template:default} {{name=Heavy Pistol - @{CName}}} {{Attack Score=@{Handguns}}} {{Difficulty=?{Difficulty?|0}}} {{Damage=[[{0d0,1d20+@{Handguns}-?{Difficulty?}}kh1 *3]]}} Make it all one line though. I put a linebreak in there so the last part was visible, and a linebreak will break the template.
GiGs said: Try this: &{template:default} {{name=Heavy Pistol - @{CName}}} {{Attack Score=@{Handguns}}} {{Difficulty=?{Difficulty?|0}}} {{Damage=[[{0d0,1d20+@{Handguns}-?{Difficulty?}}kh1 *3]]}} Make it all one line though. I put a linebreak in there so the last part was visible, and a linebreak will break the template. Hey, GIGs! First off, thank you SOOO much for your help again. This is awesome! (as usual!) One thing I was wondering... is there any way to have it display the roll total (e.g., the d20+Handgun skill total)? Something generating a result like this, perhaps? In any case, thanks again! This is incredibly helpful. I'm nearly done with my custom sheet (and man has it been a learning experience!) I couldn't have done it without you and Finderski. :)
1598210645

Edited 1598210714
GiGs
Pro
Sheet Author
API Scripter
It is possible, but only due to a recent discovery (see the Reusing Rolls trick in the Stupid Tricks thread). it requires you to create some inline rolls in a specific way, and then extract them for display. &{template:default} {{name=Heavy Pistol - @{CName} }} {{Skill Level=@{Handguns}}} [[{0,[[1d20+@{Handguns}]]-?{Difficulty?}}kh1 *3]] {{Difficulty=?{Difficulty?|0}}} {{Roll Total=$[[0]]}} {{Damage=$[[1]]}} Again, remember to remove the line break. Note that inline roll is not in {{ }} brackets - it doesnt get displayed directly. The $[[0]] and $[[1]] extract specific rolls from it and display them.
I know I've said it a lot, but it deserves saying again. You are AWESOME! Thank you so much. This should work great. And I think I'll also peruse that thread you spoke of (even though I probably won't understand half of it! lol).
1598212441
GiGs
Pro
Sheet Author
API Scripter
Thanks :) There are some things i dont understand in that thread, lol. But most of it is accessible, there's just so much of it if you try to read all at once your eyes will glaze over :)
lol Looking forward to having my eyes glaze over. And as a follow-up, your code worked PERFECTLY! :)
1598212773
GiGs
Pro
Sheet Author
API Scripter
great :)