One of the toughest things I've run into with macros is debugging them - you can use abort(0) to break them, but it's tough to see the "variable trace" or whatever you might call it - what variables are at certain times. It occurred to me that user defined functions and the dialog() function could offer a solution. So, I submit a simple debugging dialog/function thing:
First, create the macro onCampaignLoad on a library token, or add the following to your existing onCampaignLoad macro:
Code: Select all
[defineFunction("debug", "debugDialog@Lib:Token")]
Code: Select all
[dialog("debugger"):
{
[h:numArgs = argCount()]
[count(numArgs, "<br>"): arg(roll.count)]
}]
Code: Select all
[h:multiplier=json.get(DamMultiplier,attackType)]
[h:resistAll=json.get(Resist,"all")]
Code: Select all
[debug(multiplier, resistAll)]
If you want to drop the debugger into a campaign, just download:
Debugger library token
If you do use it, one trick I use is to feed it arguments like this:
debug("multiplier", multiplier, "resistAll", resistAll)
So that when it produces the dialog, the name of the variable is shown above the actual value of that variable. The output looks like:
multiplier
1
resistAll
5