Game_Interpreter.prototype.my_custom_func = function(formula) { return eval(formula);};Simple method. Intended use is to simply evaluate a formula.In Ruby, I would just say make a script call
my_custom_func("$game_party.members.length > 2")And it will return whatever the formula should return.However, in JS, eval's do not have context.
When the script call command goes and calls eval, it's done in global space.
I would need to do something like this if I don't modify the way script calls are handled.
Is there another way to call custom methods for script calls without forcing users to write "this"?
my_custom_func("$game_party.members.length > 2")And it will return whatever the formula should return.However, in JS, eval's do not have context.
When the script call command goes and calls eval, it's done in global space.
I would need to do something like this if I don't modify the way script calls are handled.
Code:
this.my_custom_func( ... )