Dialogue after purchasing/exit the store

I need to make the merchant say different phrases after making a purchase and leaving the store (if the player does not buy anything). Can I implement this somehow? (I apologize for any errors in the text, I am writing through a translator)
@caethyril's AutoSwitchVars lets you toggle a switch or increment a variable when the player purchases at a shop.

its very simple to make shop keeper say once buy or sell or dont buy without using plugin
all you need is 2 varible hold gold value
then shop processing
then condition to check gold value
i have made video for you can watch it

Counting gold before/after is the simplest approach, but it only tracks shop profit, not player buy/sell actions. That might be OK for your event. Also, you only need one variable to track a change in player gold: store total gold in variable, show shop, subtract current gold from variable, check variable value.

There's some discussion in this old thread, too:
its very simple to make shop keeper say once buy or sell or dont buy without using plugin
all you need is 2 varible hold gold value
then shop processing
then condition to check gold value
That's not assured to be correct.

It's perfectly possible for the player to sell some items and then buy others and end up at the same gold value, despite having performed transactions.

The only way your method is guaranteed to work is if you make the shop Purchase Only, which doesn't fully answer the OP's question. (there's also no reason to set both variables before the shop. You'd only need to set one, and then as caethyril mentioned you'd only need to use one overall)
That's not assured to be correct.

It's perfectly possible for the player to sell some items and then buy others and end up at the same gold value, despite having performed transactions.

The only way your method is guaranteed to work is if you make the shop Purchase Only, which doesn't fully answer the OP's question. (there's also no reason to set both variables before the shop. You'd only need to set one, and then as caethyril mentioned you'd only need to use one overall)
the thing you are saying only possible if the player buy value of 1000 gold item
and then sell 1000 gold of item and then both variable value become same in same transaction.

but i think it will be very slim chance of that happening unless intentionally do it 🙂

if he is making only purchase or sell shop this will work very good for him

and even he dont make it single shop
its still most of the ppl dont buy and sell same gold transaction it will be like idk wht to say if they keep doing it 😛
the thing you are saying only possible if the player buy value of 1000 gold item
and then sell 1000 gold of item and then both variable value become same in same transaction.
Yes? That's exactly what I said?

but i think it will be very slim chance of that happening unless intentionally do it 🙂
I think it's not a great idea to program something into your game that you know has a chance of not working. Especially when you have been given an easy way to make it always work.
I don't know if this can do anything that caethyril's plugin can't, but I did write a plugin for this exact purpose once.

*edit* link fixed
@Arthran Her plugin can't change my sheets. So you have an opportunity here to make a quick addition to your code and pull ahead.

Original thread: https://forums.rpgmakerweb.com/threads/dialogue-after-purchasing-exit-the-store.163817/