Custom Method

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
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!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
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).
 

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
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? >.>
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top