Counting Successes

First, a code dump to be dissected.

INPUT Block
[h: cancel = input(
"dietotal | 1 | How Many Die to Roll?",
"pip | 0 | Plus to roll?"
)]
[h: abort(cancel)]

Setting up Math and Vairables
[h: explode = 1d6e]
[h: NewTotal = dietotal-1]
[h: roll=eval(NewTotal+"d6")]

IF code
[if (dietotal == 1), CODE:{
[t, if (explode == 1): "You DONE GOOFED!
"]
Your Total Result was [t:explode+pip]
};

ELSE code
{
[t, if (explode == 1): "You DONE GOOFED!
"]

Roll Results
Your Total Result was [t:explode+roll+pip]
}]

This segment of code opens a popup window that you will input all necessary variables into for this macro.

  • [h: status= input( This brings open the input window
  • "totaldice | 1 | How Many Die to Roll?" Here, “totaldice” is an empty variable “|1|” is it’s default value and “How Many Die to Roll?” is the display text.
  • Next "Rollplus | 0 | Plus to roll?" is more for another data variable.
  • Note the lack of the “,” at the end of that last line. This tells maptool that it  should not expect more variables to be presented.
  • )] This closes out the INPUT dialog box. [h: explode = 1d6e]
  • [h: abort(status)], if the user cancells the macro, this line of code prevents a hideous code dump in the chat window. It is also the last bit of code in the INPUT code block

Leave a Reply

Your email address will not be published. Required fields are marked *