Skip to content
AEOWUN
Docs Menu

Global functions

Look up global functions calls and properties.

debug.log(...)

Print values to Output.

Arguments

Any values, in the order you want to print them.

Returns

nil.

Works with

Values from your script.

Missing values and errors

No lookup is performed. Printing a handle does not check whether its object still exists.

debug.log("Score:", 25)

find(name)

Find named Cells, Actors, and live Entities.

Arguments

name: string. Matches object identity names.

Returns

A basket of handles. No match returns an empty basket.

Works with

Active World Cells, authored Actors, and runtime Entities.

Missing values and errors

Names can be shared. A result may contain different handle kinds. Check the basket before indexing. If an Actor matches, its backing Entity is not returned again. Wrong argument counts or types report an error.

Also available as: find() — legacy.

This compatibility lookup still finds Cells. proj.find() only finds Actors. It is not a replacement for Cell lookup.

const matches = find("DoorCell")
if basket.len(matches) > 0 {
    matches[0].visible = false
}

get_entity(name)

Find a live Entity by name.

Arguments

name: string naming a runtime Entity.

Returns

An Entity handle, or nil if none matches.

Works with

Live Entities.

Missing values and errors

Does not search authored Cells. Runtime names can be shared; use an ID when you need a specific Entity. Wrong argument counts or types report an error.

const enemy = get_entity("Goblin")
if enemy != nil {
    debug.log(enemy.health)
}

getAllCellsOfClass(class_name)

Find active Cells of a class.

Arguments

class_name: string, such as "Block" or "Light".

Returns

A basket of Cell handles. No matches returns an empty basket.

Works with

Active and effective World Cells.

Missing values and errors

Does not search Actor packages. Wrong argument counts or types report an error.

const blocks = getAllCellsOfClass("Block")
debug.log(basket.len(blocks))

spawn(name, position [, package])

Create a live Entity at a position.

Arguments

name: string. position: [x, y, z] numbers. Optional package: Character package name.

Returns

The new Entity handle.

Works with

Runtime Entities and Character packages.

Missing values and errors

Without a package, the default Character package is used. Invalid positions and unavailable packages report an error.

const enemy = spawn("Goblin", [10, 1, 5])
debug.log(enemy.id)

wait(seconds)

Pause this script, then continue.

Arguments

seconds: finite positive number of seconds.

Returns

Execution resumes after the pause; no useful return value.

Works with

Top-level scripts, functions, events, and Modules.

Missing values and errors

Zero, negative, or non-finite durations report an error. Disabling the script cancels the paused work.

Waiting in Actor Modules

Actor-attached Modules resume with their Actor parent intact.

debug.log("Starting")
wait(1.0)
debug.log("One second later")

time.delta

Read the current frame duration.

Arguments

No arguments. Read this property.

Returns

A number of seconds.

Works with

The current script host frame.

Missing values and errors

This is a frame duration, not elapsed game time.

debug.log("Frame seconds:", time.delta)

attach(child, child_point, parent, parent_point [, offset])

Attach an object to a named rig point.

Arguments

An Actor/Entity child and point name, parent Actor/Entity and joint name, and optional three-number offset.

Returns

true on success.

Works with

Actors and Entities with suitable Character packages and attachment points.

Missing values and errors

Invalid handles, missing points, unsupported kinds, and attachment cycles report an error. Attached objects follow the parent; ordinary movement and physics are suspended.

Set the child rotation before attach() to establish its local grip angle. The engine applies it with the animated parent joint; no sixth rotation argument exists.

Runtime spatial Cells [BETA]

Newer runtime-created Light, Audio, and Particle Emitter Cells can follow a joint using a distinct position-only attachment path.

const sword = proj.find("Sword")
const hero = proj.find("Hero")
if sword != nil && hero != nil {
    attach(sword, "Grip", hero, "RightHand")
}

detach(child)

Remove an attachment and restore normal movement.

Arguments

child: Actor or Entity handle.

Returns

true if removed; false if not attached.

Works with

Attached Actors and Entities.

Missing values and errors

Invalid handles or unsupported object kinds report an error.

const sword = proj.find("Sword")
if sword != nil {
    debug.log(detach(sword))
}

get_light(x, y, z)

Legacy Light lookup, retained for older projects.

Arguments

Three numeric coordinates cast to integer positions.

Returns

Light handle or nil.

Works with

Authored Light Cells.

Missing values and errors

Exactly three arguments required.

LEGACY: Avoid in new code.

const legacy_light = get_light(0, 1, 0)

set_attachment_offset(child, offset) [BETA]

Change an existing attachment offset.

Arguments

Attached child handle and three-number local offset.

Returns

true when updated.

Works with

Actor, Entity, or supported runtime spatial Cell attachments.

Missing values and errors

Invalid targets, missing mounts, or invalid coordinates raise errors.

set_attachment_offset(sword, [0, 0.1, 0])

debug.traceback() [BETA]

Read the current AeoScript call stack.

Arguments

No arguments.

Returns

A multiline string.

Works with

The executing script fiber.

Missing values and errors

Only reports the active call chain.

debug.log(debug.traceback())