setProperty and getProperty to read and write properties on sprites, characters, cameras, and gameplay globals. Use setVar / getVar for custom variables shared across scripts.
setProperty
Sets a property on a game object, sprite, or gameplay global.
The property path. The format determines what is targeted:
"tag.field"— A field on a Lua sprite (e.g."mySprite.alpha")."characterName.field"— A character position (e.g."dad.x","boyfriend.y")."globalName"— A gameplay global (e.g."defaultCamZoom","cameraSpeed").
The value to set.
Supported sprite fields
| Property path | Type | Description |
|---|---|---|
tag.x | number | X position |
tag.y | number | Y position |
tag.alpha | number | Transparency (0–1) |
tag.visible | boolean | Visibility |
tag.angle | number | Rotation in degrees |
tag.scale.x / tag.scaleX | number | Horizontal scale |
tag.scale.y / tag.scaleY | number | Vertical scale |
tag.flipX / tag.flip_x | boolean | Horizontal flip |
tag.flipY / tag.flip_y | boolean | Vertical flip |
tag.antialiasing | boolean | Smooth rendering |
tag.scrollFactor.x | number | Horizontal parallax factor |
tag.scrollFactor.y | number | Vertical parallax factor |
tag.origin.x | number | Rotation origin X |
tag.origin.y | number | Rotation origin Y |
tag.offset.x | number | Render offset X |
tag.offset.y | number | Render offset Y |
tag.colorTransform.redOffset | number | Red channel offset (−255–255) |
tag.colorTransform.greenOffset | number | Green channel offset |
tag.colorTransform.blueOffset | number | Blue channel offset |
Supported gameplay globals
| Property | Type | Description |
|---|---|---|
defaultCamZoom | number | Resting camera zoom |
cameraSpeed | number | Camera follow speed multiplier |
camZooming | number | Whether beat zoom is active |
health | number | Current health (0–2) |
crochet | number | Milliseconds per beat |
stepCrochet | number | Milliseconds per step |
isCameraOnForcedPos | boolean | Lock camera to forced position |
getProperty
Reads a property from a game object, sprite, or gameplay global.
Property path, using the same format as
setProperty.0 if the property is not found (to avoid arithmetic errors in scripts).
Special readable properties
| Property | Returns |
|---|---|
"dad.animation.curAnim.name" | Opponent’s current animation name |
"boyfriend.animation.curAnim.name" | Player’s current animation name |
"gf.animation.curAnim.name" | GF’s current animation name |
"dad.x" / "dadGroup.x" | Opponent X position |
"dad.y" / "dadGroup.y" | Opponent Y position |
"boyfriend.x" / "bf.x" | Player X position |
"boyfriend.y" / "bf.y" | Player Y position |
"gf.x" / "girlfriend.x" | GF X position |
"gf.y" / "girlfriend.y" | GF Y position |
"unspawnNotes.length" | Total note count |
"tag.width" | Sprite width (texture width × abs(scale.x)) |
"tag.height" | Sprite height (texture height × abs(scale.y)) |
Group properties
Use these functions to read and write properties on members of groups such asplayerStrums, opponentStrums, and unspawnNotes.
getPropertyFromGroup
Group name:
"opponentStrums", "playerStrums", "strumLineNotes", "unspawnNotes", or "notes".0-based member index.
Field to read.
Strum fields
| Field | Type | Description |
|---|---|---|
x | number | X position |
y | number | Y position |
alpha | number | Transparency |
angle | number | Rotation |
scale.x | number | Horizontal scale |
scale.y | number | Vertical scale |
downScroll | boolean | Whether this strum uses downscroll |
Note fields (unspawnNotes / notes)
| Field | Type | Description |
|---|---|---|
strumTime | number | Hit time in milliseconds |
noteData / lane | number | Lane (0=left, 1=down, 2=up, 3=right) |
mustPress | boolean | true if this is a player note |
isSustainNote | boolean | true for hold note tails |
sustainLength | number | Hold duration in milliseconds |
visible | boolean | Note visibility |
alpha | number | Note transparency |
angle | number | Note rotation |
setPropertyFromGroup
Group name.
0-based member index.
Field to set.
New value.
setPropertyFromClass
Calls into a Psych Engine HaxeFlixel class to set a static property. This is a stub in Rustic Engine for compatibility — it currently has no effect.
Fully qualified Haxe class name.
Property name on the class.
Value to set.
Custom variables
setVar
Stores a custom variable in the shared variable table. The value is visible to all loaded scripts.
Variable name.
Value to store.
getVar
Retrieves a custom variable previously set with setVar.
Variable name.
LuaValue types
When Lua writes a property to Rust via setProperty, the value is converted to one of these internal types:
| Lua type | Rust LuaValue | Notes |
|---|---|---|
number (integer) | LuaValue::Int(i64) | Integer literals |
number (float) | LuaValue::Float(f64) | Decimal numbers |
boolean | LuaValue::Bool(bool) | |
string | LuaValue::String(String) | |
nil | LuaValue::Nil | Property cleared |
property_writes queue in ScriptState is drained by the game engine after each callback, applying all pending writes to the live game objects.