Simba Code:
{
Regular Spell's = Cmb/Tele/Misc/Skill
Lunar Spell's = Cmb/Tele/Misc
Ancient Spell's = Cmb/Tele
Example of Useage:
TBoolArray paramater;
- false = no white outline expected, hence we'll make sure it's not outlined
- true = white outline expcected, hence we'll make sure it's outlined/used.
if OrganizeSpellBook('regular', [false, false, false, true]) then
writeln('Only showing the last regular magic spells [which is skills]');
}
function OrganizeSpellBook(Spells:String; FilterOrder:TBoolArray): boolean;
var
i: integer;
cc: integer; // color count (white color color count)
indexBool: array of boolean; // stores the temp state of the filter boxes
begin
result := false;
if not loggedin then
exit;
if (GetCurrentTab <> tab_magic) then
GameTab(tab_magic);
case Spells of
'regular':
begin
if (Length(FilterOrder) <> 4) then
begin
SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
+ 'TBoolArray', Warn_AllVersions);
exit;
end;
SetLength(indexBool, 4); // There are 4 options in regular spell book.
for i := 0 to 3 do
begin
cc := CountColorTolerance(16711422, MIX1+35+(i*21), MIY2-31,
MIX1+56+(i*21), MIY2-1, 1);
if (inRange(cc, 75, 78)) then
indexBool[i] := True;
if (not FilterOrder[i]) and indexBool[i] then
begin
MouseBox(MIX1+35+(i*21), MIY2-31, MIX1+56+(i*21), MIY2-1, mouse_left);
result := true;
end else
if FilterOrder[i] and (not indexBool[i]) then
begin
MouseBox(MIX1+35+(i*21), MIY2-31, MIX1+56+(i*21), MIY2-1, mouse_left);
result := true;
end;
end;
end;
'lunar':
begin
if (Length(FilterOrder) <> 3) then
begin
SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
+ 'TBoolArray', Warn_AllVersions);
exit;
end;
SetLength(indexBool, 3); // There are 3 options in lunar spell book.
for i := 0 to 2 do
begin
cc := CountColorTolerance(16711422, MIX1+37+(i*27), MIY2-31,
MIX1+64+(i*27), MIY2-1, 1);
if (inRange(cc, 75, 78)) then
indexBool[i] := True;
if (not FilterOrder[i]) and indexBool[i] then
begin
MouseBox(MIX1+37+(i*27), MIY2-31, MIX1+64+(i*27), MIY2-1, mouse_left);
result := true;
end else
if FilterOrder[i] and (not indexBool[i]) then
begin
MouseBox(MIX1+37+(i*27), MIY2-31, MIX1+64+(i*27), MIY2-1, mouse_left);
result := true;
end;
end;
end;
'ancient':
begin
if (Length(FilterOrder) <> 2) then
begin
SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
+ 'TBoolArray', Warn_AllVersions);
exit;
end;
SetLength(indexBool, 2); // There are 2 options in ancient spell book.
for i := 0 to 1 do
begin
cc := CountColorTolerance(16711422, MIX1+49+(i*36), MIY2-31,
MIX1+84+(i*36), MIY2-1, 1);
writeln(cc);
if (inRange(cc, 75, 78)) then
indexBool[i] := True;
if (not FilterOrder[i]) and indexBool[i] then
begin
MouseBox(MIX1+49+(i*36), MIY2-31, MIX1+69+(i*36), MIY2-1, mouse_left);
result := true;
end else
if FilterOrder[i] and (not indexBool[i]) then
begin
MouseBox(MIX1+49+(i*36), MIY2-31, MIX1+69+(i*36), MIY2-1, mouse_left);
result := true;
end;
end;
end;
end;
end;