Hello.
I have a macro called canReactMacro which returns 1 is the selected token can use a reaction, if it can't it prints the reason and returns 0.
This macro seems to works fine.
I've defined a user defined function (this might be an obsolete phrase now) called canReact to call it in the OnCampaignLoad of a lib token.
Here's the definition:
[h: macro.define("canReact", "canReactMacro@Lib:MacroHelper", 0)]
Now, in a token macro, if I do this:
[macro("canReactMacro@Lib:MacroHelper"): 1]
[if(macro.return==1),Code:
{
[h:state.ReactionUsed=1]
Defensive Duelist FEAT: [r:token.name] uses a reaction vs a melee attack getting a +<b>[Proficiency]</b> bonus to AC for that attack.
}]
It works correctly, but if I do this:
[if(canReact()),Code:
{
[h:state.ReactionUsed=1]
Defensive Duelist FEAT: [r:token.name] uses a reaction vs a melee attack getting a +<b>[Proficiency]</b> bonus to AC for that attack.
}]
I get
Invalid condition in IF(canReact()) roll option.
If I use
It suppresses the output from the canReactMacro (which writes on chat the reason why you can't use your reaction).
My goal is to be able to use "canReatc()" (possibly without "==1") in the if condition and not having the output suppressed.
Note: these macros were not in the framework I've posted recently, I thought it was something generic and didn't
upload something to test, but I'll gladly do it if needed.
What am I doing wrong? Is there a better way to handle it?
EDIT: I guess it can't be done because I'm calling the macro inside the "if".
Well, I'll use the first solution if there isn't a more elegant solution.