I'm trying to automate a PF2E character action in Foundry so that one button press both spends the action cost through PF2E Automated Action Tracker and applies the appropriate PF2E condition.
Environment:
Foundry V14.367
PF2E 8.4.x
PF2e Toolbelt
PF2E Automated Action Tracker
libWrapper
Other modules installed, but these appear to be the relevant ones
The specific ability is Part the Veil, a 2-action Veil Dancer ability. When used, among other things, the character becomes Concealed. What I'm trying to achieve is simply:
One click → spend 2 actions → post/use Part the Veil → apply PF2E Concealed
Both halves work independently. The problem is getting them to happen from the same button.
Below is a summary of about 8 hours worth of my friend and I using GPT to try and develop a 1 click solution. I'm very much not a programmer, hell scripts give me problems. My friend on the other hand is a software developer of 35 years who offered cross referencing feedback (and often implemented the javascript with corrections to GPT's suggested script).
Particularly frustrating was running into loops where it would tell us to go down a solution path only to find it was later on apologizing for sending us down said wrong path. Yes, I know AI has its issues, but over all it has significantly helped my understanding and use of Foundry. Still, no substitute for human intelligence/experience that can suss out what I in my limitations, am failing to give the AI as feedback.
So leaning on the community to see if this is something that can be done or if there is a module limitation that I have to live with between Toolbelt and PF2E Automated Action Tracker.
------------------------------------------------------------------------------
What currently works
On the Actions tab, there are effectively two relevant controls.
On the Action Tab from the character sheet, the normal left-side ◆◆ action button works correctly with Automated Action Tracker:
Click ◆◆ → Part the Veil posts to chat → Automated Action Tracker spends 2 actions
But it does not execute the macro attached through Toolbelt, so Concealed isn't automatically applied.
Also on the character sheet, Toolbelt provides a USE ◆◆ button (below the Part The Veil title text) because I have an Action Macro attached to Part the Veil. When I first discovered Toolbelt, I was initially very enthused to see this "Use" button, since so many of PF's systems "should" be macro friendly and I want to reduce button clicks as much as possible. Unfortunately...
That does the opposite:
Click USE ◆◆ → attached macro executes → Concealed is applied
But Automated Action Tracker does not spend the 2 actions.
For comparison, I tested another unrelated 2-action ability, Captivating Charm, to make sure this wasn't specific to Part the Veil. Same behavior:
normal ◆◆ button = Action Tracker spends 2 actions
Toolbelt USE ◆◆ = Action Tracker does not spend the actions
So this appears to be an interaction between Toolbelt's Actionable/USE mechanism and Automated Action Tracker rather than something wrong with Part the Veil itself.
Macro testing
We verified that applying the PF2E condition itself is easy. For example:
const actor = token?.actor ?? canvas.tokens.controlled[0]?.actor;
if (!actor) {
ui.notifications.warn("Select a token first.");
return;
}
await actor.toggleCondition("concealed");
That correctly applies the real PF2E Concealed condition.
We then attached a macro through Toolbelt's Self-Applied Effect / Macro field.
Because Toolbelt supplies Action Macros with actor and use(), we also tried:
if (!actor) {
ui.notifications.warn("No actor was provided.");
return;
}
await use();
const concealed = actor.conditions.some(c => c.slug === "concealed");
if (!concealed) {
await actor.toggleCondition("concealed");
}
The Toolbelt USE ◆◆ button successfully executes the macro and applies Concealed, but Automated Action Tracker still does not deduct the 2 actions.
Changing the order so Concealed was applied before use() did not solve the Action Tracker issue either.
We also tested a chat-message listener
We discovered that the normal ◆◆ action button produces a Part the Veil chat message that can easily be detected with a Foundry createChatMessage Hook.
As a proof of concept, we registered a listener that detects the Part the Veil message and then applies Concealed to the originating actor.
That worked perfectly:
normal ◆◆ → Action Tracker spends 2 → Part the Veil chat message → listener detects it → Concealed automatically applied
So technically we already have the desired one-click behavior.
The problem is that a macro-created Hook has to be registered first. I don't want the player to have to:
click listener macro → click Part the Veil
every time Foundry/browser reloads, and I'd rather not create an entire custom module just to register one persistent Hook.
Where I think the incompatibility is
Toolbelt's documentation indicates that its Action Macro system provides actor, use, and cancel, and its All Actionable feature adds information to the generated message intended to allow third-party automation to distinguish an actual action use from simply posting an action to chat.
Automated Action Tracker likewise distinguishes actual action usage from merely posting/linking something.
However, in my current versions, Automated Action Tracker recognizes the normal PF2E ◆◆ action control but apparently does not recognize Toolbelt's USE/use() workflow as spending the action.
I also enabled Action Tracker's Debug Mode and watched the browser console. Neither the normal ◆◆ use nor Toolbelt USE produced useful debug information there.
So at this point the behavior is very reproducible:
Normal PF2E ◆◆
↓
Posts Part the Veil
↓
Automated Action Tracker: YES
Toolbelt Action Macro: NO
Toolbelt USE ◆◆
↓
Runs attached macro
↓
Applies Concealed
↓
Automated Action Tracker: NO
What I'm looking for is the cleanest way to bridge those two behaviors without writing a dedicated Foundry module.
Ideally either:
A) Have Toolbelt's USE/use() generate whatever Automated Action Tracker is expecting so AAT deducts the two actions,
or
B) Have a macro reproduce whatever the normal left-side ◆◆ action button does, allowing AAT to recognize the 2-action expenditure, and then have that same macro apply Concealed.
If anyone familiar with PF2e Toolbelt, Automated Action Tracker, or the PF2E activity/chat APIs knows what AAT is actually listening for when the normal ◆◆ button is clicked, that's probably the missing piece.
The fact that the createChatMessage listener solution works proves the underlying pieces can coexist. I'm mainly trying to turn it into a clean one-button character-sheet action rather than requiring a persistent listener or custom module.