Magic API
The Magic API allows you to interact with the magic book and spell casting within OSRS
Cast
Firstly, find your spell from the relevant spellbook.
To cast, simply call the .cast() method from your spell. Something to note, if the spell has multiple options such as the Camelot spell you can pass in the action you want it to perform
Magic.Spell.HIGH_ALCHEMY.cast();
Magic.Spell.CAMELOT_TELEPORT.cast("Cast"); // this confirms what option you want to select
Magic.Spell.CAMELOT_TELEPORT.cast("Seers'"); // this confirms what option you want to select
Checking if the spell is casting
You can check if the spell is casting by calling the casting()
function which returns a boolean if a spell is casting
Checking if a spell is castable
You can check whether a spell is can be cast by using the canCast()
function call.
Cast a spell on an npc
You firstly have to select the spell with cast() and then once you've confirmed you're casting() it, you can then interact with the npc.
There are some other methods available too for you to explore and use at your own pace.