Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

It’s an editor limitation, yes. However, “Script” first composes the lines and then uses eval from scratch each time internally, so I don’t recommend using that with large functions in the first place (at least not when it runs frequently).

The easiest option is to make a small plugin like so:

function myScript() {
  // You can name this anything in place of `myScript`.
  // Ideally, use at least somewhat descriptive names.

  // Also, just add multiple functions if you need more.

  // Your Script goes here.
}

And then call it inside the “Script” Command like this: myScript.call(this)

.call(this) instead of passing the interpreter as argument means you can use this inside myScript as you would in the “Script” Command.

(1 edit)

I could make a tiny plugin that combines any adjacent “Script” Commands into one, though, thinking about it!

The performance issue would still apply, but it should work without problem, since concatenating JavaScript like this with a newline should (hopefully) not change its meaning. I can give it a go later this week.

Edit: It can change the behaviour in cases where this is manipulated to skip the next “Script” or this._index matters during script execution, though. Hm.