RMMV How to access Yanfly getSelfVariableValue function from a movement route script?

Status
Not open for further replies.

stramin

Veteran
Veteran
Joined
Nov 4, 2012
Messages
233
Reaction score
98
First Language
spanish
Primarily Uses
N/A
I made this script as a plugin:

JavaScript:
var CropGrowth = function (battles) {
     console.log(battles);
 };

it is simple, when I call it it shows me the argument on the console.

I want to call this function from a movement route script calling, but the argument is a Yanfly Self Variable:

JavaScript:
CropGrowth(this.getSelfVariableValue($gameMap._mapId,this._eventId,202));

And it seems like I can not call this function from here, it doesn't exists:

1617062903998.png

So, How to access Yanfly getSelfVariableValue function from a movement route script?
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
166
Reaction score
192
First Language
Danish
Primarily Uses
RMMV
That is because when calling a script from the movement route then 'this' is the Game_Event not the Game_Interpreter. However, getSelfVariableValue is a method of the Game_Interpreter. So try this instead:
JavaScript:
CropGrowth($gameMap._interpreter.getSelfVariableValue($gameMap._mapId,this._eventId,202));
 

stramin

Veteran
Veteran
Joined
Nov 4, 2012
Messages
233
Reaction score
98
First Language
spanish
Primarily Uses
N/A
IT WORKS!
thank you so much!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,463
Reaction score
14,816
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Draw something
Me: No problemo! ''draws something''
Now draw the same thing from a different angle
Me: So....You have discovered my weakness...
I got a new PC... Nothing wrong with my lil laptop at all! Still works great, and I'll be using it for school. But, the specs for gaming were falling off fast. So I was selfish and bought myself a beast of a PC ^-^
Newstuff.PNG

Held hostage in my own house half the day by an old man that cant take hints or read body language, STILL manage to make some pixels! booyah! I should get a promotion!....No wait...I should get a job o_O
Potions are to be hoarded, not used... >_>

Forum statistics

Threads
112,239
Messages
1,066,768
Members
145,845
Latest member
azistara
Top