Richard
2009-06-06 02:03:00
I noticed that the previous one only supported the strike spells, so here's a version that supports all F2P spells, and, unlike the old one, checks if you're actually wielding a staff:
{*******************************************************************************
procedure SetSpell(Spell: String; Defensive: Boolean);
By: Richard
Description: Sets the autospell for staves
*******************************************************************************}
procedure SetSpell(Spell: String; Defensive: Boolean);
var
xc, yc, x, y, xx, yy, i: integer;
TSA: TStringArray;
TIA: TIntegerArray;
begin
if not GameTab(1) then Exit;
if not(GetColor(670, 273) = 16711422) then Exit;
if Defensive then
Mouse(655, 253, 50, 25, True)
else
Mouse(665, 320, 50, 25, True);
Wait(500 + random(300));
TSA := srl_Explode(Spell, ' ');
Case lowercase(TSA[0]) of
'wind' : xc := 1;
'water' : xc := 2;
'earth' : xc := 3;
'fire' : xc := 4;
else
srl_Warn('SetSpell', Spell+' is not a valid spell', warn_AllVersions);
end;
Case lowercase(TSA[1]) of
'strike': yc := 1;
'bolt' : yc := 2;
'blast' : yc := 3;
else
srl_Warn('SetSpell', Spell+' is not a valid spell', warn_AllVersions);
end;
x := (xc * 40) + 543;
y := (yc * 61) + 185;
TIA := [1250066, 1576205, 4352, 2841, 131074, 1574150, 20]
For i := 0 to High(TIA) do
Begin
if FindColorTolerance(TIA[i], xx, yy, x - 15, y - 15, x + 15, y + 15, 2) then
Begin
Mouse(x, y, 3, 3, true);
Break;
end;
end;
MouseBox(684, 447, 722, 458, 1);
end;