SRL Archive - RS has been updated.

New XPBar Functions


Brandon

2012-01-16 23:10:43

Feel Free To Modify Them to make it suitable for an include or however you plan to use them IF you do. They work as is. Tested a ton of times already.


(*
Returns True if the XPBar Setup Dialog is on Screen..
*)
Function IsXPSetup: Boolean;
var
ResetText, X, Y: Integer;
ACC: Extended;
begin
ResetText := BitmapFromString(49, 10, 'meJyVlOsNwzAIhDMIluz9V+gw/d' +
'8lik1zugBGLooih/D4ODsZY1prbZTWliES8e7RpdQ1Yb331P96f3A' +
'VSIcd221ptVghUmmiBly37agKkh2wltKC54otvJklMnkM1abTR9S0' +
'Kx0c61Tk2umKwKkwNojiAAlgFgPp7JXFswhYRJHZbwWxHW4cNHoi+' +
'b0oujs8LJAV+Z1ucRyLkbuCsimS3pkqNmKk6HRZKdL1tBgzMVZlU8' +
'mEYkkPu/+FxEcoRQIVHzxWHseb8VLxebP4o9sdb84VkR/S2ru+2Jy' +
'e+Bc5p91dME+BXjAOcwVj/BcJeGZ4');

Result:= FindDeformedBitmapToleranceIn(ResetText, X, Y, 332, 177, 384, 190, 10, 0, true, Acc);
FreeBitmap(ResetText);
end;


(*
Returns True if the XPBar Setup-Counter is the Current one.
Exits if XPBarSetup Dialog is not open.
*)
Function XPBarSetupCounter(Which: Integer): Boolean;
var
Counter, X, Y: Integer;
CB: TBox;
Acc: Extended;

begin
if (Not IsXPSetup) then
begin
srl_Warn('XPBarSetupCounter', 'XPBarSetup Is Not Open', warn_Warning);
exit;
end;
if (Which > 3) then
begin
srl_Warn('XPBarSetupCounter', 'Which (CounterTab) Cannot be greater than 3', warn_Warning);
exit;
end;
Counter := BitmapFromString(49, 10, 'meJyVlOsNwzAIhDMIluz9V+gw/d' +
'8lik1zugBGLooih/D4ODsZY1prbZTWliES8e7RpdQ1Yb331P96f3A' +
'VSIcd221ptVghUmmiBly37agKkh2wltKC54otvJklMnkM1abTR9S0' +
'Kx0c61Tk2umKwKkwNojiAAlgFgPp7JXFswhYRJHZbwWxHW4cNHoi+' +
'b0oujs8LJAV+Z1ucRyLkbuCsimS3pkqNmKk6HRZKdL1tBgzMVZlU8' +
'mEYkkPu/+FxEcoRQIVHzxWHseb8VLxebP4o9sdb84VkR/S2ru+2Jy' +
'e+Bc5p91dME+BXjAOcwVj/BcJeGZ4');

Case Which Of
1:
CB:= IntToBox(234, 19, 298, 36);

2:
CB:= IntToBox(334, 19, 398, 36);

3:
CB:= IntToBox(434, 19, 498, 36);
end;

Result:= FindDeformedBitmapToleranceIn(Counter, X, Y, CB.X1, CB.Y1, CB.X2, CB.Y2, 10, 0, true, Acc);
FreeBitmap(Counter);

if Result then
begin
MouseBox(CB.X1, CB.Y1, CB.X2, CB.Y2, MOUSE_LEFT);
Result:= WaitUptext('ounter-'+ToStr(Which), 500);
end;
end;

(*
Enables the XPBar Counter and Returns True if the XPBar Counter is Enabled.
Exits if XPBarSetup Dialog is not open.
*)
Function EnableXPBarCounter(Enable: Boolean): Boolean;
var
CheckBox, X, Y: Integer;
Acc: Extended;
begin
if (Not IsXPSetup) then
begin
srl_Warn('EnableXPBarCounter', 'XPBar Setup Dialog is Not Open', warn_Warning);
exit;
end;
CheckBox := BitmapFromString(14, 14, 'meJxj5BBgJBpx+y3gz7yBBwEVQF' +
'QC2Tx8gsiIT0AYGQEVoKlEU4BLJURQUEgUgoREJeAIUyWmGjwq4bI' +
'iEtJwhKwSYjVWZXhUoikbPCqJj00iEQASk1Sx');

if IsXPSetup then
begin
Result:= Not FindDeformedBitmapToleranceIn(CheckBox, X, Y, 237, 48, 257, 69, 10, 0, false, ACC);

if (Enable xor Result) then
begin
MouseBox(237, 48, 257, 69, MOUSE_LEFT);
MMouse(250 + random(10), 48 + random(10), 0, 0);
Result:= Enable and FindDeformedBitmapToleranceIn(CheckBox, X, Y, 237, 48, 257, 69, 10, 0, false, ACC);
end;
FreeBitmap(CheckBox);
end;
end;

(*
Sets the *Current Counter Tab* To track a specified Skill and Returns true if Tracking is successful.
Exits if XPBarSetup Dialog is not open.

Notes: Use XPBarCounter(Which: Integer): Boolean; To specify which Tab to enable the tracking on!
*)
Function TrackXPSkill(Which: Integer): Boolean;
var
SkBox, OutlineBox: TBox;
Skill: TPoint;
Outline, X, Y, Tries: Integer;
Acc: Extended;
begin
if (Not IsXPSetup) then
begin
srl_Warn('TrackXPSkill', 'XPBarSetup Is Not Open', warn_Warning);
exit;
end;
if (Which > 27) then
begin
srl_Warn('TrackXPSkill', 'Which (Skills) Cannot be greater than 27', warn_Warning);
exit;
end;

Outline := BitmapFromString(27, 27, 'meJzjz7zBT23EQD0wauCogaMGjh' + 'o4auCogaMGDjYDqYsALAyIgQ==');
Case Which Of
1: Skill:= Point(250, 93); //Attack
2: Skill:= Point(278, 93); //Strength
3: Skill:= Point(306, 93); //Defence
4: Skill:= Point(340, 93); //Range
5: Skill:= Point(368, 93); //Magic
6: Skill:= Point(397, 93); //Constitution/HP
7: Skill:= Point(427, 93); //Prayer
8: Skill:= Point(457, 93); //Agility
9: Skill:= Point(487, 93); //Herblore
10: Skill:= Point(250, 123); //Thieving
11: Skill:= Point(278, 123); //Crafting
12: Skill:= Point(306, 123); //Fletching
13: Skill:= Point(340, 123); //Mining
14: Skill:= Point(368, 123); //Smithing
15: Skill:= Point(397, 123); //Fishing
16: Skill:= Point(427, 123); //Cooking
17: Skill:= Point(457, 123); //Fire-Making
18: Skill:= Point(487, 123); //WoodCutting
19: Skill:= Point(250, 153); //RuneCrafting
20: Skill:= Point(278, 153); //Slayer
21: Skill:= Point(306, 153); //Farming
22: Skill:= Point(340, 153); //Construction
23: Skill:= Point(368, 153); //Hunting
24: Skill:= Point(397, 153); //Summoning
25: Skill:= Point(427, 153); //Dungeoneering
26: Skill:= Point(457, 153); //All-Combat
27: Skill:= Point(487, 153); //Every-Skill
end;

SkBox:= IntToBox(Skill.X - 5, Skill.Y - 5, Skill.X + 5, Skill.Y + 5); //Skill Boxes are 27 x 27 Pixels.
MouseBox(SkBox.X1, SkBox.Y1, SkBox.X2, SkBox.Y2, MOUSE_LEFT);
OutLineBox:= IntToBox(X, Y, X + 27, X + 27);
Tries:= 0;

while (Not PointInBox(Skill, OutLineBox)) do
begin
wait(250);
FindDeformedBitmapToleranceIn(Outline, X, Y, 231, 75, 508, 173, 10, 0, False, Acc);
OutLineBox:= IntToBox(X, Y, X + 27, X + 27);
Inc(Tries);
if (Tries > 20) then //5 Seconds At most..
break;
end;

FreeBitmap(Outline);
Result:= PointInBox(Skill, OutLineBox);
end;

[XoL]

2012-01-17 00:09:07

Thanks! Needed this :)

NEWTOSIMBA

2012-01-30 16:36:04

Where do I put this code?

Thanks

Brandon

2012-01-30 16:57:04

It would usually go in GameTab.Simba but it doesn't seem like anyone uses it so meh.. Up to the user to add it if they like and if it works for them.

Narcle

2012-01-30 17:08:21

http://villavu.com/forum/showthread.php?t=72574

I just never got any feedback =/