# Magic Methods to interact with the magic gametab. - - - ## TMagic Main record reponsible for handling the magic gametab. - - - ## Magic.IsOpen ```pascal function TMagic.IsOpen(): Boolean; ``` Returns true if the Magic tab is open. Example: ```pascal WriteLn Magic.IsOpen(); ``` - - - ## Magic.Open ```pascal function TMagic.Open(): Boolean; ``` Attempts to open the magic tab. Example: ```pascal Magic.Open(); ``` - - - ## Magic.IsSpellBook ```pascal function TMagic.IsSpellBook(book: ESpellBook): Boolean; ``` Returns true if we are using the specified spell book. Example: ```pascal WriteLn Magic.IsSpellBook(ESpellBook.LUNAR); ``` - - - ## Magic.GetSpellBook ```pascal function TMagic.GetSpellBook(): ESpellBook; ``` Returns the current spell book. Example: ```pascal WriteLn Magic.GetSpellBook(); ``` - - - ## Magic.InfoIsOpen ```pascal function TMagic.InfoIsOpen(): Boolean; ``` Returns true if the info black box about a spell is open. Example: ```pascal WriteLn Magic.IsSpellBook(ESpellBook.LUNAR); ``` - - - ## Magic.CloseInfo ```pascal function TMagic.CloseInfo(): Boolean; function TMagic.CloseInfo(spell: ESpell): Boolean; overload; ``` Returns true if the info black box about a spell is open. Example: ```pascal WriteLn Magic.CloseInfo(); ``` - - - ## Magic.FindSpell ```pascal function TMagic.FindSpell(spell: ESpell; out box: TBox): Boolean; ``` Return true or false wether we found a spell or not and return it's bounds if found. - - - ## Magic.ContainsSpell ```pascal function TMagic.ContainsSpell(spell: ESpell): Boolean; ``` Return true or false wether we found a spell or not. - - - ## Magic.Hover ```pascal function TMagic.Hover(spell: ESpell): Boolean; ``` Used to move the mouse to the specified spell. Example: ```pascal Magic.Hover(ESpell.HIGH_LEVEL_ALCHEMY); ``` - - - ## Magic.Click ```pascal function TMagic.Click(spell: ESpell; button: EMouseButton = EMouseButton.LEFT): Boolean; ``` Used to Click on a specified spell. Example: ```pascal Magic.Click(ESpell.HIGH_LEVEL_ALCHEMY); ``` - - - ## Magic.Interact ```pascal function TMagic.Interact(spell: ESpell; option: String = ''): Boolean; ``` Used to interact with the specified spell. You can just click it or choose an option on it. Example: ```pascal Magic.Interact(ESpell.HIGH_LEVEL_ALCHEMY); ``` - - - ## Magic.FindSelected ```pascal function TMagic.FindSelected(out tpa: TPointArray): Boolean; ``` Returns the true if we have a selected spell and returns it's tpa. Example: ```pascal if Magic.FindSelected(tpa) then Debug(tpa); ``` - - - ## Magic.ContainsSelected ```pascal function TMagic.ContainsSelected(): Boolean; ``` Returns the true if we have a selected spell. Example: ```pascal WriteLn Magic.ContainsSelected(); ``` - - - ## Magic.IsSelected ```pascal function TMagic.IsSelected(spell: ESpell): Boolean; function TMagic.IsSelected(spell: ESpell; selected: TPointArray): Boolean; overload; ``` Returns true if the specified spell is currently active (with white outline). Example: ```pascal WriteLn Magic.IsSpellSelected(ESpell.ICE_BARRAGE); ``` - - - ## Magic.CanActivate ```pascal function TMagic.CanActivate(spell: ESpell): Boolean; ``` Returns true if we can activate the spell (we have runes, level and the spell unlocked). Example: ```pascal Magic.CanActivate(ESpell.HIGH_LEVEL_ALCHEMY); ``` - - - ## Magic.SpellWasCast ```pascal function TMagic.SpellWasCast(spell: ESpell): Boolean; ``` Returns true if we are in a state that casting a spell would leave you. Example: ```pascal Magic.SpellWasCast(ESpell.ICE_BARRAGE); ``` - - - ## Magic.Cast ```pascal function TMagic.Cast(spell: ESpell): Boolean; ``` Attempts to cast the specified spell. Example: ```pascal Magic.Cast(ESpell.LOW_LEVEL_ALCHEMY); ``` - - - ## Magic.GetBookSpellCount ```pascal function TMagic.GetBookSpellCount(): Int32; ``` Returns the number of spells declared in SRL for the current spellbook. Example: ```pascal WriteLn Magic.GetBookSpellCount(); ``` - - - ## Magic variable Global {ref}`TMagic` variable.