Custom Method

Basically my problem is I want to make a method that does something I can do normally without script calls. But it's extensive work to repeat it every single time I want to accomplish the same essential goal with a different event. The method would be creating a pop-up window once the player gets within a certain range, counting up to the number I input and then closing the window and turning on a self switch once it gets to that number. I can't seem to figure out where to put this method to allow me to call it in a script. I'm not sure what other info is needed to figure it out, so if you need more info, or if I'm just doing it completely wrong, say something. Thanks in advance!
If you can do it in a script call of an event, just put it into a common event, then call the common event from your event.  If it's the same for all of them, that'll work, right down to the self switches.
It wouldn't be the same for all of them. Window size would differ, time up would differ, the message would differ. The switch also differs sometimes. It would be extremely convenient if I could figure out how to get my method to work.
To be able to be executed, the method needs to be known to the game inteerpreter, not to the engine itself. That are different modules/classes.


You might look at other scripts for this - they often make referencing functions for the game interpreter that call the correct function in the engine itself (because the game interpreter itself also has limitations and some functions only work outside the interpreter).
I didn't really understand most of what you said ><. Is that a sign I should get someone who knows what they are doing to make it for me? >.>
With modern programming, a function or method can be limited as to here it can be used - which means it is important where you place it in the program's structure.


Writing a function without declaring it to a class usually means that it can be used nowhere - that is what is happening to your method. You need to tell the engine the context where it is allowed to use and call that method from before it can be used.

Original thread: https://forums.rpgmakerweb.com/threads/custom-method.55930/