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,509
Reaction score
14,848
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 Posts

Latest Profile Posts

Quite the versatile cast so far :p

chars.PNG

Edit: Sprites are made by Alexdraws and TheMightyPalm. I just edited them.
Degica Games Turn Komodo | RPG Maker News #77

Well, rats. Was really looking forward to trying out FPS Creator, but trying to install and set it up was pretty much impossible for my tiny brain to comprehend. So much for that, then.
Ah, home once more! I think I can safely work on my games now.
Let's hope power remains on for the day

Forum statistics

Threads
112,414
Messages
1,068,140
Members
146,069
Latest member
Skepter
Top