<!-- Page: https://rustic-game-engine.pages.dev/docs/scripting/web/available-inline-javascript-api -->

# Available inline JavaScript API

[Back to HTML/CSS](https://rustic-game-engine.pages.dev/markdown/scripting/web.md).

Inline code receives `rustic`, `Game`, and `instance` exactly as described in
[the JavaScript guide](https://rustic-game-engine.pages.dev/markdown/scripting/javascript.md):

```javascript
const [x, y, z] = rustic.get_translation();
rustic.set_translation(x, y + 1, z);
rustic.set_property("score", 10);
rustic.EditAttribute("Color", [1.0, 1.0, 1.0]);

const camera = Game.scene.Find("Room.Camera");
Game.setCurrentCamera(camera);
instance.add("Cube");

if (rustic.key("KeyW").held) {
  rustic.log("info", "forward key held in Play");
}
```

JavaScript mutations are applied in command order after the callback. Properties must
be declared and type-compatible. Scene lookup returns stable IDs; JavaScript
`Game.scene.List()` currently returns path strings. Instance operations are queued
and do not return the created ID.
The [Play input limits](https://rustic-game-engine.pages.dev/markdown/scripting/lua/input.md) also apply to inline JavaScript:
only held WASD, arrow, and Shift state is forwarded from the embedded Play viewport.
