Simba Code:
Const
CountTab_X1 = 263;
CountTab_X2 = 364;
CountTab_X3 = 463;
Function GetXPCountTab: integer;//Returns current Counter tab showing (0 if its not up)
var
TPA: TPointArray;
T: TPoint;
begin
FindColors(TPA, 1010136, 234, 10, 503, 44);
If not InRange(Length(TPA), 169, 170) then
Exit;
T := MiddleTPA(TPA);
Case T.x of
CountTab_X1-1..CountTab_X1+1: Result := 1;
CountTab_X2-1..CountTab_X2+1: Result := 2;
CountTab_X3-1..CountTab_X3+1: Result := 3;
end;
end;
Function SwitchXPCountTab(CounterNum: Integer): Boolean;//Switch to counter tab 1,2 or 3
var
X, T: integer;
begin
if CounterNum = GetXPCountTab then
begin
Result := True;
Exit;
end;
Case CounterNum of
1: X := CountTab_X1;
2: X := CountTab_X2;
3: X := CountTab_X3;
else
srl_Warn('SwitchXPCountTab', 'Counter number must be 1, 2 or 3', warn_AllVersions);
end;
MouseBox(X-26, 25, X+26, 32, mouse_Left);
T := GetSystemTime + 1500;
repeat
Result := GetXPCountTab = CounterNum;
Wait(10+random(10));
until Result or (GetSystemTime > T);
end;
Function CloseXPCountSetup: Boolean;//Close the XP counter menu
begin
if InRange(GetXPCountTab, 1, 3) then
MouseBox(501, 11, 507, 17, mouse_Left);
Result := not InRange(GetXPCountTab, 1, 3);
end;
Function OpenXPCountSetup(CounterNum: Integer): Boolean;//Open the counter setup menu 1, 2 or 3
var
TPA: TPointArray;
P: TPoint;
T: Integer;
begin
if not InRange(GetXPCountTab, 1, 3) then
begin
TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
P := TPA[Random(Length(TPA))];
Mouse(P.X, P.Y, 0, 0, mouse_right);
if WaitOptionMulti(['Set', 'etu', 'tup'], 1000) then
begin
T := GetSystemTime + 1500;
repeat
Wait(10+random(10));
if (GetSystemTime > T) then
Exit;
until InRange(GetXPCountTab, 1, 3);
end;
end;
Result := SwitchXPCountTab(CounterNum);
end;
Function ResetXPCount(CounterNum: Integer): Boolean;//Reset XP counter #
begin
if OpenXPCountSetup(CounterNum) then
begin
MouseBox(305, 181, 428, 188, mouse_Left);
Result := True;
end;
end;
Function XPCountSkillCoords(Row, Column: integer): TPoint;//for Coords
begin
Result := Point(220+Row*30, 49+Column*30);
end;
function XPCountSkillToCoords(Skill: Variant): TPoint;//Returns x, y coords of skill
var
SkillArr: TStringArray;
skNo: Integer;
SkillS: string;
SkillPT : TPoint; //Row/Column
begin
if (not LoggedIn) then exit;
if ((VarType(Skill) = varInteger) or (VarType(Skill) = varByte)) then
skNo := Skill
else
begin;
SkillS := Lowercase(Skill);
case Lowercase(SkillS) of
'hp', 'constitution': SkillS := 'hitpoints';
'ranged': SkillS := 'range';
'hunter': SkillS := 'hunting';
'dung' : skillS := 'dungeoneering';
'all skills', 'every': SkillS := 'every skill';
'all combat': SkillS := 'combat';
end;
SkillArr := ['attack', 'defence', 'strength', 'hitpoints', 'range',
'prayer', 'magic', 'cooking', 'woodcutting', 'fletching',
'fishing', 'firemaking', 'crafting', 'smithing', 'mining',
'herblore', 'agility', 'thieving', 'slayer', 'farming',
'runecrafting', 'hunting', 'construction', 'summoning',
'dungeoneering', 'combat', 'every skill'];
if (not InStrArrEx(SkillS, SkillArr, skNo)) then
begin
srl_Warn('SkillToCoords',
'Invalid Skill Name/Number: ''' + string(Skill) + '''',
warn_AllVersions);
Exit;
end;
end;
case skNo of
Skill_Attack : SkillPT := Point(1,1);
Skill_Strength : SkillPT := Point(1,2);
Skill_Defence : SkillPT := Point(1,3);
Skill_Range : SkillPT := Point(1,4);
Skill_Magic : SkillPT := Point(1,5);
Skill_Hitpoints : SkillPT := Point(1,6);
Skill_Prayer : SkillPT := Point(1,7);
Skill_Agility : SkillPT := Point(1,8);
Skill_Herblore : SkillPT := Point(1,9);
Skill_Thieving : SkillPT := Point(2,1);
Skill_Crafting : SkillPT := Point(2,2);
Skill_Fletching : SkillPT := Point(2,3);
Skill_Mining : SkillPT := Point(2,4);
Skill_Smithing : SkillPT := Point(2,5);
Skill_Fishing : SkillPT := Point(2,6);
Skill_Cooking : SkillPT := Point(2,7);
Skill_FireMaking : SkillPT := Point(2,8);
Skill_WoodCutting : SkillPT := Point(2,9);
Skill_RuneCrafting : SkillPT := Point(3,1);
Skill_Slayer : SkillPT := Point(3,2);
Skill_Farming : SkillPT := Point(3,3);
Skill_Construction : SkillPT := Point(3,4);
Skill_Hunter : SkillPT := Point(3,5);
Skill_Summoning : SkillPT := Point(3,6);
Skill_Dungeoneering : SkillPT := Point(3,7);
{SKILL_ALLCOMBAT} 25 : SkillPT := Point(3,8);
{SKILL_EVERYSKILL} 26 : SkillPT := Point(3,9);
else
begin
srl_Warn('XPCountSkillCoords', 'Invalid Skill Number: ''' + inttostr(skNo) + '''', warn_AllVersions);
exit;
end;
end;
Result := XPCountSkillCoords(SkillPT.y,SkillPT.x);
end;
Function XPCountSwitchSkill(Skill: Variant; CounterNum: Integer): Boolean;//Switch which counter to track which skill?
var
T: TPoint;
C, x, y: Integer;
begin
T := XPCountSkillToCoords(Skill);
if OpenXPCountSetup(CounterNum) then
if FindColor(x, y, 1010136, T.x, T.y, T.x, T.y+1) then
Result := True;
if not Result then
begin
C := GetSystemTime + 1500;
MouseBox(T.x-8, T.y+4, T.x+8, T.y+24, mouse_Left);
Repeat
Result := FindColor(x, y, 1010136, T.x, T.y, T.x, T.y+1);
until Result or (GetSystemTime > C);
end;
end;
Function ToggleXPCountBar(Enable: Boolean; CounterNum: integer): Boolean;//Turn counter # on or off
var
x, y, T: integer;
CheckBox: TBox;
begin
CheckBox := IntToBox(243, 55, 250, 62);
with CheckBox do
if OpenXPCountSetup(CounterNum) then
begin
if Enable xor FindColorTolerance(x, y, 3912952, x1, y1, x2, y2, 0) then
MouseBox(x1, y1, x2, y2, mouse_Left);
T := GetSystemTime + 1500;
repeat
Result := Enable = FindColorTolerance(x, y, 3912952, x1, y1, x2, y2, 0);
wait(10+random(10));
until Result or (GetSystemTime > T);
end;
end;