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

Negative Number Comparison

[...other stuff...] {[[1d20}]],-1}>[[-X]] [...other stuff...] returns: Expected [0-9] but \"-\" found. As long as my right-side comparison is >= 0 (X in the above example), the HTML macro works. But if X drops below 0, it dumps on the "-" sign. Note this works in the User Macro on the sheet's 3rd tab, but it does not work in the character sheet. Here's the full inline macro if you're interested. Everything works except as described above. <button type="roll" style="height: 18px; text-align: right;" name="roll_attack" value="&{template:default} {{name=Agility Task Roll}}{{Base Difficulty/Target#: [[@{task_level}]]/[[@{task_level}*3]]}}{{Mod Difficulty/Target#:  [[(@{task_level}+@{task_mod})]]/[[@{task_level} * 3 + @{task_mod} * 3 + @{target_adjustment}]]}}{{Agility Total: [[ @{agility_bonus} + @{agility} ]]}}{{Final Target Number: [[ @{task_level} [Task Level] * 3 + @{task_mod} [Task Mod] * 3 + @{target_adjustment} - (@{agility_bonus} + @{agility}) ]]}}{{?{Task Type|Normal,Normal Task Roll [[ 1t[[[ {[[1d20|Advantage,Task Roll with Advantage [[ 1t[[[ {[[2d20kh1|Disadvantage,Task Roll at Disadvantage [[ 1t[[[ {[[2d20kl1}]],-1}>[[@{task_level} [Task Level] * 3 + @{task_mod} [Task Mod] * 3 + @{target_adjustment} - (@{agility_bonus} + @{agility}) ]] ]]] ]]}}{{Roll: $[[6]]}}"></button> I found a workaround of {0, -X}kh1, but seem extensive for a simple boolean comparison.
1660040347

Edited 1660044791
Instead of  {[[1d20}]] try this:  {[[1d20]],-1} You open the [[ but then use } which closes this section... Tom said: [...other stuff...] {[[1d20}]],-1}>[[-X]] [...other stuff...] returns: Expected [0-9] but \"-\" found. As long as my right-side comparison is >= 0 (X in the above example), the HTML macro works. But if X drops below 0, it dumps on the "-" sign. Note this works in the User Macro on the sheet's 3rd tab, but it does not work in the character sheet. Here's the full inline macro if you're interested. Everything works except as described above. <button type="roll" style="height: 18px; text-align: right;" name="roll_attack" value="&{template:default} {{name=Agility Task Roll}}{{Base Difficulty/Target#: [[@{task_level}]]/[[@{task_level}*3]]}}{{Mod Difficulty/Target#:  [[(@{task_level}+@{task_mod})]]/[[@{task_level} * 3 + @{task_mod} * 3 + @{target_adjustment}]]}}{{Agility Total: [[ @{agility_bonus} + @{agility} ]]}}{{Final Target Number: [[ @{task_level} [Task Level] * 3 + @{task_mod} [Task Mod] * 3 + @{target_adjustment} - (@{agility_bonus} + @{agility}) ]]}}{{?{Task Type|Normal,Normal Task Roll [[ 1t[[[ {[[1d20|Advantage,Task Roll with Advantage [[ 1t[[[ {[[2d20kh1|Disadvantage,Task Roll at Disadvantage [[ 1t[[[ {[[2d20kl1}]],-1}>[[@{task_level} [Task Level] * 3 + @{task_mod} [Task Mod] * 3 + @{target_adjustment} - (@{agility_bonus} + @{agility}) ]] ]]] ]]}}{{Roll: $[[6]]}}"></button> I found a workaround of {0, -X}kh1, but seem extensive for a simple boolean comparison.
Yes, that is the solution I found. Your example syntax is more detailed than what indicated on the last line. Thanks!