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

Iniitiative Modification - Maths is Hard

Given   Init: [[ 10.00 &{tracker:-} ]]  How can I keep it to just two decimal places? ie:  If initiative = 14.04   and I apply Init: [[ 10.00 &{tracker:-} ]]   , it generates Output on the Turn Tracker : 4.039999999999999
1467046765
Gold
Forum Champion
Hi Mark, You'll probably want to use Rounding Rolls for this. Someone else like Silvyre may be able to come along and help show the exact macro you would write. Here is the wiki docs for this, <a href="https://wiki.roll20.net/Dice_Reference#Rounding_Ro" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Rounding_Ro</a>...
&nbsp; If I could read in the current Init value, I could re-calc but as-is I don't see a way to apply rounding to the Sum of a value and a variable I can't reference directly.&nbsp; I suspect I'll have to do away with the tie-breaker decimals.
1467051517

Edited 1467051636
Silvyre
Forum Champion
You can reference items on the Turn Tracker by using an Attribute call with the 'tracker' keyword. e.g. @{tracker|Luke Skywalker} @{tracker||@{selected|token_name} is a very hacky way of calling the Turn Tracker item that shares the name of a selected Token. I've had a bit of success working around rounding issues using the following method: Within [[ &{tracker} ]], add the initiative adjustment (e.g. -10.00). Add the current initative (e.g. using @{tracker||@{selected|token_name}) within a floor() function to remove the tie-breaker. Re-add the tie-breaker. All of the above would look something like this: [[ -10.00 + floor(@{tracker||@{selected|token_name}) + 0.04 &{tracker} ]]
Hrm, didn't know we had the ability to call the turn tracker values.&nbsp; Cool. Thanks for the snippet Silvyre