Roll20: Pseudo IF Statement

Roll20 has one problem with the Macro system a LOT of people want fixed. but it just never seems to happen. So I literally had to do something…

The reason, is I am playing in Roll20 a Werewolf Archer / Assassin. I had two feats to include, both are -5 to attack, but also different effects. So I had to come up with a way to do it, that worked, and this is what I came up with. I worked it out, roughly, but it looked like, with the combinations available to me, I would need 75+ macros, to do what this one by itself does. It makes attack rolls take slightly longer, but it’s worth it.

This works on the BINARY process, of on and off, but instead of a 1 and a 0 to represent them, I changed it for some of the examples, by using math to modify the outcome, to determine the result. I know, sounds idiotic, but it works. Here is the start of the input process, and every question is a Yes / No response.

This is the header, and sets the design of the macro, but it used the 5eDefault sheet’s connection to the sheet, to pull the information from the field specified. “rangedweaponname1” to be precise, which is the character’s Longbow +2.

This is where it gets a bit harder to read for some people. Let’s look at the Sharp Shooter. You are maybe also wondering why I use the emote to do this, partly laziness, but also because it generates a nice looking code at the top that has NO impact on the game at all.

So, Sharp Shooter. -5 to Attack, to get 10 extra damage on a hit. SO, the Sharp Shooter section in the the Emote field says this:

Sharp Shooter

?{SharpShooter|Yes,5|No,0}

So this is like all the other fields, in that it is a two answer possibility, All of them are the same. It works by using the result (a 5 or a 0) in a maths equation later in the macro:

modify by the character’s global attack modifier, if any (+ [[@{Ashildr Susk|global_ranged_attack_bonus}]])

then we remove the result, from the SharpShooter field.

If the value is 5, it takes 5 from the attack roll.

If the value is 0, then nothing is subtracted.

then it continues on, till all the modifiers have been accounted for.

The rest of the modifiers are basically the same, they have an on off value setup, where the ON value is not always 1.

Damage is done the EXACT same way, the difference is that for something like SharpShooter, where the damage is 10pts, and the on value is 5, means you have to multiply the result by 2 in order to get the extra damage. So in the damage area, you will find this:

modify the damage by all the modifiers, SharpShooter first. ([[?{SharpShooter}]]*2]])

those with an on value will be added together, to determine the final outcome.

it also includes ability score modifiers etc

Critical damage is the second re-roll, and the values are ADDED together to effect a final total, but they are listed separately. I also have fire and poison damages listed separate, in case of vulnerabilities to each, or resistances.

Here is the final output once you go through all the options:

Hopefully if you have done it right, it will all work for you flawlessly. If not, let me know below and I will try and answer any questions I can, when I can.

About The Author

I am a late 40s gamer, with a 10yo son, and still married for nearly 20 years to my beautiful wife. We share a house with two cats just north of Brisbane. I have been gaming since I was 12, mostly D&D, and have been a GM for just over 25 years. I have won awards at conventions for role-playing, characterization and GMing.