They are in the bot too: Scripts → Examples. A click adds the example turned off, with its description as a comment at the top: check the names (spells, potions, Labels, friends) and turn it on.
Train magic level (Create Rune)
runs every 2 s
Trains magic level: casts SPELL when your mana is at 95% or more and no monster is up to 7 sqm away. Change SPELL to a spell of your vocation (Create Rune needs a blank rune).
const SPELL = "Create Rune"
if (player.manaPercent >= 95 && monstersAround(7) === 0) {
cast(SPELL)
}Hurry when no monster is around
runs every 1 s
Casts Hurry when you are not hasted, no monster is up to 7 sqm away and you are out of a protection zone.
if (!player.hasted && !player.inPz && monstersAround(7) === 0) {
cast("Hurry")
}Hurry when paralyzed
runs every 0.2 s
Casts Hurry as soon as you are paralyzed.
if (player.paralyzed) {
cast("Hurry")
}Mana Block when HP is low
runs every 0.3 s
Casts Mana Block when your HP falls below 40% and it is not on.
if (player.hpPercent < 40 && !player.manaShield) {
cast("Mana Block")
}Mana Block when a player shows up
runs every 0.5 s
Casts Mana Block when another player (not in FRIENDS) is up to 7 sqm away on your floor.
const FRIENDS = ["Friend One", "Friend Two"]
const someone = players().find((p) => p.distance <= 7 && !FRIENDS.includes(p.name))
if (someone && !player.manaShield) {
cast("Mana Block")
}Heal Target on your friend
runs every 0.3 s
For healers: casts Heal Target when your friend's HP falls below 60% and they are up to 7 sqm away. Save the friend in the game first with /heal Name, and write the same name in FRIEND.
const FRIEND = "Friend Name"
const friend = findPlayer(FRIEND)
if (friend && friend.hpPercent < 60 && friend.distance <= 7) {
cast("Heal Target")
}Health potion when HP is low
runs every 0.2 s
Uses POTION when your HP falls below 35%. Change POTION to the health potion you carry.
const POTION = "Medium Health Potion"
if (player.hpPercent < 35) {
useItem(POTION)
}Mana potion when mana is low
runs every 0.3 s
Uses POTION when your mana falls below 40%. Change POTION to the mana potion you carry.
const POTION = "Medium Mana Potion"
if (player.manaPercent < 40) {
useItem(POTION)
}Berserker on 3+ monsters
runs every 0.5 s
For knights and paladins: casts Berserker when 3 or more monsters are up to 2 sqm away and it is not on.
if (!player.berserker && monstersAround(2) >= 3) {
cast("Berserker")
}Defy on 3+ monsters (knight)
runs every 0.5 s
For knights: casts Defy when 3 or more monsters are up to 2 sqm away.
if (monstersAround(2) >= 3) {
cast("Defy")
}Area spell on 3 monsters around
runs every 0.3 s
Casts the area spell of your vocation (AREA) when 3 or more monsters stand next to you.
const AREA = { knight: "Twist Rage", paladin: "Arrow Storm", mage: "Fire Wave", healer: "Ice Wave" }
const spellName = AREA[player.vocation]
if (spellName && monstersAround(1) >= 3) {
cast(spellName)
}Attack the weakest monster
runs every 0.3 s
Attacks the monster with the least HP up to 6 sqm away. Holds the Target tab while it runs, so they don't fight; turning the script off gives it back.
pause("target")
const near = monsters().filter((m) => m.onScreen && m.distance <= 6)
if (near.length > 0) {
const weakest = near.reduce((a, b) => (b.hpPercent < a.hpPercent ? b : a))
if (!target || target.id !== weakest.id) attack(weakest)
}Attack the boss first
runs every 0.3 s
When a monster from BOSSES is on screen, attacks it, even if you are attacking another one.
const BOSSES = ["Orc Warden", "Dhardon"]
const boss = monsters().find((m) => m.onScreen && BOSSES.includes(m.name))
if (boss && (!target || target.id !== boss.id)) {
attack(boss)
}Rune on the target
runs every 0.3 s
Uses RUNE on the monster you are attacking, once every 2 s, while it has 30% HP or more. If the Combat tab also uses this rune, turn it off there.
const RUNE = "Spirit of Doom"
storage.usedAt = storage.usedAt || 0
if (target && target.type === "monster" && target.hpPercent >= 30 && now - storage.usedAt >= 2000) {
if (useOnTarget(RUNE)) storage.usedAt = now
}Chase mode on a boss
runs every 0.5 s
Turns the game's Chase on while you attack a monster from BOSSES and off for the others.
const BOSSES = ["Orc Warden", "Dhardon"]
const wanted = target && BOSSES.includes(target.name) ? "chase" : "off"
if (chase !== null && chase !== wanted) {
chaseMode(wanted)
}Alarm on few potions
runs every 2 s
Sounds the alarm once and writes it in the console when you have fewer than 20 of POTION.
const POTION = "Medium Mana Potion"
const LIMIT = 20
const left = itemCount(POTION)
if (left < LIMIT && !storage.warned) {
alarm()
warn("Only", left, POTION, "left")
storage.warned = true
} else if (left >= LIMIT) {
storage.warned = false
}Hold the Cavebot on few potions
runs every 1 s
Holds the Cavebot while you have fewer than 20 of POTION and lets it go when you have more.
const POTION = "Medium Mana Potion"
if (itemCount(POTION) < 20) {
pause("cavebot")
} else {
resume("cavebot")
}Go refill on low supplies
runs every 2 s
Sends the Cavebot to the label Refill when you have fewer than 30 health or 50 mana potions (once a minute at most). Add a Label named Refill to your route, before the way to the city.
const HEALTH = "Medium Health Potion"
const MANA = "Medium Mana Potion"
const low = itemCount(HEALTH) < 30 || itemCount(MANA) < 50
if (low && cavebot.label !== "Refill" && now - (storage.sentAt || 0) > 60000) {
if (gotoLabel("Refill")) {
storage.sentAt = now
log("Going to refill")
} else {
warn("No label Refill in the route")
}
}Go to the depot with a full bag
runs every 2 s
Sends the Cavebot to the label Depot when the backpack has 2 free slots or less (once a minute at most).
if (backpackFree !== null && backpackFree <= 2 && cavebot.label !== "Depot" && now - (storage.sentAt || 0) > 60000) {
if (gotoLabel("Depot")) storage.sentAt = now
}Buy potions up to 100 (at the NPC)
runs every 1.5 s
Next to a shop NPC (up to 4 sqm): buys ITEM until you have WANT. Use it with Run now or leave it on while you stand at the NPC.
const ITEM = "Medium Mana Potion"
const WANT = 100
const missing = WANT - itemCount(ITEM)
if (missing > 0 && !buy(ITEM, missing)) {
log("Not yet:", why())
}Sell loot to the NPC
runs every 1.5 s
Next to a shop NPC: sells every item of SELL that is in your botín, one item per run.
const SELL = ["Orc Leather", "Wolf Paw"]
const item = lootBag.find((it) => SELL.includes(it.name))
if (item && !sell(item.name, "all")) {
log("Not sold yet:", why())
}Deposit items at the depot NPC
runs every 1.5 s
Next to the depot NPC: deposits every item of DEPOSIT that is in your backpack, one item per run.
const DEPOSIT = ["Orc Leather", "Wolf Paw"]
const item = backpack.find((it) => DEPOSIT.includes(it.name))
if (item && !deposit(item.name)) {
log("Not deposited:", why())
}Deposit gold at the bank
runs every 2 s
Next to the bank NPC: deposits your gold and keeps KEEP in the backpack.
const KEEP = 1000
if (gold !== null && gold > KEEP) {
depositGold(gold - KEEP)
}Stop hunting, log out after 2 h
runs every 1 s
After 2 hours online: holds the Cavebot and Target, sounds the alarm once and logs out as soon as you are not attacking anything.
const HOURS = 2
if (online > HOURS * 3600000) {
pause("cavebot")
pause("target")
if (!storage.alarmed) {
alarm()
warn("Hunt time is over")
storage.alarmed = true
}
if (!target) logout()
}Log out with low HP and no potions
runs every 0.3 s
Logs out when your HP falls below 20% and you have no POTION left.
const POTION = "Medium Health Potion"
if (player.hpPercent < 20 && itemCount(POTION) === 0) {
logout()
}Alarm on a private message
runs every 0.5 s
Sounds the alarm and writes who sent it and the text when you get a private message.
for (const m of messages()) {
if (m.type === "private") {
alarm()
warn("PM from", m.from + ":", m.text)
}
}Stop the bot on a server message
runs every 0.5 s
When a server line has one of the WORDS, sounds the alarm, writes it in the console and turns the bot off.
const WORDS = ["gm", "jail", "prison", "banned"]
for (const m of messages()) {
if (m.type === "private") continue
const text = m.text.toLowerCase()
if (WORDS.some((w) => text.includes(w))) {
alarm()
warn("Server:", m.text)
stopBot()
}
}Hold the Cavebot near players
runs every 0.5 s
Holds the Cavebot while a player who is not in FRIENDS is up to 4 sqm away.
const FRIENDS = ["Friend One", "Friend Two"]
const near = players().some((p) => p.distance <= 4 && !FRIENDS.includes(p.name))
if (near) {
pause("cavebot")
} else {
resume("cavebot")
}Alarm on a rare monster
runs every 1 s
Sounds the alarm and writes it in the console when a monster from RARE shows up on your floor, once for each one.
const RARE = ["Orc Warden", "Dhardon"]
storage.seen = storage.seen || {}
for (const m of monsters()) {
if (RARE.includes(m.name) && !storage.seen[m.id]) {
storage.seen[m.id] = true
alarm()
warn("Rare monster:", m.name, "at", m.distance, "sqm")
}
}Alarm when your partner leaves
runs every 1 s
Sounds the alarm when your partner is not on your floor for 15 s. Write the name in PARTNER.
const PARTNER = "Friend Name"
if (findPlayer(PARTNER)) {
storage.lastSeen = now
storage.alarmed = false
} else if (now - (storage.lastSeen || now) > 15000 && !storage.alarmed) {
alarm()
warn(PARTNER, "left your floor")
storage.alarmed = true
}
storage.lastSeen = storage.lastSeen || nowAlarm when the Cavebot is stuck
runs every 2 s
With the Cavebot on, sounds the alarm when you stay on the same sqm for 2 minutes.
const here = player.x + "," + player.y + "," + player.z
if (!cavebot.on || here !== storage.here) {
storage.here = here
storage.since = now
storage.alarmed = false
} else if (now - storage.since > 120000 && !storage.alarmed) {
alarm()
warn("Standing still for 2 minutes at", here)
storage.alarmed = true
}Wait for the respawn at a label
runs every 0.5 s
When the Cavebot passes the label Spawn and no monster is up to 7 sqm away, holds the route up to 40 s waiting for the respawn. Add a Label named Spawn to your route, where the monsters come back.
const LABEL = "Spawn"
const MAX_MS = 40000
if (cavebot.label === LABEL && monstersAround(7) === 0) {
storage.since = storage.since || now
if (now - storage.since < MAX_MS) {
pause("cavebot")
} else {
resume("cavebot")
}
} else {
storage.since = 0
resume("cavebot")
}Change hunt when a player is there
runs every 1 s
While the Cavebot is in the label Hunt and another player (not in FRIENDS) stays up to 8 sqm away for 30 s, goes to the label Hunt 2. Change the labels to the ones in your route.
const FRIENDS = ["Friend One"]
const HUNT = "Hunt"
const NEXT = "Hunt 2"
const other = players().some((p) => p.distance <= 8 && !FRIENDS.includes(p.name))
if (cavebot.label === HUNT && other) {
storage.since = storage.since || now
if (now - storage.since > 30000) {
gotoLabel(NEXT)
storage.since = 0
}
} else {
storage.since = 0
}Walk a route of sqm by script
runs every 1 s
Walks through the sqm of POINTS one by one and starts over at the end, holding the Cavebot while it walks. To get the x, y of a sqm, stand on it and use the example Write where you are.
const POINTS = [
{ x: 100, y: 200 },
{ x: 104, y: 200 },
{ x: 104, y: 196 },
]
pause("cavebot")
for (const point of POINTS) {
if (!(await goTo(point, 20000))) {
warn("Could not reach", point.x, point.y, "-", why())
break
}
}Follow a friend on screen
runs every 1 s
Turns the Follow of the Target / Movement tab on for FRIEND while they are on your floor, and off when they leave.
const FRIEND = "Friend Name"
if (findPlayer(FRIEND)) {
if (option("follow.playerName") !== FRIEND) setOption("follow.playerName", FRIEND)
turnOn("follow")
} else {
turnOff("follow")
}Smaller Target range on crowds
runs every 1 s
Changes the Target range to 3 sqm when 4 or more monsters are up to 3 sqm away, and back to 6 when they are fewer.
const range = monstersAround(3) >= 4 ? 3 : 6
if (option("target.range") !== range) {
setOption("target.range", range)
}Drop junk from the backpack
runs every 1 s
Drops every item of JUNK that is in your backpack, one per run (the game lets you drop from level 8).
const JUNK = ["Bone", "Rotten Meat"]
const item = backpack.find((it) => JUNK.includes(it.name))
if (item) {
dropItem(item.name)
}Move items from botín to backpack
runs every 1 s
Moves every item of MOVE from the botín to the backpack, one per run, while the backpack has room.
const MOVE = ["Medium Mana Potion", "Medium Health Potion"]
const item = lootBag.find((it) => MOVE.includes(it.name))
if (item && !moveToBackpack(item.name)) {
log("Not moved:", why())
}Kills per hour
runs every 0.3 s
Counts the monsters you kill (your target disappearing with little HP) and writes the kills per hour every minute.
storage.kills = storage.kills || 0
storage.since = storage.since || now
const last = storage.last
if (last && !monsters().some((m) => m.id === last.id) && last.hpPercent <= 20) {
storage.kills += 1
storage.last = null
}
if (target && target.type === "monster") {
storage.last = { id: target.id, hpPercent: target.hpPercent }
}
if (now - (storage.printedAt || 0) >= 60000) {
storage.printedAt = now
const hours = Math.max((now - storage.since) / 3600000, 1 / 60)
log("Kills:", storage.kills, "-", Math.round(storage.kills / hours), "per hour")
}Experience per hour
runs every 1 min
Every minute writes in the console the experience you gained since the script started and how much per hour.
if (player.experience !== null) {
if (storage.start === undefined) {
storage.start = player.experience
storage.since = now
}
const gained = player.experience - storage.start
const hours = Math.max((now - storage.since) / 3600000, 1 / 60)
log("Experience:", gained, "-", Math.round(gained / hours), "per hour")
}Potions used per hour
runs every 1 min
Every minute writes in the console how many of POTION you used per hour and for how long the rest lasts.
const POTION = "Medium Mana Potion"
const have = itemCount(POTION)
if (storage.last === undefined) {
storage.last = have
storage.used = 0
storage.since = now
}
if (have < storage.last) storage.used += storage.last - have
storage.last = have
const hours = Math.max((now - storage.since) / 3600000, 1 / 60)
const perHour = Math.round(storage.used / hours)
const lasts = perHour > 0 ? (have / perHour).toFixed(1) + " h" : "-"
log(POTION + ":", have, "left,", perHour, "per hour, lasts", lasts)Write where you are (x, y, z)
runs every 5 s
Writes your x, y and z in the console (use Run now). Good to fill the POINTS of Walk a route.
log("x:", player.x, "y:", player.y, "z:", player.z)
log("{ x: " + player.x + ", y: " + player.y + " },")List what is on screen
runs every 5 s
Writes in the console the monsters, players and NPCs on screen, with the distance (use Run now).
for (const c of creatures()) {
if (!c.onScreen) continue
log(c.type, c.name, c.distance + " sqm", c.hpPercent === undefined ? "" : c.hpPercent + "%")
}
log("Monsters:", monsters().length, "Players:", players().length)Charging only while hunting
runs every 2 s
Turns your Charging on when a monster is up to 7 sqm away and off in a protection zone. The game asks 1 minute between changes.
if (player.inPz) {
chargingOff()
} else if (monstersAround(7) > 0) {
chargingOn()
}Ring when HP is low
runs every 0.3 s
Puts RING on when your HP falls below 40% and takes it off above 80%. Change RING to the ring you carry.
const RING = "Ring Name"
if (player.hpPercent < 40) {
equip(RING)
} else if (player.hpPercent > 80 && equipment.some((e) => e.name === RING)) {
unequip("ring")
}Potions from the mailbox
runs every 2 s
Moves POTION from the mailbox to the backpack when you have fewer than 50 of it.
const POTION = "Medium Mana Potion"
if (itemCount(POTION) < 50 && mailbox.some((it) => it.name === POTION)) {
takeFromMailbox(POTION, 50 - itemCount(POTION))
}Click a chest on the map
runs every 0.5 s
Clicks the sqm CHEST once when you stand next to it, for things on the map you take by clicking. Change CHEST to the x, y of the chest (use the example Write where you are).
const CHEST = { x: 100, y: 200 }
if (!storage.done && distance(CHEST) <= 1) {
if (clickMap(CHEST.x, CHEST.y)) storage.done = true
}