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

Custom Roll Template - branch by string property

I am building a customised character sheet for Coriolis, and am trying to get the roll template to display results based on the selection made during the roll process. The HTML code displays a dropdown for the player to select which skill is being applied, and the number of dice to be rolled: <button type="roll" class="btnD6" name="roll_Pray" value="&{template:myCoriolis_pray} {{name=@{character_name}}} {{skill=?{Skill|Command|Craft|Culture|DataDjinn|Dexterity|Engineering|Force|Infiltrate|Manipulate|Medicurgy|Melee|Military|MysticPower|Network|Observe|Pilot|Ranged|Science|Survive|Technical}}} {{roll=[[(?{Re-roll|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16})d6>6]]}}"></button> What I need to do is show output based on what skill was chosen: <rolltemplate class="sheet-rolltemplate-myCoriolis_pray">     <div class="sheet-header_background"><div class="sheet-header">{{name}} prays to</div></div>     <div class="sheet-content_background"><div class="sheet-content">             {{#skill Command}}The Judge{{/skill Command}}             {{#skill Craft}}The Dancer{{/skill Craft}}             {{#skill Culture}}The Traveler{{/skill Craft}}             ... etc.             <br />and re-rolls {{skill}} = {{roll}}         </div>     </div> </rolltemplate> I can see that {{skill}} has a value because it correctly displays in that output line, but I cannot figure out how to get the {{#skill myselection}} logic to recognise the value passed to it and display accordingly. I've tried using inverted commas ( {{#skill "myselection"}} ), and even numerical values in place of text, all without success. Is it possible to have the template work with string property values? If not, is there another way to display content based on what was selected during the roll? I appreciate any ideas.
1549590703
Finderski
Pro
Sheet Author
Compendium Curator
You could use a numerical value with a rollTotal() type of convention. You could do something like: {{skill=?{Skill|Command,[[1d0+1]]|Craft,[[1d0+2]]|etc}}} And then in your roll template: {{# rollTotal()   skill 1}}The Judge{{/rollTotal() skill 1}} <!--Command--> {{#rollTotal() skill 2}}The Dancer{{/rollTotal() skill 2}} <!--Craft--> Something like that...
1549594332
GiGs
Pro
Sheet Author
API Scripter
Is it possible to have the template work with string property values? If not, is there another way to display content based on what was selected during the roll? rolltemplate branching functions don't work with strings. You have to use numbers, and put them in inline roll brackets to make sure they are recognised as numbers. As Finderski says, you can use numerical values.  I don't think you need to use [[1d0+1]] though. I think this should work: {{skill=?{Skill|Command,[[1]]|Craft,[[2]]|etc}}}
1549594465

Edited 1549594565
Cool! I asked for ideas, and that's a good one. It's not actually necessary to use a die roll in the selection... {{skill=?{Skill|Command,[[1]]|Craft,[[2]]|etc}}} works perfectly well to generate a fixed "rolled" value that can be used by the #rollTotal() helper function, and gives the functionality I want. It would still be great to use text descriptors if anyone has any ideas for that, but this is a viable workaround. Thank you Finderski. [edit] ... and GiGs.
1549602686
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'd recommend using two fields. One that is displayed and shows the skill name, the other that has the number in it to control the display of the other info. You don't need to display the number info one. Additionally if the skill names are static, then you could just hardcode the skill name to be displayed when that skill's index number is used.