Twh
2012-11-05 15:38:43
How Long have You Played Runescape?
1 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
PHP, some Java, Pascal, learning C++
Are you a member of any other communities?
Not particularly active in any, I'm a member on Powerbot.org but don't post, aside from that I tend to browse 4chan.org
Tell us about yourself…
Please show us one (or multiple) of your scripts.
1 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
PHP, some Java, Pascal, learning C++
Are you a member of any other communities?
Not particularly active in any, I'm a member on Powerbot.org but don't post, aside from that I tend to browse 4chan.org
Tell us about yourself…
From: Twh
I'm 18 years old, currently 4th-grader in a Slovakian high school. My primary interests are computers and electronics, although I'm currently planning on a medical career, I do enjoy pursuing them as a hobby.
Please show us one (or multiple) of your scripts.
{ First some description: although it's not made entirely from scratch - I started off modifying Ashaman's tab
maker - practically everything was done by me, aside from the few functions and
one DTM I've left in the script, but most of those functions aren't essential, they
just enhance it - for instance, HumanMMouse.
My goal was improving upon Ashaman's tab maker, and to my knowledge I've
managed to pull that off - the script makes about 850 tabs/h, and has the
ability to resurrect itself in case of a malfunction.
It's not perfect, it still seems to have a few bugs (especially the progress
report), sometimes the colors of RS decide to go outside the tolerance limits
of the script, but I've managed to run it for past 6 hours plenty of times.
Currently, to have it run properly, you need to have your home in Relekka, use
the regular butler (more profit, it's pointless to use the demon), use the
basic wooden POH style, you should have your house tabs in the top left
inventory slot, you must have a Posh bell-pull in your dining room, and the house layout should look like this:
[url]https://dl.dropbox.com/u/14295485/tabmaker_setup.png[/url]
}
Program TabMaker;
{$Define SMART}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I SRL\SRL\Misc\SmartGraphics.simba}
{
Changelog:
V1.1 - Further fixes improving stability, especially at the EnterPOH -> Loop transition
- Separated the FindButler function, more failsafes
V1.0 - Switched Portal and Lectern DTM detection to TPA Middle with ColorsSpiralTolerance
- Fixed an issue which caused missclicks at the lectern
- Fixed Paying Butler on EnterPOH
- Changed the SmartParams file according to [url]http://villavu.com/forum/showthread.php?t=88547&highlight=sixhourfix[/url]
- Added changelog until I make a thread
}
Const
TabType = ''; // ***What kind of tab are you making? (house, varrock, BTP)
LoopMax = 100; // Maximum amount of loops to complete, 1 loop = 20 tabs
BID = 1; // ID number for the bot you're running to make sense of the progress reports if multiing
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True; //Just leave it at True unless multiing
Players[0].WorldInfo := [true, 5]; //Change the number to select a world, comment the line to disable
End;
Var
x, y, x1, y1, T, Ts, Tp, Tstor, loopc, ResetCount, i, loop, TabCount,
BreakAt, TabX1, TabY1, POHCenter, LecternLoc, ClayDTM,
RunTimer, Tabs, TabsC, TabTimer, TabsStor, ID: Integer;
TabsPH: Extended;
LecternTP : TPoint;
Procedure SetDTM;
Begin
ClayDTM := DTMFromString('mggAAAHicY2NgYGBlQABOIBYEYnYoZgFiHiDmQ1IXYsvD4GvBzRDvyssQ4cDDYKPNwWCny8nABZTDhhlxYAgAABXfA/4=');
POHCenter := DTMFromString('mggAAAHicY2NgYLBnZWAwAGJdIA4F4ggg1gbiqYwMDBOAeBUQTwLiFUC8HYgTO/UY/J1tGAqSQhkSQ7zAdFqEL4Mc0CwRLJgRB4YAAMuRDCU=');
LecternLoc := DTMFromString('mlwAAAHicY2dgYJjFxMAwCYj7gLgViFuAeDoQlwNxE1C+EYinAnEfEHcBcS0UZ8cFMRQlh4PxGwZWFMwPlMeFGfFgKAAA6r0POA==');
End;
Procedure Fr33DTM;
Begin
FreeDTM(ClayDTM);
FreeDTM(POHCenter);
FreeDTM(LecternLoc);
End;
{*******************************************************************************
All of these mouse movements are credited to bandland100 and flight
*******************************************************************************}
//By Bandland100, modified to shift mouse speeds after every step
procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
lastX,lastY,MSP,W: integer;
sqrt2,sqrt3,sqrt5: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
case Random(50) of
1..25: W := (MSP + (Random((MSP/4))));
26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
end;
if (W < 1) then
W := 1;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
// SMART_DrawDotsEx(False, [Point(lastX, lastY)], 65280);
step:= hypot(xs - lastX, ys - lastY);
//W := round((maxWait - minWait) * (step / maxStep) + minWait);
wait(W);
lastdist:= dist;
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
MouseSpeed := MSP;
end;
Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,j,Dist,MP: integer;
begin
j := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(j*MP), eX+(j*MP));
Y2 := RandomRange(eY-(j*MP), eY+(j*MP));
SuperWindMouse(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := j;
end;
(*
MmmWeGotOff
~~~~~~~~
.. code-block:: pascal
Procedure MmmWeGotOff(RedTu: Variant);
Moves the mouse to the choosen side of the screen, replicating
the use of a human to move thier mouse "off-screen" as if
browsing another part of their computer.
(What do you do when you browsing "other websites?")
Int Type:
1 = Go top side, off-screen
2 = Go bottom side, off-screen
3 = Go left side, off-screen
4 = Go right side, off-screen
.. note::
by Le Jingle.
Example:
.. code-block:: pascal
MmmWeGotOff(Random(4), 0, 0);
*)
Procedure OffMM(RedTu, LeWait, rWait: Integer);
Var
W,H,RX,RY,T,RT,X,Y: Integer;
Begin
GetMousePos(X,Y);
If (X>0) And (Y>0) Then
Begin
GetClientDimensions(W,H);
H:=H+50;
RX := RandomRange(0, W);
RY := RandomRange(0, H);
Case (RedTu) Of
0..1: HumanMMouse(W/2, RandomRange(-110,-60), RX, 0);
2: HumanMMouse(RandomRange(-50,-10), H/2, 0, RY);
3: HumanMMouse(W/2, h+RandomRange(10,50), RX, 0);
4: HumanMMouse(W+RandomRange(10,50), H/2, 0, RY);
End;
End;
RT:=(Random(rWait));
MarkTime(T);
Repeat
Wait(Random(200));
Until TimeFromMark(T)>(LeWait+RT);
End;
{
Reports progress - time running and tab stats.
Uses an ID set in constants for identification
Mostly by Twh
}
Procedure ProgressReport;
Begin
SMART_ClearCanvas;
TabsC := GetAmount(580, 230);
TabCount := TabsC - Tabs;
TabsPH := Round((TabCount * (3600.0 / (TimeFromMark(TabTimer) / 1000.0))));
Writeln(' - - - - BOT ID ' + IntToStr(BID) + '- - - - -');
Writeln('Time Running: ' + TimeRunning);
Writeln('Tabs Made: ' + IntToStr(TabCount));
Writeln('Tabs/H: ' + ToStr(TabsPH));
Writeln('=================================');
End;
{
Pays the butler, terminates if fails
by Twh
}
function PayButler : Boolean;
Begin
Wait(400 + Random(250));
SendKeys(' ',50,50);
MarkTime(T);
repeat wait(500)
until FindNPCChatTextMulti(['1.','servant'],nothing) or (TimeFromMark(T) > 7000);
if(TimeFromMark(T) > 7000) then Exit;
SendKeys('1',50,50);
Wait(2000 + Random(800));
if FindNPCChatTextMulti(['Than','hank'], nothing) then
Begin
Writeln('Successfully paid the butler');
Result := True;
end else
begin
Writeln('Couldnt pay the butler - out of money?');
Result := False;
End;
End;
{
Attempts to locate the lectern using CTS2 and TPA.
by Twh
}
function LocateLectern(Rewrite, Click:Boolean):Boolean;
var
tmpCTS : Integer;
LecternTPA : TPointArray;
begin
Result := True;
if(Rewrite = False) then
begin
if(LecternTP.x = 0) then
begin
tmpCTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.06);
FindColorsSpiralTolerance(285, 200, LecternTPA, 1743296, 150, 90, 380, 290, 20);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(High(LecternTPA) = 0) then
begin
writeln('Couldnt find the lectern, waiting');
ClickNorth(SRL_ANGLE_HIGH);
Wait(25000 + Random(2000));
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.06);
FindColorsSpiralTolerance(285, 200, LecternTPA, 1743296, 150, 90, 380, 290, 20);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(High(LecternTPA) = 0) then
begin
Writeln('Still couldnt find the lectern');
Result := False;
Exit;
End;
End;
LecternTP := MiddleTPA(LecternTPA);
End;
End else
begin
tmpCTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.06);
FindColorsSpiralTolerance(285, 200, LecternTPA, 1743296, 150, 90, 380, 290, 20);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(High(LecternTPA) = 0) then
begin
writeln('Couldnt find the lectern, waiting');
ClickNorth(SRL_ANGLE_HIGH);
Wait(25000 + Random(2000));
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.06);
FindColorsSpiralTolerance(285, 200, LecternTPA, 1743296, 150, 90, 380, 290, 20);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if(High(LecternTPA) = 0) then
begin
Writeln('Still couldnt find the lectern');
Result:=False;
Exit;
End;
End;
LecternTP := MiddleTPA(LecternTPA);
Writeln('Assigned new coordinates: ' + IntToStr(LecternTP.x) + IntToStr(LecternTP.y));
End;
if(Click = True) then
begin
HumanMMouse(LecternTP.x, LecternTP.y, 4, 4);
Wait(400 + Random(300));
End;
End;
function FindButler : Boolean;
var
tmpCTS:Integer;
Begin
tmpCTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.32, 1.30);
MarkTime(Ts);
repeat wait(500)
until FindColorTolerance(x, y, 1055559, 200, 120, 300, 210, 11) or (TimeFromMark(Ts) > 10000);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
if (TimeFromMark(Ts) < 10000) then Result := True
else
Result := False;
End;
{
Enters POH, sets up the script
by Twh
}
Procedure EnterPOH;
var
PortalTPA : TPointArray;
PortalTP : TPoint;
Begin
ExitSquealOfFortune;
Wait(1500);
if not(FindDTM(POHCenter, x1, y1, MMX1, MMY1, MMX2, MMY2)) then
begin
FindColorsSpiralTolerance(MSCX, 215, PortalTPA, 11052192, 120, 130, 400, MSY2, 10);
if(High(PortalTPA) > 20) then
begin
PortalTP := MiddleTPA(PortalTPA);
HumanMMouse(PortalTP.x, PortalTP.y, 5, 5);
ClickMouse2(True);
HumanMMouse(256, 413, 20, 5);
MarkTime(T);
repeat Wait(400)
until FindColorTolerance(x,y,2827290,148, 405, 158, 418,10) or (TimeFromMark(T) > 10000);
if(TimeFromMark(T) > 10000) then Exit;
ClickMouse2(True);
MarkTime(T);
repeat Wait(400)
until FindDTM(POHCenter,x1, y1, 600, 60, 655, 130) or (TimeFromMark(T) > 20000);
if(TimeFromMark(T) > 20000) then Exit;
Writeln('Inside the POH');
End else writeln('Couldnt find portal');
End else
begin
HumanMMouse(x1, y1, 1, 1);
ClickMouse2(True);
Wait(9000 + Random(2000));
MarkTime(T);
repeat Wait(400)
until FindDTM(POHCenter,x1, y1, 600, 60, 655, 130) or (TimeFromMark(T) > 20000);
End;
MMouse(x1 - 20 , y1 + 38, 3, 2); // 628 135 602 171 569 169
Wait(800);
ClickMouse2(True);
Wait(10000);
if (FindColorTolerance(x, y, 2080734, 200, 90, 400, 250, 10)) then
begin
HumanMMouse(x, y, 2, 2);
if not(WaitUpTextMulti(['Ring','Posh','bell','pull'],5000)) then Exit;
// Writeln('Found bell');
ClickMouse2(True);
MarkTime(T);
repeat wait(400)
until FindColorSpiralTolerance(x, y, 1137203, 230, 460, 250, 475, 15) or (TimeFromMark(T) > 10000);
HumanMMouse(x, y, 4, 3);
Wait(2000 + Random(1000));
MarkTime(T);
repeat wait(400)
until FindNPCChatTextMulti(['You', 'rang', '500','pay ', 'noti', 'fee'],nothing) or (TimeFromMark(T) > 10000);
If (FindNPCChatTextMulti(['500','pay ', 'noti', 'fee'],nothing)) then
begin
if (PayButler) then
begin
FindColorTolerance(x, y, 2080734, 200, 90, 400, 250, 10);
HumanMMouse(x, y, 1, 1);
ClickMouse2(True);
MarkTime(T);
repeat wait(400)
until FindNPCChatTextMulti(['You', 'rang'],nothing) or (TimeFromMark(T) > 10000);
End else Exit;
End;
Wait(250 + Random(250));
SendKeys(' ',50,50);
MarkTime(T);
repeat wait(400)
until FindNPCChatText('Go',clickleft) or (TimeFromMark(T) > 10000);
MarkTime(T);
repeat wait(400)
until FindNPCChatText('Bri',clickleft) or (TimeFromMark(T) > 10000);
MarkTime(T);
repeat wait(400)
until FindNPCChatText('Mor',clickleft) or (TimeFromMark(T) > 10000);
MarkTime(T);
repeat wait(400)
until FindNPCChatText('Sof',clickleft) or (TimeFromMark(T) > 10000);
MarkTime(T);
Wait(2000 + Random(400));
TypeSend('20');
if FindDTM(LecternLoc,x,y,MMX1, MMY1, MMX2, MMY2) then
Begin
// Writeln('Found lectern location');
HumanMMouse(x, y + 1, 2, 2);
ClickMouse2(True);
Wait(9000);
LocateLectern(True, False);
// writeln('Found lectern');
HumanMMouse(LecternTP.x, LecternTP.y, 4, 4);
Wait(500 + Random(350));
ClickMouse2(False);
ChooseOptionEx('Study','action');
MarkTime(T);
repeat wait(400)
until FindNPCChatTextMulti(['Your','good'],nothing) or (TimeFromMark(T) > 4000);
if(TimeFromMark(T) > 4000) then
begin
Writeln('Failed at first wait');
if not(FindButler) then
begin
HumanMMouse(TabX1, TabY1, 8, 8);
if (WaitUpTextMulti(['ake','tab','let'], 6000)) then
begin
ClickMouse2(True);
MarkTime(T);
repeat wait(1000)
until FindButler or (TimeFromMark(T) > 10000);
if (TimeFromMark(T) > 10000) then
begin
Writeln('Failed to find the butler @ EnterPOH');
Exit;
End;
End;
HumanMMouse(x, y, 1, 1);
Wait(400 + Random(300));
ClickMouse2(True);
MarkTime(T);
repeat wait(400)
until FindNPCChatTextMulti(['Your','good','hold','500','fee'],nothing) or (TimeFromMark(T) > 15000);
if(FindNPCChatTextMulti(['500','fee'], nothing)) then
begin
if(PayButler) then
begin
HumanMMouse(x, y, 1, 1);
Wait(400 + Random(300));
ClickMouse2(True);
MarkTime(T);
repeat wait(400)
until FindNPCChatTextMulti(['Your','good','hold'],nothing) or (TimeFromMark(T) > 15000);
End else writeln('Couldnt pay the butler');
End;
End;
End;
End else Writeln('Couldnt find lectern location');
End else writeln('Couldnt find bell');
Writeln('Setup finished.');
MarkTime(TabTimer);
LecternTP.x := 0;
End;
{
Attempts to resurrect the script
by Twh
}
procedure RestartScript;
Begin
ResetCount := ResetCount + 1;
if(ResetCount > 4) then
begin
Writeln('Tried restarting too many times, safety termination.');
SmartKillClient(ID);
TerminateScript;
End;
Fr33DTM;
SixHourFix;
SmartSetGraphics(False);
Wait(60000);
if(not(LoggedIn)) then LogInPlayer;
SetDTM;
if not(FindNormalRandoms) then
begin
ClickNorth(SRL_ANGLE_HIGH);
ToggleXPBar(True);
EnterPOH;
end;
End;
{
Makes the tabs by clicking every time, not Make-All
TabCraft handles the actual crafting
by Twh
}
function TabCraft : Boolean;
begin
Result := True;
HumanMMouse(258, 193, 6, 6);
MarkTime(Ts);
WaitUpTextMulti(['Stud','tudy','ecte'],10000);
if TimeFromMark(Ts) > 10000 then
begin
Writeln('Somethings wrong with the lectern locator, attempting to correct');
if(FindColorTolerance(x1, y1, 1251099, 488, 18, 500, 30, 10)) then
begin
HumanMMouse(TabX1,TabY1,5,5);
Wait(300);
ClickMouse2(True);
HumanMMouse(LecternTP.x, LecternTP.y, 4, 4);
End else
begin
Writeln('The location is off, rewriting coords');
if (not(LocateLectern(True, True))) then
begin
Result := False;
Exit;
End;
End;
End;
Wait(300 + Random(300));
ClickMouse2(True);
Wait(350 + Random(250));
HumanMMouse(TabX1, TabY1, 15, 15);
MarkTime(Ts);
If WaitUpTextMulti(['tab','blet','ake'],10000) Then
begin
Wait(250 + Random(150));
ClickMouse2(True);
Wait(100 + Random(200));
End;
End;
{
Makes the tabs by clicking every time, not Make-All
MakeTabs handles checks
by Twh
}
procedure MakeTabs;
var
a : Integer;
Begin
MarkTime(T);
repeat wait(500)
until (InvCount > 8) or (TimeFromMark(T) > 15000);
if TimeFromMark(T) > 15000 then Exit;
a:=InvCount;
//Writeln('The inventory contains: ' + IntToStr(a));
i:=0;
repeat
i:= i + 1;
a:= a - 1;
until (a < 6) or (i > 40) or not(TabCraft);
//Writeln('Sending butler');
End;
{
Sends the butler to the bank, continues crafting runes while the butler is away
by Twh
Butler colors: 2044773, 1781081, 2176620, 2178409,
1055559 - H0.32 S1.30 T11
}
procedure SendButler;
begin
if (FindButler) then
begin
HumanMMouse(x, y, 3, 3);
if(WaitUpTextMulti(['Tal','-t', 'But', 'ler'], 2000)) then writeln('Found butler')
else begin
MMouse(x, y, 0, 0);
if(WaitUpTextMulti(['Tal','-t', 'But', 'ler'], 3000)) then writeln('Found butler')
else begin
Writeln('Couldnt find butler, exited function');
Exit;
End;
End;
ClickMouse2(False);
ChooseOptionEx('Fetc','action');
MarkTime(Ts);
repeat wait(500)
until FindNPCChatTextMulti(['lank','500','pay','noti'],nothing) or (TimeFromMark(T) > 8000);
If (FindNPCChatTextMulti(['500','pay ', 'noti'],nothing)) then
begin
if (PayButler) then
begin
HumanMMouse(x, y, 1, 1);
ClickMouse2(False);
ChooseOptionEx('Fetc','action');
End else Exit;
End;
MarkTime(Ts);
repeat Wait(500)
until (FindNPCChatText('lank', nothing)) or (TimeFromMark(Ts) > 10000);
If (FindNPCChatTextMulti(['20','etch','clay'],nothing)) then
begin
SendKeys('1',50,50);
end else
begin
MarkTime(Ts);
FindNpcChatText('ore.',ClickLeft);
repeat Wait(500)
until FindNpcChatTExt('lay',ClickLeft) or (TimeFromMark(Ts) > 10000);
Wait(2500);
TypeSend('20');
End;
i := 1;
Repeat
begin
TabCraft;
i := i + 1;
end
until (i > 2);
End;
End;
{
More or less custom antiban
by Twh
}
procedure Antiban;
var
c : Integer;
begin
c := Random(150);
case c of
1 -2: Begin
HumanMMouse(597, 185, 6, 6);
Wait(200 + Random(150));
ClickMouse2(True);
Wait(200 + Random(150));
HumanMMouse(581, 364, 18, 7);
Wait(1500 + Random(1500));
FTab(25);
End;
3-4 : PickUpMouse;
5-6 : Boredhuman;
7 : RandomMovement;
8-9 : RandomRClick;
10 : Wait(2000 + Random(3500));
11-12 : OffMM(Random(4), 1000,1000);
13: Wait(40000 + random(7400));
14: Wait(25500 + random(8550));
15: Wait(60040 + random(6759));
16: Wait(20400 + random(2549));
End;
{
The following bit makes the script halt for a long while (20min-80min) after
running for increased periods of time.
}
if(TimeFromMark(RunTimer) > (36000000 + BreakAt)) then
begin
Writeln('Taking a break');
case Random(4) of
1 : begin
Logout;
Wait(1200000 + Random(3600000));
RunTimer := 0;
RestartScript;
End;
2-4 : begin
Wait(1200000 + Random(3600000));
RunTimer := 0;
RestartScript;
End;
End;
End;
End;
{
Looks for disturbances in the run, tries to correct them
by Twh
}
procedure FindProblems;
Begin
if(Loop > 1) and (Tp - Tstor < 15000) then
begin
Writeln('Something went wrong - script is looping too fast.');
if(Loopc = 1) then RestartScript
else Loopc := 1;
End else
if(Loop > 2) and (TabsStor = TabsC) then
begin
Writeln('Something went wrong - script isnt making any tabs');
if(Loopc = 1) then RestartScript
else Loopc := 1;
End else Loopc := 0;
Writeln('Loop completed in ' + IntToStr(Tp - Tstor));
Tstor := Tp;
TabsStor := TabsC;
End;
Procedure Setup;
Begin
SRL_SixHourFix := True;
{$IFDEF SIMBAMAJOR980}
SMART_SERVER := 10;
SMART_MEMBERS := TRUE;
SMART_SIGNED := TRUE;
SMART_SUPERDETAIL := FALSE;
{$ELSE}
SMART_FIXSPEED := TRUE;
{$ENDIF}
SetupSRL;
ClearDebug;
DeclarePlayers;
LoginPlayer;
AddOnTerminate('Fr33DTM');
SetDTM;
ClickNorth(SRL_ANGLE_HIGH);
ToggleXPBar(True);
MarkTime(RunTimer);
LecternTP.x := 0;
LecternTP.y := 0;
BreakAt := Random(7200000);
Tabs:=GetAmount(575, 230);
Case Lowercase(TabType) Of
'varrock' : Begin TabX1:=250; TabY1:=255 End;
'lumbridge' : Begin TabX1:=140; TabY1:=114 End;
'falador' : Begin TabX1:=221; TabY1:=197 End;
'camelot' : Begin TabX1:=309; TabY1:=281 End;
'ardougne' : Begin TabX1:=310; TabY1:=202 End;
'watchtower' : Begin TabX1:=309; TabY1:=121 End;
'house' : Begin TabX1:=420; TabY1:=91 End;
'btb' : Begin TabX1:=397; TabY1:=201 End;
'btp' : Begin TabX1:=420; TabY1:=255 End;
End;
If TabType='' Then
Begin
Writeln('You dont have a tab specified! Shutting down');
TerminateScript;
End;
Writeln('Script set up for '+TabType+' tabs.');
End;
Begin
Setup;
loop := 1;
SmartSetGraphics(True);
EnterPOH;
Repeat
MarkTime(Tp);
Loop := Loop + 1;
if not(LoggedIn) then
begin
Writeln('Somehow we logged out, restarting');
RestartScript;
End;
LocateLectern(False, False);
MakeTabs;
Antiban;
SendButler;
ProgressReport;
FindProblems;
Until Loop = LoopMax;
End.