Skip to content
Documentation

Parameters and Object Contracts

Parameters define what reusable Logic needs from its caller or attachment. They make the dependency visible and let the editor check compatibility before execution.

A fixed number in an Action describes one choice. A Parameter gives that choice a name and lets each attachment supply its own value. Changing an attachment’s binding configures that use of the Logic without changing the shared Action implementation.

Declare and Bind a Parameter

In a Logic Component’s declaration panel, choose Parameters > Add Parameter and select the required type. Name the Parameter according to its role, then select it in the compatible Action field. Configure the receiving Object’s Logic attachment to supply the value.

The declaration and binding have different responsibilities:

Location Responsibility
Logic resource Declare the input’s name and type, and use it in the shared implementation
Object’s Logic attachment Supply compatible values or references for that use of the Logic
Action field Consume the declared input where its type is accepted

For example, a movement Logic can declare a Number Parameter named speed. Its Create Event can use Set Velocity, targeting SELF, with X Velocity bound to speed and Y Velocity set to 0. Two separate Object definitions can attach that Logic and bind speed to 3 and 6 respectively. Both use the same Action list, but the second requests twice the rightward velocity.

At the current world scale, those values are metres per second. A binding of 0 requests no horizontal motion; a negative binding requests leftward motion. The operation interprets the Number; the Parameter type alone does not assign a unit. See World Units and Image Scale.

If Run reports an unbound Parameter, inspect every enabled attachment that uses the Logic. If changing a binding has no effect, confirm that the Action reads the Parameter instead of an old literal. If multiple Objects change together, inspect their definitions and attachment ownership before assuming that each placement has a distinct binding.

Object Parameters

SELF belongs to a Logic Component and identifies its attachment’s owner. TARGET is a user-named reference supplied by an attachment or Function call. TARGET can later be rebound with Set Target Object to a compatible live instance.

Choose an Object compatibility mode:

Mode Requirement
Nominal One exact Object definition, identified by its stable resource identity
Structural The required named component slots and their component types

A structural requirement of hurtbox: Collider needs that slot name and type. Additional components are allowed. A differently named Collider does not satisfy the same contract.

Access data through the Object reference and slot name, such as self.health.current. A component slot is part of the Object contract, not a separate independently assignable Object reference.

Value and Thing Parameters

Declare a Value type for numbers, text, booleans, vectors, or colors. Declare the appropriate Thing type when Logic needs a resource such as a Sound or Sprite. See Values and Things.

A binding can provide a suitable literal, expression, receiving Object’s Data Structure field, or Project Global. Use the field picker to see compatible inputs.

A Local Variable in another Logic attachment is private and cannot serve as a shared Object field. If a binding reports that a variable belongs to another Logic’s private scope, move the shared value into an Object Data Structure and select that field. See variables and shared state.

Organize Attachment Inputs

A Logic Component Parameter can have a Parameter Section name. Parameters sharing that section appear together in the Object Editor’s attachment bindings. Sections organize the UI; they do not change the types or runtime meaning of the Parameters.

Give Local Variables and Parameters distinct names. They share a case-insensitive name set inside a scope. Reserved names include self, other, owner, repeatIndex, and repeatCount.

Required missing bindings block Run and export. Optionality should be part of the contract, with a meaningful default or explicitly supported unassigned behavior.

Function Parameters

Use a Function Parameter when each attachment needs to choose the operation it calls. Declare the expected input and Output signature, then choose a matching Function at the attachment or supported placement. Invoke Function Parameter calls the selected implementation with the supplied arguments.

A direct Custom Action calls a specific Function. A Function Parameter lets the receiving attachment choose the implementation. See Functions for call contracts, typed results, and callback behavior.

Myth Engine Documentation