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

Macro / Roll Template questions

April 30 (5 years ago)

Edited April 30 (5 years ago)

Hey folks.  I hope everyone is doing well in these crazy times.  I'm doing great actually.  I've been focusing on a custom character sheet for over a month now.  It's really satisfying my creative drive.  Anyway, I've now handled everything but making the roll buttons work.  I've read the pages describing macros and roll templates, but there are a few things I don't understand.


{{#rollLess() <rollname>}}

Checks the total of an inline roll for the value. If the roll result is less, the section is shown. For example, {{#rollLess() deathsave 10}} would check the "deathsave" property for an inline roll that resulted in 9 or less.


I have an attribute, let's call it attr_my_attribute.  I want to press a button and have a d20 be rolled, and if the result is less than the value I have stored for attr_my_attribute, I want to display some text indicating success.  So far I haven't been able to write code that would do that.  What I have currently is:

value='&{template:default}{{name=my_attribute}}{{attribute_check=[[1d20cf0cs0]]}}{{#rollLess()my_attribute}}{{Success!}}'

Also, what does cf0cs0 mean?


Second, how do I get my initiative roll to show up on the turn tracker, and is it possible to do this without having to first select my mini on the map?  Right now I have this:

value='&{template:default}{{name=initiative_roll}}{{initiative_roll=[[1d20cf0cs0+@{initiative_modifier}]]}}'


Finally, I have dice fields on my character sheet.  Currently they're stored as:

<div class="dcenum section">
	<div class="whiteText blueBackground section">Dice #</div>
	<input class="field" name="attr_number_of_damage_dice" type="number">
</div>
<div class="dcefct section">
	<div class="whiteText blueBackground section">Facet #</div>
	<input class="field" name="attr_damage_dice_facet_number" type="number">
</div>
I could probably store them another way, but I chose that method because I don't know how many or which facet number the player will choose.  In case this isn't obvious, 3d6 would be Dice # = 3, Facet # = 6.  My question is, how would I write a macro so that I can press a button and it would pull the dice from those fields and roll them?

Thanks for reading. = )
April 30 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Expressions like this

{{#rollLess() <rollname>}}

are uses only in character sheet code, in the rolltemplate design section. They cant be used in button values like you have in your example.


cf0cs0 

cf and cs are for setting the range for critical failure and critical success. By default, does are red if they show the minimum value, and green if they show the max. Those represent cf1cs6 (for a d6). By setting the values to 0, you ensure the dice never change colour - no red on minimum or green on maximum.


Second, how do I get my initiative roll to show up on the turn tracker, and is it possible to do this without having to first select my mini on the map?  Right now I have this:

value='&{template:default}{{name=initiative_roll}}{{initiative_roll=[[1d20cf0cs0+@{initiative_modifier}]]}}'

If rolling the initiative score, the only way to automatically add that to the turn tracker is with a token selected. The turn tracker shows tokens, not characters (this is because you might have, say, 6 goblins all attached to the same character sheet but with different intiative scores)

To get it to work, add &{tracker} to your roll, like so

value='&{template:default}{{name=initiative_roll}}{{initiative_roll=[[1d20cf0cs0+@{initiative_modifier} &{tracker}]]}}'

It has to be inside the inline roll brackets.


For your last question, you definitely want to set value="something" for those, or you'll get errors when people try to roll dice before they've entered a value. 

<div class="dcenum section">
	<div class="whiteText blueBackground section">Dice #</div>
	<input class="field" name="attr_number_of_damage_dice" type="number" value="1">
</div>
<div class="dcefct section">
	<div class="whiteText blueBackground section">Facet #</div>
	<input class="field" name="attr_damage_dice_facet_number" type="number" value="6">
</div>

You can add them into a macro simply enough:

@{number_of_damage_dice}d@{damage_dice_facet_number}

You might want to use shorter attribute names, so you can do 

@{damage_number}d@{damage_size}


Thank you.  That all worked for me.  I'm not sure whether I want to get into roll templates.  We'll see.