From: Shuttleu
your right
if it is unable to cast then the outline color is 131074 and if it is avaliable to cast then it is 65536
~shut
Some spells have a 65536 colour outline regardless of whether you can cast it or not. :(
From: Cazax
Don't do a whole HSL test, just compare the Luminance value. You will get a huge difference.
You're right with the luminance:
function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
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', 'bounty locate', '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;
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);
if (FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2)) then
begin
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
for II := 0 to High(colArr) do
begin
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
Result := (Lum > 30.0);
if (Result) then
begin
WriteLn(Lum);
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 3);
Wait(500 + Random(500));
end;
end;
end;
I've searched for the max luminance in the box around the spell and I've checked if its above a certain value (I've set this to 30.0). Hasn't been widely tested yet though.