How to translate my event commands to a useable script?

So I have the current set up for a stealing system:

[IMG]https://dl.dropboxusercontent.com/u/22813242/Help/stealingsyst.PNG[/IMG]

How should I go about making this into a script for me? Should I make a class? A module? What's the aproach you guys recommend?
Not a class, not a module.


If the primary trigger is event.player_behind? (assuming you have something in Game_Interpreter that returns $game_map.events[@event_id] when you say event, then I'd probably put it as a method in the Game_Event class, called from the update method. However, I'm sure you don't want this happening to ALL events, so you would have to have some way of turning it on/off for an event, or a way of identifying events for which this should run.


Then you also have the issue of potentially several events running this, but using the same variables - in that case you might need to change them to class variables instead of $game_variables.


And looking at the purpose of the script, how many events are you actually talking about? If it's only one (how many dormitory keys do you need?) then I wouldn't bother converting it to a script at all.
Right now it's just a few like 3 or so in the level I made. I see your points about not being needed to convert at all it just bothers me to have this long piece of event commands every time and also the fact that If I need to change something I need to go over each and everyone of them. Coder freaky stuff I guess. 
put the code into a common event and have them call the common event. The only issue you face then is if they use different variables - but then there are ways around that, too 🙂
True! Stupid I didn't think of that earlier! 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-translate-my-event-commands-to-a-useable-script.18349/