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

How to use logic in roll templates?

November 05 (3 years ago)

Edited November 05 (3 years ago)

Hi all,


So I've got a location roll on my custom sheet. It rolls a d100 and then it's up to the player to figure out where their character was hit on their body based off this number. I don't like this long winded step so I was hoping to have the dice roll spit out the relevant body part depending on what was rolled. I know you can use a sheet helper thing to do something like "{{#rollbetween}} {{rollName min max}}" to return a result.

Here's what mine outputs:

So yeah, that didn't display right. Where am I going wrong?


edit: Screenshot of code


November 05 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

no, you program the roll templates into the sheet using custom sections, and the values in  the roll buttons are pretty normal.


look at this example: https://github.com/Roll20/roll20-character-sheets/blob/master/Barbaric/barbaric.html

and the documentation: https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates

November 05 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

As Andreas says, you can only use rolltemplate logic helpers as part of character sheet design. You need to be a Pro subscriber to edit a character sheet.


There's no way using standard macros to have the roll return a text value. Technically you can use a rollable table in place of a roll, and this can report a text value, but you cant use roll modifiers with a rollable table.

November 05 (3 years ago)

Thanks both for the replies.

GiGs, when you say "as part of character sheet design", what do you mean? I thought that a custom character sheet with html would count for that? Apologies but Im not too familiar with design terminologies on roll20. Our DM has let me use his pro account to write up a character sheet.

November 05 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Basil N. said:

Our DM has let me use his pro account to write up a character sheet.

Yes, that's what GiGs meant, he just pointed out it's a Pro-feature as you're a free user, and it's a really common people overlook one needs access to a Pro user's game to be able to use and test custom sheets.

Tt's much easier to have Pro for yourself than going through another user, as using the Sheet Sandbox is fantastic for sheet development, is much quicker to test sheet changes.


November 05 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter


Basil N. said:

GiGs, when you say "as part of character sheet design", what do you mean? I thought that a custom character sheet with html would count for that? Apologies but Im not too familiar with design terminologies on roll20. Our DM has let me use his pro account to write up a character sheet.

As Andreas says, a custom character can be used for that. But you need to create a rolltemplate in the character sheet html, and that's where you put the logic helpers.

The links Andreas posted are worth checking out, the second is the rules reference.

November 05 (3 years ago)
Finderski
Sheet Author
Compendium Curator

In short the conditional logic for roll templates doesn't work with the default template by Roll20, you need to also develop a custom roll template within the character sheet.