no 🙁 I was hoping there'd be a way to just call myFunction without needing this and without declaring it as a global function.
I may just not include the ability to do script calls in that case.
Thanks.
You can update the game interpreter to evaluate locally
Game_Interpreter.prototype.command355 = function() { var script = this.currentCommand().parameters[0] + '\n'; while (this.nextEventCode() === 655) { this._index++; script += this.currentCommand().parameters[0] + '\n'; } eval(this, script); return true;};Then you don't need to use `this`However, this requires everyone to do it.
yeah, I'm not into making other people change their scripts.
I'll just leave it out. Was going to try making a plugin that would run either through plugin commands or script commands.
Nope, using this to evaluate as the context won't work,
you have to wrap it inside an anonymous function:
(function () {function myFunction() {}Game_Interpreter.prototype.command355 = function() {var script = this.currentCommand().parameters[0] + '\n';while (this.nextEventCode() === 655) {this._index++;script += this.currentCommand().parameters[0] + '\n';}eval(script);return true;}})();But it won't work if two people do that...
Thanks for the post, Shaz. I actually have a problem and was wondering why I was doing lots of commands in the interpreter and it doesn't work. It says all my functions are not declared, yet they were in Game_Interpreter.