runePouch
runePouch: (Magic) -> RunePouchThe rune pouch.
player:magic()| Method | Returns | Description |
|---|---|---|
runePouch() | RunePouch | The rune pouch. |
activeSpellbook() | Spellbook? | The active spellbook. |
autocastSpell() | SpellInfo? | The spell currently set to autocast. |
spellInfo(string) | SpellInfo | A spell's static facts: level, runes, requirements. |
canCast(string) | boolean? | Whether every requirement is met: spellbook, level, runes, items. |
castability(string, { number }?) | Castability | Every requirement and whether it is met, rather than one boolean. |
runeCount(Rune) | number | How many of a rune are carried, counting the rune pouch as well as the inventory. |
cast(string) | boolean | Cast a direct spell, one with no target, when it can be cast. |
select(string, { number }?) | boolean | Select a spell, ready for a following inventory:target(itemId). The castOn* members do both halves. |
castOnNpc(string, NPC, { number }?) | boolean | Select a spell and cast it on an NPC, the two together in one tick. |
castOnObject(string, TileObject, { number }?) | boolean | Select a spell and cast it on a scene object, the two together in one tick. |
castOnPlayer(string, Player, { number }?) | boolean | Select a spell and cast it on a player, the two together in one tick. Nothing is selected for a spell that cannot be cast on a player. |
castOnGroundItem(string, TileItem, { number }?) | boolean | Select a spell and cast it on a ground item (Telekinetic Grab), that stack only, the two together in one tick. Nothing is selected for a sp… |
castOnItem(string, Item | ItemHandle | number, { number }?) | boolean | Select a spell and cast it on an inventory item, the two together in one tick. |
setAutocast(string, boolean?) | (RunStatus, string?) | One step towards autocasting a spell: opens the autocast chooser, then picks the spell. Call it each tick until it stops answering `"runnin… |
clearAutocast() | (RunStatus, string?) | One step towards no autocast, by picking a combat style. Call it each tick until it stops answering "running". |
| Method | Returns | Description |
|---|---|---|
PlayerDomain.magic | Magic | Spellbook, runes, castability, and casting. |
runePouchrunePouch: (Magic) -> RunePouchThe rune pouch.
activeSpellbookactiveSpellbook: (Magic) -> Spellbook?The active spellbook.
nil when the varbit has not been read yet.autocastSpellautocastSpell: (Magic) -> SpellInfo?The spell currently set to autocast.
nil when autocast is off, or the game's autocast id is not a spell Bento knows.spellInfospellInfo: (Magic, string) -> SpellInfoA spell's static facts: level, runes, requirements.
spellcanCastcanCast: (Magic, string) -> boolean?Whether every requirement is met: spellbook, level, runes, items.
spellnil when a requirement could not be read: no scene yet, not logged in.castabilitycastability: (Magic, string, { number }?) -> CastabilityEvery requirement and whether it is met, rather than one boolean.
assumedEquipped is for an equip and a cast queued together, where the gear that satisfies the spell is not on yet; its canCast field is the answer.
spellassumedEquippedruneCountruneCount: (Magic, Rune) -> numberHow many of a rune are carried, counting the rune pouch as well as the inventory.
runeRune.AIR.castcast: (Magic, string) -> booleanCast a direct spell, one with no target, when it can be cast.
spellSpells constant or a spell name.selectselect: (Magic, string, { number }?) -> booleanSelect a spell, ready for a following inventory:target(itemId). The castOn* members do both halves.
spellSpells constant or a spell name.assumedEquippedfalse when it takes no target or its requirements are not met.castOnNpccastOnNpc: (Magic, string, NPC, { number }?) -> booleanSelect a spell and cast it on an NPC, the two together in one tick.
spellSpells constant or a spell name.npcNPC (the top level or the boat the player stands in; false for one outside the top level and the boat the player stands in, one that is gone, or once another NPC has taken its index).assumedEquippedcastOnObjectcastOnObject: (Magic, string, TileObject, { number }?) -> booleanSelect a spell and cast it on a scene object, the two together in one tick.
spellSpells constant or a spell name.objectTileObject (the top level on the player's plane, or the deck of the boat the player stands in; false for one outside the top level and the boat the player stands in, removed, of a reloaded scene, or under a bridge).assumedEquippedcastOnPlayercastOnPlayer: (Magic, string, Player, { number }?) -> booleanSelect a spell and cast it on a player, the two together in one tick. Nothing is selected for a spell that cannot be cast on a player.
spellSpells constant or a spell name.playerPlayer (top-level world view).assumedEquippedcastOnGroundItemcastOnGroundItem: (Magic, string, TileItem, { number }?) -> booleanSelect a spell and cast it on a ground item (Telekinetic Grab), that stack only, the two together in one tick. Nothing is selected for a spell that cannot be cast on a ground item.
spellSpells constant or a spell name.itemTileItem (the top level or the boat the player stands in).assumedEquippedcastOnItemcastOnItem: (Magic, string, Item | ItemHandle | number, { number }?) -> booleanSelect a spell and cast it on an inventory item, the two together in one tick.
spellSpells constant or a spell name.itemItem (its slot when it carries one, else the first slot holding its id), an item id, or an item handle from a container query.assumedEquippedsetAutocastsetAutocast: (Magic, string, boolean?) -> (RunStatus, string?)One step towards autocasting a spell: opens the autocast chooser, then picks the spell. Call it each tick until it stops answering "running".
local status, why = player:magic():setAutocast(Spells.FIRE_SURGE)
if status == "blocked" then log:warn(why) endspellSpells constant or a spell name.defensivetrue for defensive autocast."done" when it is set that way, "running" when a step was queued, and "blocked" with the reason when it cannot be set (a spell that cannot be autocast, a spellbook or staff that does not offer it).clearAutocastclearAutocast: (Magic) -> (RunStatus, string?)One step towards no autocast, by picking a combat style. Call it each tick until it stops answering "running".
"done" when autocast is off, "running" when a step was queued, and "blocked" with the reason when it could not be queued.