Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Is there a simple corescript patch that would remove or massively raise the 12 line limit on Script entry in MV (MZ supposedly has none)? Elsewhere somebody generated a tool with "claude" to do this allowing external edits, but I was hoping to avoid that.

Although when I mentioned asking you, they said it was an editor limitation, so maybe there's nothing a plugin could do about this.

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.

(+1)

No need to pursue this, I don't actually have a need for this functionality right now AFAIK. Any code that got close to the limits can be minified to frustrate everyone, or should be in its own plugin file probably.

I’ll hold off on it unless someone else asks, then.

I think larger Scripts in Events would be fine if combined with a function cache, but getting that just right in a way that breaks nothing (some plugins edit Command lists at runtime and eval can read surrounding variables so I’d have to detect that) is definitely too complicated for a sketch plugin.