Magic

The Magic include contains a few useful functions to aid in scripting for the magic skill. Mose are used to properly cast spells so it will work with any spell sorting selected.

SetupSpells

procedure SetupSpells;

Sets the SpellModes var to match the runescape spells.

Note

Author: N1ke! Last Modified: Unknown

Example:

if (not SpellSetup) then
  SetupSpells();

DebugSpellVars

procedure DebugSpellVars(SpellMode: Integer);
Debugs the SpellMode global variable. Valid arguements for SpellMode:
  • SPELLMODE_COMBAT
  • SPELLMODE_TELEPORT
  • SPELLMODE_MISC
  • SPELLMODE_SKILL
  • SPELLMODE_ALL

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

DebugSpellVars(SPELLBOOK_ALL);

GetSpellInfo

function GetSpellInfo(Spell: string): TSpell;

Returns the TSpell type of the spell ‘Spell’.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

var
  Spell: TSpell;
begin
  Spell := GetSpellInfo('superheat item');
  //...
end;

SpellIsSort

function SpellIsSort(Spell: string): Integer;

Results what kind of sort the spell is. For example, SpellIsSort(‘water strike’) will return SPELLMODE_COMBAT.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

Sort := SpellIsSort('water strike');

SpellsAvailable

function SpellsAvailable: TBooleanArray;

Results which sort of spells are available.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

Spells := SpellsAvailable();

ClickSpellMode

procedure ClickSpellMode(Which: Integer);
Clicks the spell mode ‘Which’. Valid arguements are:
  • SPELLMODE_COMBAT
  • SPELLMODE_TELEPORT
  • SPELLMODE_MISC
  • SPELLMODE_SKILL
  • SPELLMODE_ALL

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

ClickSpellMode(SPELLMODE_COMBAT);

SetSpellMode

procedure SetSpellMode(Combat, Teleport, Misc, Skill: Boolean);

Sets the spell modes on or off for each mode. True will turn it on, false will turn it off.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

SetSpellMode(true, false, false, true);

BookSortedBy

function BookSortedBy: Integer;
Results how the book is sorted. Possible results are
  • BOOKSORT_LEVEL = 0
  • BOOKSORT_COMBAT = 1
  • BOOKSORT_TELEPORT = 2

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

SortedBy := BookSortedBy();

SortBook

procedure SortBook(By: Integer);
Sorts the spell book by the given parameter. Valid arguments are:
  • BOOKSORT_LEVEL
  • BOOKSORT_COMBAT
  • BOOKSORT_TELEPORT

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

SortBook(BOOKSORT_LEVEL);

DefCastIs

function DefCastIs: Boolean;

Results true if defensive casting is enabled.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

if (DefCastIs()) then
  Writeln('We are defensive casting!');

ToggleDefCast

procedure ToggleDefCast(SetTo: Boolean);

Turns defensive casting on/off. True turns it on, false off.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

ToggleDefCast(false);

ScrollSpellBook

procedure ScrollSpellBook(Up: Boolean);

Scrolls the spell book up or down.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

ScrollSpellBook(true);

SpellAvailable

function SpellAvailable(var Coords: TBox; Spell: string): Boolean;

Results true if the given spell is available and can be casted. Also stores coords in a TBox var where the spell is located. Will work however the spells are sorted, visable or not (will enable the spells sort if not enabled).

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

if (SpellAvailable(b, 'superheat item')) then
  mouseBox(b.x1, b.y1, b.x2, b.y2, mouse_left);

Cast

function Cast(Spell: string; AutoCast: Boolean): Boolean;

Results true if the spell given is clicked. If Autocast is true, it’ll toggle the spell to autocast. Will work however the spells are sorted, visable or not (will enable the spells sort if not enabled).

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

if (Cast('superheat item', false)) then
  Writeln('Casted Superheat Item!');

SetupMagic

procedure SetupMagic();

Sets up the magic skill.

Note

Author: N1ke! Last Modified: 12 Sept. 09 by N1ke!

Example:

SetupMagic();