anyNpc
returns bool
anyNpc(id: int, name: string, nameContains: string, within: int, area: area, inCombat: bool, notInCombat: bool) -> bool
True when at least one npc matches. Stops at the first one, so it is cheaper than counting.
| Parameter | Type | What it does |
| idoptional |
int |
the npc id from the cache, not the server index |
| nameoptional |
string |
the whole name, ignoring case |
| nameContainsoptional |
string |
part of the name, ignoring case |
| withinoptional |
int |
how many tiles away at most, straight line |
| areaoptional |
area |
must be standing inside this area |
| inCombatoptional |
bool |
only ones fighting right now |
| notInCombatoptional |
bool |
only ones not fighting right now |
Example
if not anyNpc(name: "Goblin", within: 12) { walkTo(tile(303, 553)) }
nearestNpc
returns npc?
nearestNpc(id: int, name: string, nameContains: string, within: int, area: area, inCombat: bool, notInCombat: bool) -> npc?
The closest npc matching every option given, or none. Distance is straight-line from where you are standing, measured in the same reading the npc was read from.
| Parameter | Type | What it does |
| idoptional |
int |
the npc id from the cache, not the server index |
| nameoptional |
string |
the whole name, ignoring case |
| nameContainsoptional |
string |
part of the name, ignoring case |
| withinoptional |
int |
how many tiles away at most, straight line |
| areaoptional |
area |
must be standing inside this area |
| inCombatoptional |
bool |
only ones fighting right now |
| notInCombatoptional |
bool |
only ones not fighting right now |
Example
let goblin = nearestNpc(name: "Goblin", within: 12, notInCombat: true)
npcCount
returns int
npcCount(id: int, name: string, nameContains: string, within: int, area: area, inCombat: bool, notInCombat: bool) -> int
How many npcs match every option given. With no options, how many there are.
| Parameter | Type | What it does |
| idoptional |
int |
the npc id from the cache, not the server index |
| nameoptional |
string |
the whole name, ignoring case |
| nameContainsoptional |
string |
part of the name, ignoring case |
| withinoptional |
int |
how many tiles away at most, straight line |
| areaoptional |
area |
must be standing inside this area |
| inCombatoptional |
bool |
only ones fighting right now |
| notInCombatoptional |
bool |
only ones not fighting right now |
Example
if npcCount(name: "Goblin", within: 10) < 2 { walkTo(tile(303, 553)) }
npcs
returns list<npc>
npcs(id: int, name: string, nameContains: string, within: int, area: area, inCombat: bool, notInCombat: bool) -> list<npc>
Every npc matching every option given, in whatever order the client holds them. With no options, all of them.
| Parameter | Type | What it does |
| idoptional |
int |
the npc id from the cache, not the server index |
| nameoptional |
string |
the whole name, ignoring case |
| nameContainsoptional |
string |
part of the name, ignoring case |
| withinoptional |
int |
how many tiles away at most, straight line |
| areaoptional |
area |
must be standing inside this area |
| inCombatoptional |
bool |
only ones fighting right now |
| notInCombatoptional |
bool |
only ones not fighting right now |
Example
for goblin in npcs(name: "Goblin", within: 15) { if reachable(goblin.tile) { walkTo(goblin.tile) } }
npcsByDistance
returns list<npc>
npcsByDistance(id: int, name: string, nameContains: string, within: int, area: area, inCombat: bool, notInCombat: bool) -> list<npc>
Every npc matching every option given, closest first.
| Parameter | Type | What it does |
| idoptional |
int |
the npc id from the cache, not the server index |
| nameoptional |
string |
the whole name, ignoring case |
| nameContainsoptional |
string |
part of the name, ignoring case |
| withinoptional |
int |
how many tiles away at most, straight line |
| areaoptional |
area |
must be standing inside this area |
| inCombatoptional |
bool |
only ones fighting right now |
| notInCombatoptional |
bool |
only ones not fighting right now |
Example
for goblin in npcsByDistance(within: 15) { if reachable(goblin.tile) { walkTo(goblin.tile) } }
No command on this page matches that. The search box looks across every page.