
Hi! I've exhausted my understanding of roll20's macros to make a macro for my players that performs attack rolls with player inputs. I am going to run a game of LANCER: Mech RPG which has a system where d6s are added to an attack roll based on a conditional value called Accuracy/Difficulty. It works like so:
1d20 + (x)d6kh1
If Player inputs positive integer X -> you roll Xd6, keep the highest roll, and add it to the operation
If Player inputs negative integer X -> you roll Xd6, keep the highest roll, and subtract it from the operation
If Player inputs zero/default -> simple d20 roll
My macro works; when a player inputs a negative integer (Difficulty), it subtracts the appropriate d6 roll, and adds it for a positive integer (Accuracy). However, 0 does not work, because I think it is dividing by zero. Here's what I've got.
/gmroll 1d20 + [[[[(?{Accuracy|0}/abs(?{Accuracy}))*abs(?{Accuracy})]]d6kh1]]+@{Targeting}
I found this page of useful macros that included a discussion of how to do conditional checks but for the life of me I don't understand how to integrate it. To do an (if X equals A output T, else output F) appears to work like
[[({0,floor(1-abs(x-A))}dl1)*(T-F) +F]]
But I don't understand how this works or how to integrate my current macro into this so that it doesn't perform the division operation if the ?{Accuracy} query returns 0.
I looked around the forums but didn't see this particular issue resolved. I understand the Accuracy/Difficulty system was taken from the RPG Shadow of the Demon Lord, so perhaps the issue is already resolved for that RPG although I haven't found anything related to that on roll20.
Thank you in advance for your help! Sorry if this has already been answered and I didn't search hard enough!
*Edited to clarify the intended output