SCAR Code:
Procedure SetupAutoCast(Spell: String; Defensive: Boolean);
Var
SpellNames: Array [0..1] of Array [0..3] of String;
TSA: TStringArray;
i, x, y, xb, yb: Integer;
SpellInt, Colours: TIntegerArray;
Begin
if not GameTab(1) then Exit;
SpellNames[0] := ['wind', 'water', 'earth', 'fire'];
SpellNames[1] := ['strike', 'bolt', 'blast', 'wave'];
Colours := [];
Mouse(655, ((Integer(not(Defensive)) * 33) + 253), 50, 25, True);
TSA := srl_Explode(Spell, ' ');
For i := 0 to 1 do
If not(InStrArrEx(TSA[i], SpellNames[i], SpellInt[i])) then
Begin
srl_Warn(SetupAutoCast, ' Invalid spell name', warn_AllVersion);
Exit;
end;
xb := ((SpellInt[0] * 40) + 503)
yb := ((SpellInt[1] * 61) + 124)
If FindColorTolerance(x, y, Colours[SpellInt[0] * SpellInt[1]], xb + 5, yb + 5, xb - 5, yb - 5, 20) then
Mouse(xb, yb, 3, 3, True);
end;