Docs · spells

spells

4 spells 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.

cast does something returns bool
cast(spell: string, target: npc) -> boolcast(spell: string, target: player) -> boolcast(spell: string, target: drop) -> boolcast(spell: string, target: object) -> boolcast(spell: string) -> bool

Casts a spell on an npc by packet. The npc must have been found this pass. False when it could not be sent, with the reason in the trace. You must be in range - approach(target) or reach(target) first.

Casts a spell on another player by packet. False with the reason in the trace.

Casts a spell on an item lying on the floor, such as Telekinetic grab.

Casts a spell on scenery, such as charging an obelisk orb.

Casts a self / no-target spell (a teleport) by packet.

ParameterTypeWhat it does
spellrequired string the spell name, as the spellbook spells it
targetrequired npc the npc to hit
Example
let goblin = nearestNpc(name: "Goblin", within: 10, notInCombat: true)
if goblin != none { cast("Fire strike", goblin) }
let foe = nearestPlayer(within: 8)
if foe != none { cast("Fire strike", foe) }
let loot = nearestDrop(name: "Nature rune", within: 5)
if loot != none { cast("Telekinetic grab", loot) }
let obelisk = nearestObject(name: "Obelisk of Water", within: 6)
if obelisk != none { cast("Charge Water Orb", obelisk) }
cast("Home Teleport")
castOnItem does something returns bool
castOnItem(spell: string, item: item) -> bool

Casts an inventory spell such as High level alchemy or an enchant on one slot.

ParameterTypeWhat it does
spellrequired string the spell name
itemrequired item the inventory item to cast on
Example
let bar = invItem(384)
if bar != none { castOnItem("High level alchemy", bar) }
castOnTile does something returns bool
castOnTile(spell: string, tile: tile) -> bool

Casts a land-target spell (Bones to bananas, Charge) at a tile.

ParameterTypeWhat it does
spellrequired string the spell name
tilerequired tile the ground tile to cast on
Example
castOnTile("Bones to bananas", myTile())
teleport does something returns bool
teleport(place: string) -> bool

Casts the teleport spell for a place by packet - no spellbook click. False when there is no such teleport, with the reason in the trace.

ParameterTypeWhat it does
placerequired string where to teleport, e.g. "Varrock" or "Home"
Example
teleport("Varrock")