Skip to content
Grisgram edited this page Sep 15, 2025 · 1 revision

With this command, you can create instances of struct classes (i.e. call constructor functions).

Syntax

new("TypeName", <constructor_args>)

You see, calling a constructor in scriptor looks more than calling a function named new and not a normal constructor. This is due to the language design of scriptor. It handles a constructor call internally equally to a function call.

You supply the name of the class to instantiate as first argument followed by constructor arguments that shall be forwarded to the constructor.

Examples

  • Change the room through a Transition
var trans = new("FadeTransition", "rmEntrance", 1, 1)
ROOMCONTROLLER.transit(trans)

or shorter as one-liner

ROOMCONTROLLER.transit(new("FadeTransition", "rmEntrance", 1, 1))
  • Use Utilities, like the Coords
var c2 = new("Coord2")
c2.x = 100
c2.y = 100
Clone this wiki locally