Constructors and class items
A constructor initializes a new object. Constructor definitions have ordered typed signatures and Void results. Use only synchronous work: constructors cannot Wait or start detached async tasks, including indirectly through called methods.
Define initialization
Section titled “Define initialization”- Create an instance class and its fields.
- Place a Method definition, assign its owning class, and mark it as a constructor.
- Declare the typed inputs needed to initialize the object.
- Assign required instance fields in the body.
- Compile.
Constructor overloads use distinct parameter signatures. Choose the intended signature explicitly when constructing. An object without applicable initialization can retain unassigned fields; reads then fail until you assign them.
New Object
Section titled “New Object”Use Set Variable → New Object, select a compatible destination Variable, choose the class and constructor signature, then configure its ordered inputs. Abstract classes, interfaces, and static classes cannot be instantiated.
For example, create a PlayerStats object with initial Number points 0 and store it in Public PlayerStats stats. Subsequent reads and method calls should use stats to reuse that object.
Class-item templates
Section titled “Class-item templates”Objects → Classes lists replenishing instance-class templates, 18 per page. Right-click a class item in your main inventory to configure the selected constructor’s arguments. Without a constructor, its editor offers instance fields; empty fallback fields remain unassigned.
Every evaluation of a configured class item constructs a fresh object. Reusing the same item in two arguments does not create a shared instance. Evaluate it once into a Variable when identity or shared state matters.
Changing the selected constructor requires reconfiguring the class item. Class/member/input identities survive renames, but a renamed-looking signature does not make an old configuration automatically compatible with new types.
Parent initialization
Section titled “Parent initialization”A child constructor must invoke a compatible parent constructor first, or use an available implicit zero-argument parent constructor. If that implicit form is unavailable, add the explicit parent call. Parent initialization completes before child fallback field initialization. See inheritance.