The macro works fine as is - it simply asks what the save value is, and then allows you to pick the save you wish to roll. It support token multiselect so I can select many of my monsters and voila, at a glance I can see who failed by the state change (which later goes away when I apply the damage on those tokens via a different macro).
Where this doesn't work is when I need to roll on advantage or disadvantage. For those who are not familiar with those rules, rolling at advantage allows me to roll twice and take the highest value, and disadvantage I roll twice and take the lowest value.
Sometimes my monsters have to roll at advantage or disadvantage, and there lies my issue: my current macro doesn't suffice.
So could someone help me write it so that it allows me to specify if the roll has advantage/disadvantage, and execute the code accordingly?
This is way beyond my coding ability, I must admit
Code: Select all
/self
[h: abort(input("DC |0| What is the DC? | TEXT"))]
[h:saveList = "STR Save, DEX Save, CON Save, INT Save, WIS Save, CHR Save"]
[h:status=input(
"listType|"+saveList+"|What save to do you want to roll?|RADIO|SELECT=0 VALUE=STRING" )]
[h:abort(status)]
[h: tokenList = getSelected()]
[foreach(tokenID, tokenList, ""), CODE: {
[h: switchToken(tokenID)]
[h,switch(listType),CODE:
case "STR Save":
{
[h:d20roll = 1d20]
[h:saveValue = StrSave]
};
case "DEX Save":
{
[h:d20roll = 1d20]
[h:saveValue = DexSave]
};
case "CON Save":
{
[h:d20roll = 1d20]
[h:saveValue = ConSave]
};
case "INT Save":
{
[h:d20roll = 1d20]
[h:saveValue = IntSave]
};
case "WIS Save":
{
[h:d20roll = 1d20]
[h:saveValue = WisSave]
};
case "CHR Save":
{
[h:d20roll = 1d20]
[h:saveValue = ChrSave]
};]
[H, if(d20roll+saveValue < DC): state.DCFail = 1]
[r:token.name] makes a [r:listType] and gets a [t:d20roll+saveValue].<BR>
}]