PDA

View Full Version : SetCombatExperience



The Mayor
07-04-2013, 07:21 AM
This will select an experience type (e.g. Controlled (shared), Attack, Strength, Defence, Magic, & Ranged) for a combat style (e.g. Melee, Magic, & Ranged). SetFightMode has long been outdated.

For example: SetCombatExperience(1, 3) will set the Melee combat style to Strength xp.


It doesn't allow mismatches (such as Attack xp with Magic) and will terminate.


Also, this snippet will toggle the XP screen.

For example: ToggleXPScreen(True) will open it and ToggleXPScreen(False) will close it.


(*

ToggleXPScreen
~~~~~~~~~~~~

Function ToggleXPScreen(Open: Boolean): Boolean;


Opens or closes the XP Screen from the combat tab. Returns false if failed

by The Mayor

Example: If ToggleXPScreen(True) Then
Begin
SetCombatExperience(1, 1);
ToggleXPScreen(False);
End;
*)
Function ToggleXPScreen(Open: Boolean): Boolean;

Var
x, y, T: Integer;
Begin
If Not(BankScreen) Then
If Not FTab(tab_Combat) Then Exit;
If Open Then
Begin
Result := FindColorTolerance(x, y, 2929149, 722, 210, 729, 217, 2)
If Result Then Exit;
Mousebox(704, 437, 718, 451, mouse_Left);
T := GetSystemTime + 750;
Repeat
Wait(1);
Until Result Or (GetSystemTime > T);
End Else
If FindColorTolerance(x, y, 2929149, 722, 210, 729, 217, 2) Then
Begin
MouseBox(723, 209, 729, 216, mouse_Left);
T := GetSystemTime + 750;
Repeat
Wait(1);
Result := FindColorTolerance(x, y, 4766432, 700, 437, 720, 448, 2)
Until Result Or (GetSystemTime > T)
End Else
Result := True;
End;




(*

SetCombatExperience
~~~~~~~~~~~~

function SetCombatExperience(CombatType, ExperienceType: Integer): Boolean;


Sets experience type for a combat style. Returns false if failed.

CombatType:
(1 = Melee, 2 = Magic, 3 = Ranged)

ExperienceType:
(1 = Controlled, 2 = Attack, 3 = Strength, 4 = Defence, 5 = Magic, 6 = Ranged)

be The Mayor

Example: SetCombatExperience(3, 4) would set Defence xp with Ranged.

*)

Function SetCombatExperience(CombatType, ExperienceType: Integer): Boolean;

Var
i, ii, x, y: Integer;
c, e: TBox;
CombatBoxes, ExperienceBoxes: TBoxArray;

Begin
If ((CombatType = 1) And (ExperienceType > 4)) Or (((CombatType = 2) Or
(CombatType = 3)) And ((ExperienceType = 2) Or (ExperienceType = 3))) Then
RaiseException(erCustomError, 'Invalid experience type selected');

If Not Loggedin Then Exit;

GameTab(tab_Combat);
Wait(500 + Random(100));

ToggleXPScreen(True);

CombatBoxes := [IntToBox(570, 240, 600, 278), IntToBox(620, 240, 662, 278),
IntToBox(675, 240, 718, 278)];

ExperienceBoxes := [IntToBox(580, 305, 705, 320), IntToBox(580, 345, 705, 360),
IntToBox(580, 385, 705, 400), IntToBox(580, 425, 705, 440),
IntToBox(580, 325, 705, 335), IntToBox(580, 360, 705, 375),
IntToBox(580, 400, 705, 415)];

c := CombatBoxes[CombatType - 1];
e := ExperienceBoxes[ExperienceType - 1];

If ((CombatType = 2) Or (CombatType = 3)) And (ExperienceType = 1) Then
e := ExperienceBoxes[4];
If ((CombatType = 2) Or (CombatType = 3)) And (ExperienceType = 4) Then
e := ExperienceBoxes[6];
If ((ExperienceType = 5) Or (ExperienceType = 6)) Then
e := ExperienceBoxes[5];

i := 0;
While (i < 4) Do
Begin
If FindColorTolerance(x, y, 3091749, c.x1, c.y1, c.x2, c.y2, 0) Then
Break;
MouseBox(c.x1, c.y1, c.x2, c.y2, mouse_Left);
Wait(800 + Random(400));
Inc(i);
End;

ii := 0;
While (ii < 4) Do
Begin
Result := FindColorTolerance(x, y, 3328050, e.x1, e.y1, e.x2, e.y2, 1);
If Result Then
Break;
MouseBox(e.x1, e.y1, e.x2, e.y2, mouse_Left);
SmallRandomMouse;
Wait(800 + Random(400));
Inc(ii);
End;
End;

StickToTheScript
07-04-2013, 11:50 PM
Beautiful! Nice job Mayor!

The Mayor
07-14-2013, 03:07 AM
Updated OP with ToggleXPScreen.