Do something when player interacts with an event

Is there something I can hook into to, for events that are interacted with by the player, say action button based events on the map to then say: do x when the player interacts with this event?


For example: You have a button event and when you push it, in the "background" (without a script call) I process the event?


So maybe you have a comment that sais something like: <sample: "hello world">, when the player hits that button, the script triggers and processes the event looking for the comment, if it finds one, it processes it and looks for the script tag, it then does jazz based off that.


Everything but the "tie into the events" I can do. I just don't know how to listen for or tie into "action button" based events. Any ideas?
Why can't you just do it with an action button trigger?  That's exactly what it's designed to do.
I dont think i asked the question properly.


I want to hook into events in the game so that when the player interacts with an event I can process that specific events comments via script.
If you wanted to consider ALL events (regardless of trigger), you could just put something into Game_Interpreter.prototype.command108 which reads comments (and puts them into a variable called this._comments).


If you only wanted events with a certain trigger, I'd look at Game_Event.prototype.start as a possible starting point, though there might be better locations.


Both of those are in rpg_objects.js

Original thread: https://forums.rpgmakerweb.com/threads/do-something-when-player-interacts-with-an-event.61669/