Gold Spent Conditional Branch?

I was curious if this was possible, and if so... how to go about doing it.

I have a crafting system where it costs certain items/ingredients and gold to make craftable goods. I'm using a plugin for the crafting system, but don't need plugin help. Basically, I do the plugin command to pull the crafting screen, and after you craft something, the event continues with an animation on a crafting table. This works great. The only issue I'm running into...

When you go into the crafting screen... if the player decides to not craft an item... and leaves... the crafting animation still happens. I need a conditional branch here, but I can't think of how to do this. The idea I had was to check if any amount of gold was used (since every item requires, at least, 1 gold)... and if 1 or more gold was used (crafting table animation happens). If 0 gold was used... the else branch just cancels the event and nothing happens.

However; I can't figure out if there's a way to have the game check how much gold the player has, and if any was spent, within that event. Is there a script call for this, possibly? I even attempted variables to see if I could have it check how much gold a player has... and then another to see if it can check if any was spent... but I couldn't figure that out. Figured I'd see if anyone in here knew, possibly, how this could be done?

Thanks in advance 😎
Have you tried using "erase event" or "exit event processing"?
Have you tried using "erase event" or "exit event processing"?
Yes, but the issue is I need a conditional branch that way it can determine if the workbench animation needs to play or not. Basically, if the player goes into the crafting menu and crafts 1 or more items, I want the workbench animation to play and item(s) received. If the player goes into the crafting screen and then doesn't craft an item... I need the workbench to not play the animation. Right now... it plays the animation no matter what. So, if you don't craft an item... the animation still plays and it says "Item(s) received." Which is weird because the player didn't actually craft anything.
I don't think there's a default script call to get total gold spent

$gameParty.gold() will return total party gold.

So when the crafting starts, variable X = $gameParty.gold(), when crafting ends variable Y = $gameParty.gold(). If X - Y === 0 then no animation.

Edit: actually you don't even need to worry about scripts. You can set variables equal to total party gold when opening/closing the crafting table and check if they equal each other using just the event commands.
Hello.
If it's just checking events, just memorize the gold before a stock and subtract the variable you memorized from the current value of the gold after the action.

Code:
◆Control Variables:#0020 Gold-Used = Gold
◆Comment:Crafting
◆Control Variables:#0020 Gold-Used -= Gold

Good luck
Thank you both SO MUCH for your help. I can't thank this community enough for how helpful these forums are. I actually tried Syberduh's first suggestion, and it worked (I'm sure all of your suggestions would have worked, though). Just two different variables: one before the crafting started and then after... and then my conditional branch that compared the two. I was not aware of the $gameParty.gold() script call. I've tested it several times... and it works exactly as I wanted.

This issue has been resolved. Thanks again! 😂

Original thread: https://forums.rpgmakerweb.com/threads/gold-spent-conditional-branch.139907/