Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Alch;
- {$DEFINE SMART}
- {$i SRL\SRL.scar}
- {$i Reflection\Reflection.Simba}
- {$i SRL\SRL\Misc\Stats.simba}
- const
- S_Mems = True; //Members?
- S_World = 38; //Smart world
- S_Signed = True; //Signed client?
- LogOnMod = False; //Log out upon seeing a mod? True = DO, False = DO NOT
- Stats_User = ''; //SRL Stats username
- Stats_Pass = ''; //SRL Stats password
- procedure DeclarePlayers;
- begin
- HowManyPlayers := 1;
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- with Players[0] do
- begin
- Name := ''; //RS Name
- Pass := ''; //RS Pass
- Integers[10] := 0; //Minutes to run, leave 0 to run forever
- Integers[11] := 2200; //Alchs to do, leave 0 to run forever
- Member := True; //Is the player a member?
- BoxRewards := ['XP', 'oins'] //Rewards box rewards
- Strings[0] := 'summoning'; //Lamp skill
- Arrays[0] := [17]; //Inv slots to alch (e.g. [5, 6, 17])
- Active := True; //Use?
- end;
- end;
- var
- StatsTimer, StartMark: Integer;
- const
- Alchs = 0;
- Levels = 1;
- LmpSkill = 0;
- procedure MouseOffScreen(MinimumWait, RandomWait: Integer);
- var
- Pt: TPoint;
- w, h: Integer;
- begin
- GetClientDimensions(w, h);
- Pt := Point(RandomRange(-w, 2 * w), RandomRange(-h, 2 * h));
- if ((Pt.x <= w) and (Pt.x >= 0)) and not((Pt.y <= 0) or (Pt.y >= 0)) then
- IncEx(Pt.x, w);
- MMouse(Pt.x, Pt.y, 0, 0);
- Wait(MinimumWait + Random(RandomWait));
- end;
- procedure AntiBan; //call after ~click item~
- begin
- case Random(99) of
- 1..5: MakeCompass(rs_GetCompassAngleDegrees - 4 + Random(8));
- 6: MouseOffScreen(10000, 15000);
- 11: HoverSkill(SKILL_MAGIC, False);
- end;
- GameTab(tab_Magic);
- end;
- function WaitTab(Tab, MaxTime: Integer): Boolean;
- var
- T: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- T := GetSystemTime + MaxTime;
- while (GetCurrentTab <> Tab) and (GetSystemTime <= T) do
- WaitNone;
- Result := (GetCurrentTab = Tab);
- end;
- function FixSpellBook: Boolean;
- var
- i: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- GameTab(tab_Magic);
- for i := 0 to 3 do
- if (GetColor(584 + (i * 21), 442) <> 16711422) then
- begin
- Mouse(584 + (i * 21), 442, 15, 15, True);
- Wait(600 + Random(400));
- end;
- if (GetColor(675, 442) <> 16711422) then
- begin
- Mouse(675, 442, 15, 15, True);
- Wait(600 + Random(400));
- end;
- if (GetColor(727, 223) <> 5729142) then
- begin
- DragMouse(722, 278, 9, 10, 721, 199, 9, 10);
- Wait(600 + Random(400));
- end;
- for i := 0 to 5 do
- begin
- if (i < 4) then
- if (GetColor(584 + (i * 21), 442) <> 16711422) then
- Exit;
- if (i = 4) then
- if (GetColor(675, 442) <> 16711422) then
- Writeln('bleh');
- if (i = 5) then
- if (GetColor(727, 223) = 5729142) then
- Result := True;
- end;
- end;
- function Alch: Boolean;
- var
- x, y: Integer;
- AlchPoint: TPoint;
- AlchBox: TBox;
- begin
- if not(LoggedIn) or (GetCurrentTab <> tab_Magic) then
- Exit;
- case Players[CurrentPlayer].Member of
- True:
- begin
- AlchPoint := Point(584, 374);
- AlchBox := IntToBox(564, 362, 585, 382);
- end;
- False:
- begin
- AlchPoint := Point(704, 350);
- AlchBox := IntToBox(683, 341, 707, 358);
- end;
- end;
- if (GetColor(AlchPoint.x, AlchPoint.y) <> 2082667) then
- if not(FixSpellBook) then
- Exit;
- GetMousePos(x, y);
- if PointInBox(Point(x, y), AlchBox) then
- begin
- Writeln('Mouse was in alch box, not moving');
- if (Random(99) <= 3) then //4% chance to move mouse in any direction
- MMouse(x - 1, y - 1, 2, 2);
- ClickMouse2(True);
- end else
- MouseBox(AlchBox.X1, AlchBox.Y1, AlchBox.X2, AlchBox.Y2, 1);
- Result := WaitTab(tab_Inv, 2000);
- end;
- function ClickItem: Boolean;
- var
- i, x, y: Integer;
- Box: TBox;
- begin
- if not(LoggedIn) then
- Exit;
- for i := 0 to High(Players[CurrentPlayer].Arrays[0]) do
- begin
- if not(ExistsItem(Players[CurrentPlayer].Arrays[0][i])) then
- Continue;
- Box := InvBox(Players[CurrentPlayer].Arrays[0][i]);
- GetMousePos(x, y);
- if (PointInBox(Point(x, y), Box)) then
- begin
- Writeln('mouse was already over item, not moving');
- if (Random(99) = 0) then
- MMouse(x - 1, y - 1, 2, 2);
- ClickMouse2(True);
- end else
- MouseBox(Box.X1, Box.Y1, Box.X2, Box.Y2, 1);
- Break;
- end;
- Result := WaitTab(tab_Magic, 2000);
- end;
- procedure SinglePlayerReport;
- begin
- Writeln('<! >-------------------------------------------------< !>');
- Writeln('<! > TomTuff''s Alcher < !>');
- Writeln('<! >-------------------------------------------------< !>');
- Writeln('<! > Time Running: ' + MsToTime(PlayerWorked(CurrentPlayer), Time_Abbrev));
- Writeln('<! > Alchs: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs]));
- Writeln('<! > Exp: ' + IntToStr(Players[CurrentPlayer].Integers[Alchs] * 65));
- if (Players[CurrentPlayer].Integers[Levels] > 0) then
- Writeln('<! > Levels: ' + IntToStr(Players[CurrentPlayer].Integers[Levels]));
- Writeln('<! >-------------------------------------------------< !>');
- end;
- procedure MultiPlayerReport;
- var
- i: Integer;
- begin
- Writeln('<! >-------------------------------------------------< !>');
- Writeln('<! > TomTuff''s Alcher < !>');
- Writeln('<! >-------------------------------------------------< !>');
- for i := 0 to High(Players) do
- begin
- Writeln('<! > Player ' + IntToStr(i));
- Writeln('<! > Time: ' + MsToTime(PlayerWorked(i), Time_Abbrev));
- Writeln('<! > Alchs: ' + IntToStr(Players[i].Integers[Alchs]));
- Writeln('<! > Exp: ' + IntToStr(Players[i].Integers[Alchs] * 65));
- if (Players[i].Integers[Levels] > 0) then
- Writeln('<! > Levels: ' + IntToStr(Players[CurrentPlayer].Integers[Levels]));
- Writeln('<! >-------------------------------------------------< !>');
- end;
- end;
- procedure Report;
- begin
- if (Length(Players) = 1) then
- SinglePlayerReport;
- if (Length(Players) > 1) then
- MultiplayerReport;
- end;
- procedure Commit;
- begin
- if (TimeFromMark(StatsTimer) < 300000) then
- Exit;
- stats_Commit;
- MarkTime(StatsTimer);
- end;
- function CheckSum: Boolean;
- begin
- if (Players[CurrentPlayer].Integers[10] > 0) then
- if (PlayerWorked(CurrentPlayer) > Players[CurrentPlayer].Integers[10]) then
- begin
- Result := True;
- Exit;
- end;
- if (Players[CurrentPlayer].Integers[11] > 0) then
- if (Players[CurrentPlayer].Integers[Alchs] > Players[CurrentPlayer].Integers[11]) then
- begin
- Result := True;
- Exit;
- end;
- end;
- procedure MainLoop;
- var
- Attempts: Integer;
- begin
- Smart_Members := S_Mems;
- Smart_Server := S_World;
- Smart_Signed := S_Signed;
- Smart_SuperDetail := False;
- SetupSRL;
- SetupSRLStats(37, Stats_User, Stats_Pass);
- DeclarePlayers;
- if LogOnMod = True then
- LogoutOnMod := False;
- MarkTime(StatsTimer);
- while not(LoggedIn) do
- LogInPlayer;
- MarkTime(StartMark);
- repeat
- GameTab(tab_Magic);
- SetAngle(True);
- LampSkill := Players[CurrentPlayer].Strings[LmpSkill];
- repeat
- if Alch then
- begin
- Wait(800 + Random(200));
- //GameTab(tab_Inv);
- if ClickItem then
- begin
- stats_IncVariable('High Level Alchs', 1);
- stats_IncVariable('Total EXP Gained', 65);
- Inc(Players[CurrentPlayer].Integers[Alchs]);
- Wait(800 + Random(200));
- if LevelUp then
- begin
- stats_IncVariable('Total Levels Gained', 1);
- Inc(Players[CurrentPlayer].Integers[Levels]);
- end;
- AntiBan;
- R_FindRandoms;
- Attempts := 0;
- end else Inc(Attempts);
- end else Inc(Attempts);
- Report;
- Commit;
- //if (Attempts > 50) then
- //Logout;
- until(CheckSum or not(LoggedIn));
- Report;
- Commit;
- NextPlayer(False);
- until(AllPlayersInactive);
- Report;
- end;
- begin
- MainLoop;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement