Then surely you'd just:
Function GetMagicsSort: Integer;
Var
I : Integer;
Pnts : TPointArray;
Begin
GameTab(7);
Wait(150 + Random(100));
Pnts := [Point(678, 443), Point(697, 443), Point(716, 443)];
For I := 0 To 2 Do
If GetColor(Pnts[i].X, Pnts[i].Y) <> 7038086 Then
Begin
Result := I + 1;
Exit;
End;
End;
Procedure SortMagics(Order : Integer);
Var
X : Integer;
Begin
If Not InIntArray([1, 2, 3], Order) Then
Exit;
X := 659 + (19 * Order);
GameTab(7);
MouseBox(X, 443, X + 12, 458, 1);
End;
function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II, CTS: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
case (Lowercase(Spell)) of
'home teleport': Spell := 'lumbridge home teleport';
'bolt enchantment': Spell := 'enchant crossbow bolt';
'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
end;
spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
'teleother camelot'];
Spell := Lowercase(Spell);
if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
spNo := StrToInt(Spell) - 1
else
if (not(InStrArrEx(Spell, spArr, spNo))) then
begin
srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
Exit;
end;
if (GetCurrentTab <> 7) then
begin
GameTab(7);
Wait(500 + Random(500));
end;
SortMagics(1);
B.X1 := spNo mod 7 * 24 + 560;
B.Y1 := spNo div 7 * 24 + 217;
B.X2 := B.X1 + 23;
B.Y2 := B.Y1 + 23;
if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
FixSpells;
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.72, 1.05);
for II := 0 to High(colArr) do
begin
if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Result := (Lum > 20.0);
if (Result) then
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
Wait(500 + Random(500));
end;
end;
No?