Docs · game

game

20 game commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

bubbleKnown returns bool
bubbleKnown() -> bool

Whether the balloon commands are answering from the client. Worth asking once at start: a balloon is a rarer event than a step, so an unbound hook here stays invisible far longer.

Example
if not bubbleKnown() { stop }
fatigue returns int
fatigue() -> int

How tired you are, 0 to 100. At 100 you stop gaining experience.

Example
if fatigue() > 95 { stop }
gameTick returns int
gameTick() -> int

How many frames the client has drawn since the bot attached. It advances once per drawn frame, so it measures the client's pace and not the server's.

Example
let frame = gameTick()
inCombat returns bool
inCombat() -> bool

True while you are fighting. Read from your stance rather than the combat timer, because the timer runs on for a while after a fight ends and anything gating on it keeps fighting a fight that is over.

Example
if inCombat() { return 1200 }
isSleeping returns bool
isSleeping() -> bool

True while the sleep screen is up.

Example
if isSleeping() { return 2000 }
menuIsOpen returns bool
menuIsOpen() -> bool

True while the right-click menu is showing. Not the npc dialogue - that is dialogueOpen().

Example
if menuIsOpen() { return 200 }
mouseX returns int
mouseX() -> int

Where the client thinks the pointer is, across. In the client's own surface, not the window.

Example
let x = mouseX()
mouseY returns int
mouseY() -> int

Where the client thinks the pointer is, down.

Example
let y = mouseY()
movementKnown returns bool
movementKnown() -> bool

Whether moving() is answering from the client or giving up. False means the hooks are absent and moving() will say false for ever.

Example
if not movementKnown() { stop }
moving needs movementKnown() returns bool
moving() -> bool

True while you are walking. The client's own test, taken off the queued waypoints, so it separates 'has not set off' from 'has arrived' - which polling your position cannot.

Example
if movementKnown() and not moving() { return 600 }
myBubbleAge needs bubbleKnown() returns int
myBubbleAge() -> int

How many client ticks ago your balloon started, or -1 when there is none. The half to remember between passes: two polls that both see item 21 cannot tell one balloon from two, but an age that went backwards is certainly a new one.

Example
let age = myBubbleAge()
myBubbleItem needs bubbleKnown() returns int
myBubbleItem() -> int

The item id in the balloon over your own head, or -1 when there is no balloon. A hint that something worked, not a count: the client draws what the server sends and derives nothing, so one balloon is not reliably one successful action.

Example
if myBubbleItem() == 373 { return 600 }
myBubbleJustStarted needs bubbleKnown() returns bool
myBubbleJustStarted() -> bool

True only on the tick a balloon appeared. Exact rather than roughly new, so a pass slower than the client's tick will miss it - myBubbleAge going backwards is the reliable test and this is the convenient one.

Example
if myBubbleJustStarted() { return 600 }
myBubbleTicks needs bubbleKnown() returns int
myBubbleTicks() -> int

How many more client ticks your balloon will be drawn for, or 0 when there is none. Worth watching rather than the item id: the countdown going back up is the only certain sign a second balloon started.

Example
let left = myBubbleTicks()
myTile returns tile
myTile() -> tile

Where you are standing, in world coordinates.

Example
let home = myTile()
prayerMask returns int
prayerMask() -> int

Which prayers are on, as the bitmask the client stores. Handed over raw: turning it into named prayers needs the prayer composite, which is not mapped, and inventing an ordering here would be a guess that scripts then depend on.

Example
if prayerMask() == 0 { return 600 }
regionBase returns tile
regionBase() -> tile

The bottom-left corner of the loaded region, in world coordinates. Only of interest to a script doing its own coordinate arithmetic.

Example
let base = regionBase()
showingBubble needs bubbleKnown() returns bool
showingBubble() -> bool

True while a balloon is up over your own head.

Example
if showingBubble() { return 400 }
sleepFatigue returns int
sleepFatigue() -> int

How much fatigue is left to sleep off, 0 to 100. Falls while you are asleep; 0 means you can wake up.

Example
if isSleeping() and sleepFatigue() < 1 { return 600 }
stance returns int
stance() -> int

Your facing, as the client stores it, or -1 when it cannot be read. 8 and 9 are the two fighting stances.

Example
if stance() == 8 { return 1200 }