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 .
×

Comparisons do not work using pure numbers [Macros]

1477340830

Edited 1477340952
Howdy! In a game I am running battles and damage are non random and handled by the computer, enemy attacks are handled by picking a macro then target. The math behind this is the attack minus player defense. To avoid stating negative numbers where defense was greater than attack I used a >0. Sadly it doesn't work in the macro like so: /emas "@{selected|token_name}" attacks @{target|foe|token_name} dealing [[(@{selected|bar2} - @{target|foe|bar3})>0]]! (( Resolves as "Enemy attacks Player dealing own Damage stat minus player defense stat )) Example: /emas "Spider" attacks Tank dealing [[(2 - 3)>0]]! This returns -1 instead of 0. However, if I add d1, a useless dice roll that always returns 1, it does function. /emas "@{selected|token_name}" attacks @{target|foe|token_name} dealing [[(@{selected|bar2} - @{target|foe|bar3})d1>0]]! Example: /emas "Spider" attacks Tank dealing [[(2 - 3)d1>0]]! Returns 0. This adds delay sometimes to the numbers spit out, as if it is actually trying to roll. Any solutions that would fix this?
John G. said: To avoid stating negative numbers where defense was greater than attack I used a >0. [[(@{selected|bar2} - @{target|foe|bar3})>0]] Hi, John G. I suggest using a Keep / Drop function for this, e.g. [[ {@{selected|bar2} - @{target|foe|bar3}, 0}kh1 ]]
1477341816

Edited 1477341849
The Aaron
Pro
API Scripter
Try this: /emas "@{selected|token_name}" attacks @{target|foe|token_name} dealing [[(@{selected|bar2} - @{target|foe|bar3})d1>0]]! Edit: Oh, Silvyre's is better. =D
Aaron's idea works great in Roll Queries, though!
1477344318

Edited 1477344365
Silvyre said: John G. said: To avoid stating negative numbers where defense was greater than attack I used a >0. [[(@{selected|bar2} - @{target|foe|bar3})>0]] Hi, John G. I suggest using a Keep / Drop function for this, e.g. [[ {@{selected|bar2} - @{target|foe|bar3}, 0}kh1 ]] Thank you for a more elegant solution, keep is far better to look at than the solution provided in the original post.  I am a little confused about The Aaron post, as his solution to try was originally stated in the first post identically, but oh well!
1477344821
The Aaron
Pro
API Scripter
Not quite identical. I added d1 before the >0
The Aaron said: Not quite identical. I added d1 before the >0 My Apologizes The Aaron (It is strange saying the as a name).  I will pay more attention next time I need help, really appreciate it.
1477345579
The Aaron
Pro
API Scripter
Hahahaha! No worries!  =D. It's a bit obscure and I was a bit terse in the message.