SCAR Code:
{==============================================================================}
{ }
{ Name: Varrock East Clay Softener }
{ Author: Pure1993 }
{ Category: Money Making }
{ Description: Softenes clay at Varrock East for profit }
{ Usage: Have hard clay and at least 14 Buckets in your Inventory }
{ and/or bank. Be located close to the Varrock East fountain }
{ or bank. You can buy Clay in the GE (recommended) or you }
{ can you can mine them. Buckets can be bought in any general }
{ store. }
{ Date Created: 11.3.2010 }
{ Last Update: 11.3.2010 }
{ Current Version: 1.0 }
{ }
{==============================================================================}
{ }
{ Setup: }
{ 1.) Go to lines 78+ and set your account(s) up }
{ 2.) Use Safe Mode and Full Brightness }
{ 3.) Press run and monitor the first 2 loads }
{ in case a massiv color change occurs (shouldn't }
{ actually happen though, just to play safe) }
{ 4.) If it doesn't work, try adjusting lines 45 to 51 }
{ }
{==============================================================================}
{ }
{ Best Proggy: }
{ Thank you for Running Varrock East Softener }
{ Runtime: 1 Hours, 58 Minutes and 1 Seconds }
{ }
{ Player #0: }
{ Nick: ache }
{ Clay Softened: 1974 }
{ Active: True }
{ }
{ Submitted by: Pure1993 (beat it to get yours displayed here ;D) }
{ }
{==============================================================================}
program VarrockEastSoftener;
{.include srl/srl.scar}
const
TheRoadColor = 8095361; // Choose a new one if the Tolerance increase doesn't work
AddedRoadTolerance = 5; // Increase if it doesn't realise that it is standing in the bank
// Decrease if it doesn't realise that it is at the fountain
// SHOULD work stable at 0 to 5;
AddedDTMTolerance = 0; // Increase if it doesn't find inventory Items
// Increase if it detects full buckets as empty buckets and vice versa
// SHOULD work stable at 0;
//-----------------------The Setup-----------------------\\
function GetLoc: string; forward;
var
// DTMS
H_Clay, E_Bucket, F_Bucket, S_Clay : Integer;
// Colors and Tolerances
V_Fountain, V_FountainMaxTol, V_Banker, V_BankerMaxTol : Integer;
// Proggy Variables
D_Clay : Integer;
// Essential Boolean for main loop
TheBool : Boolean;
// Essential Integer for main loop failproof
Failer : Integer;
// Fallback, increases Tolerances, decreses minimum ammount of pixels required
Sloppyness : Integer;
Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active := True;
end;
function CreateSoftClayDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 663;
dtmMainPoint.y := 337;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 868439;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[0].x := 663;
dtmSubPoints[0].y := 346;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[1].x := 650;
dtmSubPoints[1].y := 337;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[2].x := 666;
dtmSubPoints[2].y := 327;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[3].x := 673;
dtmSubPoints[3].y := 338;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance + 10;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
function CreateFullBucketDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 621;
dtmMainPoint.y := 259;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 9009015;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[0].x := 625;
dtmSubPoints[0].y := 254;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[1].x := 629;
dtmSubPoints[1].y := 270;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[2].x := 619;
dtmSubPoints[2].y := 277;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[3].x := 612;
dtmSubPoints[3].y := 269;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance+10;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
function CreateEmptyBucketDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 621;
dtmMainPoint.y := 259;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 1587788;
dtmMainPoint.Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[0].x := 625;
dtmSubPoints[0].y := 254;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[1].x := 629;
dtmSubPoints[1].y := 270;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[2].x := 619;
dtmSubPoints[2].y := 277;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance+10;
dtmSubPoints[3].x := 612;
dtmSubPoints[3].y := 269;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance+10;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
function CreateClayDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 661;
dtmMainPoint.y := 412;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 5010314;
dtmMainPoint.Tolerance := AddedDTMTolerance + 15;
dtmSubPoints[0].x := 660;
dtmSubPoints[0].y := 407;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 131072 ;
dtmSubPoints[0].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[1].x := 665;
dtmSubPoints[1].y := 413;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 131072 ;
dtmSubPoints[1].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[2].x := 655;
dtmSubPoints[2].y := 413;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 131072 ;
dtmSubPoints[2].Tolerance := AddedDTMTolerance + 10;
dtmSubPoints[3].x := 661;
dtmSubPoints[3].y := 415;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 131072 ;
dtmSubPoints[3].Tolerance := AddedDTMTolerance + 10;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
// Loads all global colors, tolerances and DTMS
procedure LoadInts;
begin
SetupSRL;
H_Clay := CreateClayDDTM;
F_Bucket := CreateFullBucketDDTM;
E_Bucket := CreateEmptyBucketDDTM;
S_Clay := CreateSoftClayDDTM;
V_Fountain := 16232075 ;
V_FountainMaxTol := 15;
V_Banker := 5061698;
V_BankerMaxTol := 10;
TheBool := True;
Failer := 0;
Sloppyness := 0;
end;
// Prompts the status in the status bar and as the window disguise
procedure PromptStatus(TheStatus : string);
begin
Status('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));
Disguise('Runtime: '+TimeRunning+' || Status: '+TheStatus+' || Clay softened: '+IntToStr(D_Clay));
end;
function TPToStr( TP : TPoint): string;
begin
Result := '('+IntToStr(TP.x)+'|'+IntToStr(TP.y)+')';
end;
//-----------------------The Clay Related Functions-----------------------\\
// Searches for the Banker and clicks the desired option
function AtColors( Color, MaxTol : Integer; Uptext, Action : string; Click : Boolean): Boolean;
var
i, a, CurrentTol, Failer : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
begin
Failer := 0;
for i := 5 downto 0 do
begin
if not LoggedIn then Exit;
CurrentTol := MaxTol - i;
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, CurrentTol);
if (Length(TPA) > 15) then
begin
ATPA := TPAToATPA( TPA, 10);
SortATPASize(ATPA, true);
for a := 0 to high(ATPA) do
begin
if (Action = 'ank') and (BankScreen) then
begin
Result := True;
Exit;
end;
if not LoggedIn then Exit;
MiddleTPAEx(ATPA[a], TP.x, TP.y)
MMouse(TP.x, TP.y, 3, 3);
if WaitUptext(Uptext, 500+random(500)) then
begin
Result := not Click;
if Result then Exit;
GetMousePos(TP.x, TP.y);
if (pos(Action, GetUptext) = 0) then
begin
Mouse(TP.x, TP.y, 0, 0, false);
Result := WaitOptionEx( Action,'action', ClickLeft, 3000+random(500));
Exit;
end else
begin
Mouse(TP.x, TP.y, 0, 0, true);
Result := True;
Exit;
end;
end;
if (Failer > 4 ) then
Exit;
Inc(Failer);
end;
end;
end;
Result := False;
end;
// Searches for the Fountain and clicks the desired option
function AtFountain: Boolean;
begin
PromptStatus('Looking for Fountain');
Result := AtColors( V_Fountain, V_FountainMaxTol+Sloppyness, 'se', 'se', True );
end;
// Searches for the Bank and clicks the desired option
function AtBanker: Boolean;
begin
PromptStatus('Looking for Banker');
Result := AtColors( V_Banker, V_BankerMaxTol+Sloppyness, 'ank', 'ank ', True );
end;
// Checks if a given item is in the inventory
function InvContains( ItemName : String ): boolean;
var
TP : TPoint;
TheDTM : Integer;
begin
case Lowercase(ItemName) of
'soft clay' : TheDTM := S_Clay;
'hard clay' : TheDTM := H_Clay;
'empty buckets' : TheDTM := E_Bucket;
'full buckets' : TheDTM := F_Bucket;
end;
Result := FindDTM( TheDTM, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2);
end;
// Searches for a given DTM and clicks the desired option
function AtDTM(TheDTM : Integer; Uptext, TheOption : string): Boolean;
var
TP : TPoint;
begin
if ( FindDTM( TheDTM, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2) ) then
begin
MMouse( TP.x, TP.y, 3, 3);
if WaitUptext(Uptext, 2000+random(500)) then
begin
GetMousePos(TP.x, TP.y);
if (pos(TheOption, GetUpText) = 0) then
begin
Mouse(TP.x, TP.y, 0, 0, false);
Result := WaitOptionEx( TheOption,'action', ClickLeft, 3000+random(500));
Exit;
end else
begin
Mouse(TP.x, TP.y, 0, 0, true);
Result := True;
Exit;
end;
end;
end;
Result := False;
end;
// Does the actual Banking
function DoBanking: Boolean;
var
s, h, e, f, x, y, Failer : integer;
TPA : Array [0..3] of TPoint;
TP : TPoint;
begin
s := CountItems( 'dtm', S_Clay, []);
h := CountItems( 'dtm', H_Clay, []);
e := CountItems( 'dtm', E_Bucket, []);
f := CountItems( 'dtm', F_Bucket, []);
Finddtm(S_Clay,TPA[0].x, TPA[0].y, MIX1, MIY1, MIX2, MIY2);
Finddtm(H_Clay,TPA[1].x, TPA[1].y, MSX1, MSY1, MSX2, MSY2);
Finddtm(F_Bucket,TPA[2].x, TPA[2].y, MSX1, MSY1, MSX2, MSY2);
Finddtm(E_Bucket,TPA[3].x, TPA[3].y, MSX1, MSY1, MSX2, MSY2);
Failer := 0;
if ( s + h + e + f < InvCount) then
begin
DepositAll;
while ((Failer < 50) and (InvCount > 0)) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;
if s > 0 then
begin
if FindDTM( S_Clay, TP.x, TP.y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse( TPA[0].x, TPA[0].y, 3, 3, false);
WaitOption('ll', 3000+random(500));
while ((Failer < 50) and (InvContains('soft clay'))) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;
end;
if ( e + f < 14) then
begin
if FindDTM( F_Bucket, x, y, MSX1, MSY1, MSX2, MSY2) then Mouse( TPA[2].x, TPA[2].y, 3, 3, false) else
if FindDTM( E_Bucket, x, y, MSX1, MSY1, MSX2, MSY2) then Mouse( TPA[3].x, TPA[3].y, 3, 3, false) else
begin
Result := False;
Exit;
end;
WaitOption('-X', 3000+random(500));
wait(600+random(300));
TypeSend(IntToStr(14 - (f + e)));
while ((Failer < 50) and (CountItems( 'dtm', E_Bucket, []) + CountItems( 'dtm', F_Bucket, []) < 14)) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end;
if h < 1 then
begin
if FindDTM( H_Clay, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse( TPA[1].x, TPA[1].y, 3, 3, false);
WaitOption('ll', 3000+random(500));
while ((Failer < 50) and (not InvContains('hard clay'))) do
begin
Wait(100);
Inc(Failer);
end;
Result := False;
Exit;
end else
begin
Writeln('NO MORE CLAY!');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Strings[0] := 'Out of clay!';
CloseBank;
NextPlayer(false);
end;
end;
Result := True;
end;
// Handles the banking
function HandleBanking: Boolean;
begin
PromptStatus('Banking');
if not BankScreen then
begin
if ((rs_GetCompassAngleDegrees > 135) and ( rs_GetCompassAngleDegrees < 225)) then MakeCompass( random(180) + 270);
if not AtBanker then
exit else
begin
while (not BankScreen) do
wait(400+random(200));
end;
end;
PromptStatus('Banking');
repeat
if (not BankScreen) then Exit;
Result := DoBanking;
until Result;
CloseBank;
end;
// Checks if we need to Bank
function NeedToBank: Boolean;
var
s, h, e, f : integer;
begin
s := CountItems( 'dtm', S_Clay, []);
h := CountItems( 'dtm', H_Clay, []);
e := CountItems( 'dtm', E_Bucket, []);
f := CountItems( 'dtm', F_Bucket, []);
PromptStatus('Banking Check');
Result := (InvContains('full buckets') and InvContains('soft clay')) or
(s+h+e+f <> InvCount) or (InvCount = 0);
if ((not Result) and InvContains('soft clay')) then
Result := GetLoc = 'V_Bank';
end;
// Checks if we need to Fill
function NeedToFill: Boolean;
begin
PromptStatus('Filling Check');
Result := (InvContains('empty buckets') and InvContains('hard clay'));
if ((not Result) and InvContains('empty buckets')) then
Result := GetLoc = 'V_Fountain';
end;
// Checks if we need to Soften
function NeedToSoften: Boolean;
begin
PromptStatus('Softening Check');
Result := InvContains('full buckets') and InvContains('hard clay');
end;
// Does the actual softening
function DoSoften: Boolean;
var
TheDTM1, TheDTM2 : Integer;
begin
PromptStatus('Softening');
if random(2) = 1 then
begin
TheDTM1 := F_Bucket;
TheDTM2 := H_Clay;
end else
begin
TheDTM2 := F_Bucket;
TheDTM1 := H_Clay;
end;
if (AtDTM(TheDTM1, 'se', 'se')) then
begin
if (AtDTM(TheDTM2, 'se', 'se')) then
begin
MarkTime(Failer);
repeat
Wait(100);
if (TimeFromMark(Failer) > 4000) then
Exit;
until FindNPCChatText( 'oft clay', Clickright);
wait(300);
if ((pos( 'ucket', GetUptext) <> 0) or (pos( 'lay', GetUptext) <> 0)) then
begin
MouseBox(MSX1, MSY1, MIX2, MIY2, 2);
WaitOption( 'ancel', 3000+random(500));
Result := False;
Exit;
end;
Mouse( 260, 450, 5, 5, false);
Result := WaitOption( 'll', 3000+random(500));
if Result then
begin
MarkTime(Failer);
while InvContains('hard Clay') and InvContains('full buckets') do
begin
if FindNormalRandoms then Exit;
if (random(30) = 10) then MakeCompass(random(360));
if (random(10) = 5) then SleepAndMoveMouse(300+random(100)) else wait(200+random(100));
if (not InvContains( 'soft clay')) then
if (TimeFromMark(Failer) > 5000) then
Exit;
end;
end;
IncEx(Players[CurrentPlayer].Integers[0], CountItems( 'dtm', S_Clay, []));
IncEx(D_Clay, CountItems( 'dtm', S_Clay, []));
Exit;
end;
end;
Result := False;
end;
// Handles the Filling
function DoFilling: boolean;
var
Failer : Integer;
begin
PromptStatus('Filling');
if AtDTM( E_Bucket, 'ucket', 'se') then
if AtFountain then
begin
wait(400);
if (pos( 'ucket', GetUptext) <> 0) then
begin
MouseBox(MSX1, MSY1, MIX2, MIY2, 2);
WaitOption( 'ancel', 3000+random(500));
Result := False;
Exit;
end;
MarkTime(Failer);
while InvContains( 'empty buckets') do
begin
if FindNormalRandoms then Exit;
if (random(30) = 10) then MakeCompass(random(360));
if (random(10) = 5) then SleepAndMoveMouse(300+random(100)) else wait(200+random(100));
if (not InvContains( 'full buckets')) then
if (TimeFromMark(Failer) > 5000) then
Exit;
end;
end;
Result := not InvContains( 'empty buckets');
end;
//-----------------------The Walker Functions-----------------------\\
function GetCurrentRadian( Normal : Integer; Reset : Boolean ): Integer;
begin
Result := round((360 - rs_GetCompassAngleDegrees)) + Normal;
if ( Reset) then Result := (Result mod 360);
end;
procedure WalkNorthOfPoint( TP : TPoint; Distance : Integer);
var
x, y : Integer;
begin
x := ( round(sin((GetCurrentRadian( 0, true)*pi)/ 180) ) * Distance) + TP.x;
y := ( round(-cos((GetCurrentRadian( 0, true)*pi)/ 180) ) * Distance) + TP.y;
Mouse( x, y, 0, 0, true);
end;
function FindNPCGroup: Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
i, TestColor, r, g, b, NPCColor : Integer;
TP : Tpoint;
begin
FindColorsSpiralTolerance( MMCX, MMCY, TPA, 195836, MMX1, MMY1, MMX2, MMY2, 20+Sloppyness);
for i := 0 to high(TPA) do
begin
TestColor := GetColor( TPA[i].x, TPA[i].y);
ColorToRGB( TestColor, R, G, B);
if ( B < 5 ) then
if( R > 200 ) then
if ( G > 200 ) then
if( R - G > -20) then
if( R - G < 20) then
begin
NPCColor := TestColor;
FindColorsSpiralTolerance( MMCX, MMCY, TPA, NPCColor, MMX1, MMY1, MMX2, MMY2, 3+Sloppyness);
ATPA := TPAToATPA( TPA, 15);
SortATPASize( ATPA, true );
TP := MiddleTPA(ATPA[0]);
WalkNorthOfPoint( TP, 10);
Wait(800+random(100));
FFlag(0);
Wait(800+random(100));
Result := True;
Exit;
end;
end;
Result := False;
end;
function DrawCircle(StartRadial, EndRadial, x, y, radius: Integer): TPointArray;
var
TPA : Tpointarray;
a, i: Integer;
begin
i := 0;
SetArrayLength( TPA, (EndRadial - StartRadial) + 1);
for a := StartRadial to EndRadial do
begin
TPA[i].Y := (-round(cos((pi*a)/180) * radius)) + y ;
TPA[i].X := round(sin((pi*a)/180) * radius) + x;
inc(i);
end;
Result := TPA;
end;
function ReturnSimilarColorsIndex( Colors : TIntegerArray; Color, Tol : Integer): TIntegerArray;
var
i, a : Integer;
TI : TIntegerArray;
begin
a := 0;
SetArrayLength( TI, 0);
for i := 0 to High(Colors) do
begin
if SimilarColors( Colors[i], Color, Tol) then
begin
SetArrayLength( TI, Length(TI)+1);
TI[a] := i;
Inc(a);
end;
end;
Result := TI;
end;
function P_RadialWalk( Color, StartRadial, EndRadial, Radius, Tol: Integer): Boolean;
var
TPA_Circle, Temp_TPA: TPointArray;
TP : TPoint;
TI, TI2 : TIntegerArray;
i, a : Integer;
begin
for i := 0 to radius - 20 do
begin
TPA_Circle := DrawCircle( StartRadial, EndRadial, MMCX, MMCY, Radius - i);
TI := GetColors( TPA_Circle );
TI2 := ReturnSimilarColorsIndex( TI, Color, Tol+Sloppyness);
if Length( TI2) > 0 then
begin
SetArrayLength( TEMP_TPA, Length(TI2));
for a := 0 to high(TI2) do
begin
TEMP_TPA[A] := TPA_CIRCLE[TI2[A]];
end;
TP := MiddleTPA( TEMP_TPA );
Mouse( TP.x, TP.y, 0, 0, true);
wait(800+random(200));
FFlag(0);
Result := True;
Exit;
end;
end;
Result := False;
end;
function WalkToBank: Boolean;
begin
Result := P_RadialWalk( TheRoadColor, GetCurrentRadian(90, false), GetCurrentRadian(160, false), 72, AddedRoadTolerance+20);
if Result then
Result := FindNPCGroup;
end;
function WalkToFountain: Boolean;
begin
Result := P_RadialWalk( TheRoadColor, GetCurrentRadian(290, false), GetCurrentRadian(350, false), 72, AddedRoadTolerance+20);
end;
function GetLoc: string;
var
TPA_Circle: TPointArray;
TI, TI2 : TIntegerArray;
cSloppy : Integer;
begin
TPA_Circle := DrawCircle( GetCurrentRadian(0, false), GetCurrentRadian(45, false), MMCX, MMCY, 70);
TI := GetColors( TPA_Circle );
TI2 := ReturnSimilarColorsIndex( TI, TheRoadColor, 20 + AddedRoadTolerance);
if Sloppyness > 3 then
CSloppy := 3;
if (Length( TI2 ) > 4-CSloppy) then Result := 'V_Fountain' else Result := 'V_Bank';
end;
function GetToLoc(loc : string): Boolean;
var
cLoc : string;
begin
cLoc := GetLoc;
if lowercase(cLoc) = lowercase(loc) then
begin
Result := True
Exit;
end;
if lowercase(loc) = 'v_fountain' then
Result := WalkToFountain;
if lowercase(loc) = 'v_bank' then
Result := WalkToBank;
wait(300+random(200));
end;
procedure Proggy;
var
i : Integer;
begin
Writeln('Thank you for Running Varrock East Softener');
Writeln('Runtime: '+TimeRunning);
for i := 0 to high(players) do
begin
Writeln(' ');
Writeln('Player #'+IntToStr(i)+':');
Writeln('Nick: '+Players[i].Nick);
Writeln('Clay Softened: '+IntToStr(Players[i].Integers[0]));
writeln('Active: '+BoolToStr(Players[i].Active));
if (not Players[i].Active) then
writeln('Reason: '+Players[i].Strings[0]);
end;
end;
procedure HandleRun;
begin
if RunEnergy(20) then
begin
RestUntil( 80 + random(20))
SetRun(True);
end;
end;
function FollowProgram: Boolean;
begin
if NeedToBank then
begin
GetToLoc('V_Bank');
Result := HandleBanking;
Exit;
end;
if NeedToSoften then
begin
Result := DoSoften;
Exit;
end;
if NeedToFill then
begin
GetToLoc('V_Fountain');
Result := DoFilling;
Exit;
end;
end;
//Main Loop
begin
Wait(500);
DeclarePlayers;
LoadInts;
LoginPlayer;
wait(4000+random(500));
SetAngle( true );
while (not AllPlayersInactive) do
begin
while ((Sloppyness < 5) and LoggedIn) do
begin
while ((Failer < 3) and LoggedIn) do
begin
TheBool := FollowProgram;
FindNormalRandoms;
if TheBool then
Failer := 0 else
Inc(Failer);
Proggy;
end;
Failer := 0;
Inc(Sloppyness);
end;
Sloppyness := 0;
if (not LoggedIn) then
NextPlayer(false);
end;
Logout;
Proggy;
end.