EntityX

Family: Studio · One form

What it does

Returns the x position of the scene entity with this id or name.

Syntax

EntityX(entity string) → float

Parameters

NameTypeMeaning
entitystringThe entity's id, name or tag. It must match exactly one entity.

Every form returns

float

The x coordinate, or 0 when no entity or several entities match.

Good to know

  • A missing or ambiguous name never stops the program: it returns 0 and writes one warning to the console, once per name.
  • This is the position stored on the entity's transform, relative to its parent if it has one.

Example · generated

DO  Print(EntityX("value"))  Sync()LOOP

EntityX is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

133 commands in Studio