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

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?
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));
IT WORKS!
thank you so much!
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/how-to-access-yanfly-getselfvariablevalue-function-from-a-movement-route-script.134901/