updated script. great script btw. i bought 7k hard clay and have made about 400k so far. atm im flagged so i wont be using this for a week, but thanks.
program ClayAutoSoftenerbyTarajunky;
{ oooooooo8 o oooooooo8 ooooooooooo
o888 88 888 888 88 888 88
888 8 88 888oooooo 888
888o oo 8oooo88 888 888
888oooo88 o88o o888o o88oooo888 o888o
/******************************************************************************\
| GOOD THINGS TO KNOW |
| 1. This script will soften clay at the water pump and bank at Fally West |
| 2. You can start your players anywhere near the pump or the bank, but |
| the best place to start the script is probably the West Bank. |
| 3. Watch it soften the first load just in case. |
| 4. You WILL NOT get randoms if you keep MaxTime and LoadsToDo at low values. |
| 4. Make sure the clay you wish to soften is visible on your bank screen. | | |
| 5. There are 3 modes you can use. |
| 'fill': Withdraws empty buckets, fills them and banks them at Fally West. |
| 'wet' : Withdraws full buckets and clay, softens them, then banks them. |
| 'both': Withdraw empty buckets and clay, fills at pump, softens, and banks.|
| ***You must have at least 14 buckets in the bank to use 'both' mode*** |
| 7. The best way to use this script is to buy tons of clay on your main, |
| buy tons of empty buckets on your army, let your army fill the buckets, |
| then trade to your main and let it wet the clay. You can make about |
| 200k per hour on your main while the army does most of the grunt work. |
| 8. It's completely AutoColor. Simply setup your SRLID and player |
| information in lines 46+ and hit play! |
\******************************************************************************}
{.include SRL/SRL.scar}
var x, y, BankTellers, EmptyBucket, FullBucket, Responded, ClayDTM, SoftClay,
Nudges, SoftCount, FullCount, PumpDTM1, PumpDTM2, PlayerTime, Tries,
Loads, WallColor,PumpText,ESelected,FSelected,Randomizer:integer;
PumpColors: array of integer;
const
StartPlayer = 0; // Player you wish to start with
LoadsToDo = 143; // Loads before changing players, script will randomize a little bit
SetMouseSpeed = 24; // Higher = faster
Version = '1.4';
MaxTimePerPlayer = 120; // Max time before changing players, script will randomize a little bit
PumpColor = 1777698; // Tol 10
procedure DeclarePlayers;
begin
SRLID:='';
SRLPassword:='';
HowManyPlayers:=2;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer:=StartPlayer;
Players[0].Name:=''; //Character name
Players[0].Pass:=''; //Character password
Players[0].Strings[0]:='both'; // Action to perform. 'wet', 'fill', or 'both'
Players[0].Strings[1]:=''; // Bank PIN
Players[0].Nick:=''; //3-4 non-capital letters from character name
Players[0].Active:=True; //Use this character?
Players[1].Name:=''; //Character name
Players[1].Pass:=''; //Character password
Players[1].Strings[0]:='fill'; // Action to perform. 'wet', 'fill', or 'both'
Players[1].Strings[1]:=''; // Bank PIN
Players[1].Nick:=''; //3-4 non-capital letters from character name
Players[1].Active:=False; //Use this character?
end;
{==========================================================|
|+++++++++ SCRIPT SETUP AND GENERIC FUNCTIONS +++++++++++|
|==========================================================}
procedure FindThoseRandoms;
begin
Status('Finding Randoms');
if not(LoggedIn) then exit;
// CloseWindow;
FindTalk;
FindLamp('mining');
if NoGameTab then
begin
repeat
Wait(1000);
if not(NoGameTab) then break;
until not(LoggedIn);
end;
if InBlack then
begin
repeat
Wait(1000);
if not(InBlack) then break;
until not(LoggedIn);
end;
if Respond then Responded:=Responded+1;
if random(100) mod 4 = 0 then FindNormalRandoms;
end;
procedure LogMeOut;
begin
Writeln('Logging Out');
repeat
Wait(1000);
FindThoseRandoms;
until not(LoggedIn);
end;
procedure DeclareBitMaps;
begin
BankTellers:=DTMFromString('78DA63EC606260886640016FDF32308800694' +
'620FE0F048CAD08354C58D48000632376357790D5F46057C30055' +
'031203002EF31007');
EmptyBucket:=DTMFromString('78DA6394626460E000622490EC23C12002A44' +
'1A2FF81805105C8E2445503918591405A19C8E225A04609C81225' +
'A04616C89224A0468C083542409608116AF808A81124EC7700BB7' +
'1067F');
FullBucket:=DTMFromString('78DA635CCEC8C0F0880105D4D4CE611001D24' +
'01986FF40C0B811C87AC2800618914820BD01C87A4540CD7A20EB' +
'1D01356B80AC4F04D42C22420DC85F9F09A8990F64BD21A0661E9' +
'0F50CBF1A00676313F9');
SoftClay:=DTMFromString('78DA637464626078CA80027283F8184480342' +
'310FF0702C600A09A470C6880118904D23E40352F08A8F104AA79' +
'4B408D3350CD7B026AEC8850634D841A33A09A5704D49812E12F4' +
'BA09A07F8D500004F7610B0');
ClayDTM:=DTMFromString('78DA63CC61626008606440058C482490CE06A' +
'AF126A0A61CA8C69F801A905D1104D42403D5041150530454138C' +
'5F0D003478049B');
PumpDTM1:=DTMFromString('78DA63EC62626010674001ED75B90C5F18191' +
'88088E13F1030F600D5A8A2AA790FC45C0C103520C0B80AA8469D' +
'809A26A01A4954355FDEBD67B04156530754234040CD44A01A290' +
'89B09C9CD30352C400C007A591433');
PumpDTM2:=DTMFromString('78DA63EC636260906640016DD5D90C3A8C0C0' +
'C40C4F01F08185B806A6450D57C78F382C18801A20604181B816A' +
'C408A86906AA5187B2A162F1FAEC0C1AC86A9A806A7409A82900A' +
'AD1206017488D247E3500D3F41760');
PumpText:=DTMFromString('78DA63CC666060E0644001522F5F33A400694' +
'620FE0F048C39986AA49F3F81AB0101C65C202184AA86F9D24554' +
'3505986A582E5F42559307247851D5883CBC87AA269F083585986' +
'E1679781F554D11A61AF1A70F51D55460DA25F1EC11AA9A4A4C7F' +
'61A8A94798C388CBEF7540820BC266828A893D7988698E100173D' +
'A808400AA3918FE6A43B807A646FA0A9A39ED08BB7099030020B5' +
'2F96');
ESelected:= DTMFromString('78DA63CC666260506764400629BE920C5C401' +
'A24FA1F08184B806A5450D540646124902EC55403D48AAA261FA8' +
'C692803920355604CC01B9598E8039594035B2F8CD010099DB121' +
'2');
FSelected:= DTMFromString('78DA637466626078C08002AA6B66337001694' +
'620FE0F048C3E4035F718D000231209A47D31D500B5A2AA7105AA' +
'F948C01C909A4F04CCB124C23D1684DD03006A5116C1');
end;
function CountItemDTM(DTM: Integer): Integer;
var i:integer;
var c:TPoint;
begin
Status('Counting Items');
if not(LoggedIn) then exit;
GameTab(4);
for i := 1 to 28 do
begin
c:=ItemCoords(i);
if FindColor(x,y,65536,c.x-25,c.y-25,c.x+25,c.y+25) then
begin
if FindDTM(DTM,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then result:=result+1;
end;
end;
end;
procedure SetupScript;
var i:integer;
begin
Status('Setting up script');
SetupSRL;
ScriptID := '588';
DeclareBitmaps;
MouseSpeed := SetMouseSpeed;
DeclarePlayers;
for i:= 0 to HowManyPlayers-1 do
begin
SetArrayLength(Players[i].Integers,3);
Players[i].Integers[0]:=0;
Players[i].Integers[1]:=0;
Players[i].Integers[2]:=0;
end;
WallColor:=0
SetArrayLength(PumpColors,0);
LoginPlayer;
Wait(3000+random(1000));
MarkTime(PlayerTime);
GetAllLevels;
SetAngle(True);
Randomizer:=random(4);
end;
{==========================================================|
|++++++++++++ AUTO-LOCATION AND WALKING +++++++++++++++++|
|==========================================================}
function FindPosition:string;
var x,y:integer;
begin
Status('Finding position');
FindNormalRandoms;
if not(LoggedIn) then exit;
if not(FindColor(x,y,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor:=FindFallyRoadColor;
if RoadColor>0 then result:='Fally' else result:='Lost';
Status('Current Position = '+result);
end;
procedure WalkToBank;
var x,y:integer;
begin
FindPosition;
Status('Walking to bank');
if not(LoggedIn) then exit;
FindNormalRandoms;
if FindDTM(BankTellers,x,y,MMX1,MMCY,MMX2,MMY2) then
begin
if Distance(x,y,MMCX,MMCY)>20 then
begin
Status('To Bank via Tellers');
MFF(x, y, 1, 1)
end else Status('Close Enough');
FFlag(0);
Players[CurrentPlayer].Loc:='Bank';
exit;
end;
if FindSymbol(x,y,'bank') then
begin
Status('To Bank via Bank Symbol');
if FindColorSpiral(x,y,RoadColor,x,MMY1,x+1,y) then
begin
Mouse(x,y,5,5,true);
FFlag(10);
WalkToBank;
exit;
end;
end;
if FindSymbol(x,y,'quest') then
begin
Status('To Bank via Quest Symbol');
x:=MMX1+20;
y:=MMCY;
if FindColorSpiral(x,y,RoadColor,MMX1,MMY1,MMX2,MMY2) then
begin
Mouse(x,y,5,5,true);
FFlag(5);
WalkToBank;
exit;
end;
end;
if FindSymbol(x,y,'water source') then
begin
Status('To Bank via Water Symbol');
if FindColorSpiral(x,y,RoadColor,x-20,y+20,x-10,MMY2) then
begin
Mouse(x,y,3,3,true);
FTWait(2);
FFlag(5);
WalkToBank;
exit;
end;
end;
if FindSymbol(x,y,'hair dresser') then
begin
Status('To Bank via Hair Dresser Symbol');
if FindColorSpiral(x,y,RoadColor,x-10,y,x+10,MMY2) then
begin
Mouse(x,y,3,3,true);
FTWait(2);
FFlag(5);
WalkToBank;
exit;
end;
end;
end;
function FindWallColor:integer;
var MMPos,TC1,TC2,TC3,r,g,b:integer;
begin
Status('Scanning for WallColor');
Wait(1);
MMPos:=0;
repeat
if FindColorTolerance(x,y,15983848,MMX1,MMCY-MMPos,MMCX,MMCY-MMPos,60) then
TC1:=GetColor(x,y);
if FindColorTolerance(x,y,15983848,MMX1,MMCY-MMPos-10,MMCX,MMCY-MMPos-10,60) then
TC2:=GetColor(x,y);
if FindColorTolerance(x,y,15983848,MMX1,MMCY-MMPos+10,MMCX,MMCY-MMPos+10,60) then
TC3:=GetColor(x,y);
if TC1=TC2 then
begin
if TC2=TC3 then
begin
ColorToRGB(TC1,R,G,B);
if abs(r-g)<20 then
if abs(r-b)<20 then
if abs(g-b)<20 then
begin
Result:=TC1;
Writeln('Wall Color = '+IntToStr(TC1));
exit;
end;
end;
end;
Inc(MMPos);
until (MMPos>=MMCY-10);
Writeln('Could not find Wall Color!');
result:=-1;
end;
function FindWallAngle:integer;
var i,n,x1,y1,adj,opp,WallAngle:integer;
var TestAngle:extended;
begin
if WallColor=0 then WallColor:=FindWallColor;
if not(FindColor(x,y,WallColor,MMX1,MMY1,MMX2,MMY2)) then
begin
WallColor:=FindWallColor;
if FindColor(x,y,WallColor,MMX1,MMY1,MMX2,MMY2) then result:=FindWallAngle
else result:=-1;
exit;
end;
y:=MMCY;
n:=y;
repeat
Wait(1);
x:=MMX1;
if FindColorSpiral(x,y,WallColor,MMX1,y,MMCX,y) then
begin
x1:=x;
y1:=y;
for i:= 1 to 15 do
begin
if not(FindColor(x,y,WallColor,x-1,y-1,x+1,y-1)) then break;
end;
if y=y1-15 then
begin
adj:=x-x1;
if adj<0 then adj:=0-adj;
opp:=15;
TestAngle:=ArcTan(Adj/Opp);
if x<x1 then TestAngle:=6.283-TestAngle;
TestAngle:=TestAngle*(180/3.14);
WallAngle:=Round(TestAngle);
Writeln('Wall Angle = '+IntToStr(WallAngle));
result:=WallAngle;
exit;
end;
end;
n:=n+1;
y:=n;
until y>=MMY2;
Writeln('Wall Angle Error');
end;
procedure WalkToPump;
var x,y,x1,y1,Angle:integer;
begin
if (TimeFromMark(PlayerTime)>((MaxTimePerPlayer)*60*1000)) then
begin
Writeln('Player time exceeded');
exit;
end;
Angle:=FindWallAngle;
if (Angle<180) then
begin
if (Angle>5) then
begin
Writeln('Nudging screen left');
Nudges:=Nudges+1;
KeyDown(VK_Left);
Wait(50+random(20));
if (Angle>10) then Wait(30);
KeyUp(VK_Left);
end;
end else
begin
if (Angle<350) then
begin
Writeln('Nudging screen right');
Nudges:=Nudges+1;
KeyDown(VK_Right);
Wait(50+random(20));
if (Angle<340) then Wait(30);
KeyUp(VK_Right);
end;
end;
Writeln('Walking to pump');
if not(LoggedIn) then exit;
FindNormalRandoms;
if FindDTM(BankTellers,x1,y1,MMX1,MMCY,MMX2,MMY2) then
begin
Status('To Pump via Tellers');
if not(FindColor(x,y,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor:=FindFallyRoadColor;
if RoadColor>0 then
begin
x:=x1+15+random(5);
y:=y1-60-random(5);
if FindColorSpiral(x,y,RoadColor,MMX1,MMY1,MMX2,MMY2) then
begin
Mouse(x,y,0,0,true);
Wait(3000);
FFlag(0);
exit;
end;
end else
begin
Players[CurrentPlayer].Loc:='No RoadColor';
exit;
end;
end else
begin
Writeln('No Tellers!');
if FindSymbol(x,y,'water source') then
begin
Status('To pump via Water Symbol');
Mouse(x,y,3,3,true);
FTWait(8);
FFlag(0);
end;
end;
end;
{==========================================================|
|+++++++++++++++++++++++ BANKING ++++++++++++++++++++++++|
|==========================================================}
procedure EnterPin;
begin
if Length(Players[CurrentPlayer].Strings[1])>0 then
begin
InPin(Players[CurrentPlayer].Strings[1]);
end else
begin
Writeln('Pin required, but not provided!');
LogMeOut;
Players[CurrentPlayer].Active:=false;
exit;
end;
end;
procedure OpenTheBank;
var x,y,tmpx,tmpy,i:integer;
begin
Status('Opening bank');
if not(LoggedIn) then exit;
if FlagPresent then
begin
FFlag(0);
FTWait(1);
end;
if FindDTM(BankTellers,x,y,MMX1,MMCY,MMX2,MMY2) then
begin
if y>MMCY then
begin
if Distance(x,y,MMCX,MMCY)>12 then
begin
Status('To Bank via Tellers');
MFF(x, y, 1, 1)
end else Status('Close Enough');
end else
begin
Status('To Bank via Tellers');
MFF(x, y, 1, 1)
end;
end else
begin
Writeln('Could not find Bank Tellers!');
exit;
end;
if FlagPresent then
begin
FFlag(0);
FTWait(1);
end;
MMouse(MSCX+random(6),MSCY+20+random(10),0,0);
Wait(50);
if IsUpTextMultiCustom(['pen','ank','oot']) then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,false);
ChooseOption('quickly');
FTWait(1);
FFlag(0);
i:=0;
repeat
i:=i+1;
FTWait(1);
if i>8 then break;
if PinScreen then EnterPin;
if not(LoggedIn) then exit;
until BankScreen;
if BankScreen then
begin
FTWait(2+random(2));
exit;
end else
begin
OpenTheBank;
exit;
end;
end;
repeat
tmpx:=3+random(5);
tmpy:=8+random(5);
GetMousePos(x,y);
MMouse(x+tmpx,y+tmpy,0,0);
Wait(75);
if IsUpTextMultiCustom(['pen','ank','oot']) then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,false);
ChooseOption('quickly');
FTWait(1);
FFlag(0);
i:=0;
repeat
i:=i+1;
FTWait(1);
if i>20 then break;
if PinScreen then EnterPin;
if not(LoggedIn) then exit;
until BankScreen;
if BankScreen then exit else
begin
OpenTheBank;
exit;
end;
end;
until y>=(MSY2-(MSCY div 2));
OpenBankQuiet('fwb');
i:=0;
repeat
FTWait(1);
i:=i+1;
if i>8 then break;
if PinScreen then EnterPin;
if not(LoggedIn) then exit;
until BankScreen;
if BankScreen then exit else
begin
OpenTheBank;
exit;
end;
end;
procedure ProgReport;
var i:integer;
var active:string;
begin
Status('Progress Report');
AddToReport('***************************************************');
AddToReport('* Clay Auto Softener '+Version+' by Tarajunky');
AddToReport('* Worked for '+TimeRunning);
AddToReport('* Banked '+IntToStr(Banks)+' times');
if SoftCount>0 then AddToReport('* Banked '+IntToStr(SoftCount)+
' Soft Clay');
if FullCount>0 then AddToReport('* Banked '+IntToStr(FullCount)+
' Full Buckets');
AddToReport('***************************************************');
for i:= 0 to HowManyPlayers-1 do
begin
if Players[i].Integers[0]>0 then
begin
AddToReport('* # A Nick - Softs - Fulls - Time - Loc');
for i:= 0 to HowManyPlayers-1 do
begin
if Players[i].Integers[0]>0 then
begin
if Players[i].Active then Active := 'T' else Active := 'F';
AddToReport('* '+IntToStr(i)+' '+Active+' '+Players[i].Nick+' - '+
IntToStr(Players[i].Integers[1])+' - '+ IntToStr(Players[i].Integers[2])+
' - '+IntToStr(Players[i].Worked)+' - '+Players[i].Loc);
end;
end;
AddToReport('***************************************************');
exit;
end;
end;
end;
procedure DepositSoftClay;
var i,j,n:integer;
var c:Tpoint;
begin
if not(BankScreen) then
begin
Writeln('Cannot deposit, bank screen not open');
exit;
end;
if FindDTM(SoftClay,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
Status('Depositing Soft Clay');
i:=CountItemDTM(SoftClay);
SoftCount:=SoftCount+i;
ReportVars[1]:=ReportVars[1]+i;
Players[CurrentPlayer].Integers[1]:=Players[CurrentPlayer].Integers[1]+i;
Writeln('Depositing '+IntToStr(i)+' Soft Clay');
repeat
i:=random(28)+1;
n:=n+1;
c:=ItemCoords(i);
if FindDTM(SoftClay,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then
begin
MMouse(x,y,2,2);
Wait(350+random(100));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('ll');
j:=0;
repeat
Wait(200);
j:=j+1;
if (j>50) then break;
until not(FindDTM(SoftClay,x,y,MIX1,MIY1,MIX2,MIY2));
Wait(50);
if FindDTM(SoftClay,x,y,MIX1,MIY1,MIX2,MIY2) then DepositSoftClay else break;
end;
until (n>100);
end;
end;
procedure DepositBuckets(BucketType:integer);
var i,j,n:integer;
var c:Tpoint;
begin
if FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
if BucketType=FullBucket then
begin
i:=CountItemDTM(FullBucket);
FullCount:=FullCount+i;
Players[CurrentPlayer].Integers[2]:=Players[CurrentPlayer].Integers[2]+i;
ReportVars[2]:=ReportVars[2]+i;
end;
repeat
i:=random(28)+1;
n:=n+1;
c:=ItemCoords(i);
if FindDTM(BucketType,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then
begin
MMouse(x,y,2,2);
Wait(350+random(100));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('ll');
j:=0;
repeat
Wait(200);
j:=j+1;
if (j>50) then break;
until not(FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2));
Wait(50);
if FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2) then DepositBuckets(BucketType) else break;
end;
until (n>100);
end else
begin
case BucketType of
EmptyBucket: Writeln('No empty buckets to deposit!');
FullBucket: Writeln('No full buckets to deposit!');
end;
end;
end;
function CountBuckets:integer;
var i,empty,full:integer;
var c:TPoint;
begin
for i := 1 to 28 do
begin
c:= ItemCoords(i);
if FindColor(x,y,65536,c.x-25,c.y-25,c.x+25,c.y+25) then
begin
if FindDTM(EmptyBucket,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then Empty:=Empty+1 else
if FindDTM(FullBucket,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then Full:=Full+1;
end;
end;
if full>0 then
begin
if empty>0 then
Writeln(IntToStr(empty)+' Empty + '+IntToStr(full)+' Full buckets') else
Writeln(IntToStr(full)+' Full buckets');
end else
if empty>0 then
Writeln(IntToStr(empty)+' Empty buckets') else
Writeln('No buckets!');
result:=empty+full;
end;
function CorrectInventory(ClayType,BucketType:integer):boolean;
begin
result:=true;
if ClayType=0 then
begin
if not(CountItemDTM(EmptyBucket)=28) then result:=false;
exit;
end;
if not(CountItemDTM(BucketType)=14) then
begin
result:=false;
exit;
end;
if not(CountItemDTM(ClayDTM)=14) then
begin
Writeln(IntToStr(CountItemDTM(ClayDTM))+' clays found');
result:=false;
exit;
end;
end;
procedure EmptyAndFillInventory(ClayType,BucketType:integer);
var i:integer;
begin
if not(LoggedIn) then exit;
Writeln('Resetting Inventory');
DepositAll;
if not(BankScreen) then exit;
Status('Withdrawing Buckets');
if FindDTM(BucketType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,2,2);
Wait(250+random(20));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('Withdraw X');
Wait(500+random(1500));
case ClayType of
0 : Typesend('28');
ClayDTM : Typesend('14');
end;
Wait(1500+random(1500));
i:=0;
repeat
Wait(200);
i:=i+1;
if (i>50) then break;
until (FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2));
if i>20 then
begin
EmptyAndFillInventory(ClayType,BucketType);
exit;
end;
end else
begin
case BucketType of
FullBucket: begin
Writeln('No Full Buckets found in bank!');
if Players[CurrentPlayer].Strings[0]='both' then
begin
if FindDTM(EmptyBucket,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Withdrawing Empty Buckets instead');
EmptyAndFillInventory(ClayType,EmptyBucket);
exit;
end;
end;
end;
EmptyBucket: Writeln('No Empty Buckets found in bank!');
end;
LogMeOut;
Players[CurrentPlayer].Active:=False;
exit;
end;
if ClayType=0 then exit;
Status('Withdrawing Clay');
if FindDTM(ClayType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,2,2);
Wait(250+random(20));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('Withdraw X');
Wait(500+random(1500));
Typesend('14');
Wait(1500+random(1500));
i:=0;
repeat
Wait(200);
i:=i+1;
if (i>50) then break;
until (FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2));
if i>20 then
begin
EmptyAndFillInventory(ClayType,BucketType);
exit;
end;
end else
begin
Writeln('No Clay found in bank!');
LogMeOut;
Players[CurrentPlayer].Active:=False;
exit;
end;
end;
procedure WithdrawClay(ClayType,BucketType:integer);
var i:integer;
begin
if ClayType=0 then exit;
if not(LoggedIn) then exit;
Status('Withdrawing Clay');
if not(BankScreen) then exit;
if not(InvCount=14) then
begin
if not(CorrectInventory(ClayType,BucketType)) then
begin
EmptyAndFillInventory(ClayType,BucketType);
exit;
end else exit;
end;
if FindDTM(ClayType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,2,2);
Wait(250+random(20));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('ll');
i:=0;
repeat
Wait(200);
i:=i+1;
if (i>50) then break;
until (FindDTM(ClayType,x,y,MIX1,MIY1,MIX2,MIY2));
if i>20 then
begin
WithdrawClay(ClayType,BucketType);
exit;
end;
end else
begin
Writeln('No Clay found in bank!');
repeat
wait(1000);
FindNormalRandoms;
if FindDTM(ClayType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Found Clay');
WithdrawClay(ClayType,BucketType);
exit;
end;
until not(LoggedIn);
Players[CurrentPlayer].Active:=False;
exit;
end;
end;
procedure WithdrawBuckets(ClayType,BucketType:integer);
var i:integer;
begin
if not(LoggedIn) then exit;
Status('Withdrawing Buckets');
if not(BankScreen) then exit;
if (ClayType<>0) then if not(InvCount=14) then
begin
EmptyAndFillInventory(ClayType,BucketType);
exit;
end;
if FindDTM(BucketType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,2,2);
Wait(250+random(20));
GetMousePos(x,y);
Mouse(x,y,1,1,false);
ChooseOption('ll');
i:=0;
repeat
Wait(200);
i:=i+1;
if (i>50) then break;
until (FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2));
if i>20 then
begin
WithdrawBuckets(ClayType,BucketType);
exit;
end;
end else
begin
case BucketType of
FullBucket: Writeln('No Full Buckets found in bank!');
EmptyBucket:Writeln('No Empty Buckets found in bank!');
end;
repeat
Wait(1000);
FindNormalRandoms;
if FindDTM(BucketType,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
Writeln('Found Bucket');
WithdrawBuckets(ClayType,BucketType);
exit;
end;
until not(LoggedIn);
Players[CurrentPlayer].Active:=False;
exit;
end;
end;
function BucketSelected(BucketType:integer):boolean;
var x,y,x1,y1:integer;
begin
if not(LoggedIn) then exit;
if FindColor(x1,y1,16777215,MIX1,MIY1,MIX2,MIY2) then
begin
case BucketType of
EmptyBucket: if FindDTM(ESelected,x,y,x1-30,y1-30,x1+30,y1+30) then result:=true;
FullBucket: if FindDTM(FSelected,x,y,x1-30,y1-30,x1+30,y1+30) then result:=true;
end;
if (result) then Status('Bucket Selected');
end;
end;
function SelectBucket(BucketType:integer):boolean;
var x,y,i:integer;
begin
Status('Selecting Bucket');
if TabExists(4) then GameTab(4) else
begin
FindNormalRandoms;
exit;
end;
if FindDTM(BucketType,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
Mouse(x-3+random(6),y-3+random(6),2,2,true);
i:=0;
repeat
FindThoseRandoms;
Wait(200);
i:=i+1;
if (i>50) then break;
until (BucketSelected(BucketType));
if i>20 then
begin
Writeln('Timeout');
result:=SelectBucket(BucketType);
exit;
end else
begin
result:=true;
exit;
end;
end;
end;
function ClickNpcChatTextRight(txt : String) : Boolean;
var
tx,ty,s:integer;
begin
s := CreateBitmapMaskFromText(txt, npcchars);
if FindBitmapMaskTolerance(s, tx, ty, 9, 348, 523, 471, 50, 10) then
begin
Mouse(tx, ty, 0, 0, False);
Result:=True;
end;
FreeBitmap(s);
end;
procedure CheckAndAddColor(Color:integer);
var i,l:integer;
begin
Status('Checking color array');
l:=GetArrayLength(PumpColors);
if l=0 then
begin
SetArrayLength(PumpColors,1);
PumpColors[0]:=Color;
Writeln('Added '+IntToStr(Color)+' to Pump Color Array');
exit;
end;
for i:= 0 to l-1 do
begin
if PumpColors[i]=Color then
begin
if i>0 then
begin
PumpColors[i]:=PumpColors[i-1];
PumpColors[i-1]:=Color;
exit;
end else exit;
end;
end;
SetArrayLength(PumpColors,l+1);
for i:= l-1 downto 0 do PumpColors[i+1]:=PumpColors[i];
PumpColors[0]:=Color;
Writeln('Added '+IntToStr(Color)+' to Pump Color Array');
exit;
end;
function ShrinkArray(A:TPointArray):TPointArray;
var b,i,j,l:integer;
begin
l:=GetArrayLength(A);
for i:= 0 to l-1 do
begin
if i+j<l-1 then
begin
SetArrayLength(result,b+1);
result[b]:=A[i+j];
b:=b+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
if i+j+1<=l-1 then if abs(A[i+j].y-A[i+j+1].y)<5 then j:=j+1;
end;
end;
end;
procedure FindBestColor(x1,y1:integer);
var x2,y2,i,l,Riser:integer;
begin
for Riser:=0 to 10 do
begin
x:=x1;
y:=y1;
if FindColorSpiralTolerance(x,y,PumpColor,x1-20,y1-20,x1+20,y1+20,Riser) then
begin
MMouse(x,y,0,0);
if (FindDTM(PumpText,x2,y2,1,1,260,25) or IsUpText('aterpump')) then
begin
Writeln('Best PumpColor '+IntToStr(Getcolor(x,y))+' found!');
l:=GetArrayLength(PumpColors);
if l>0 then
begin
SetArrayLength(PumpColors,l+1);
for i:= l-1 downto 0 do PumpColors[i+1]:=PumpColors[i];
PumpColors[0]:=GetColor(x,y);
exit;
end else
begin
SetArrayLength(PumpColors,1);
PumpColors[0]:=GetColor(x,y);
exit;
end;
end;
end;
end;
end;
function ClickWaterPump:boolean;
var x,y,x1,y1,x2,y2,i,j,k,l,m,TempColor:integer;
var P1,P2:TPointArray;
begin
if not(BucketSelected(EmptyBucket)) then if not(SelectBucket(EmptyBucket)) then exit;
if (TimeFromMark(PlayerTime)>((MaxTimePerPlayer)*60*1000)) then
begin
Writeln('Player time exceeded');
exit;
end;
Tries:=Tries+1;
if Tries>1 then Writeln('Trying to click water pump #'+IntToStr(Tries));
if Tries>5 then
begin
Writeln('Tried to find pump 5 times and failed');
LogMeOut;
exit;
end;
FFlag(0);
Wait(250);
Status('Clicking Water Pump');
l:=GetArrayLength(PumpColors);
if l>0 then
begin
for i:=0 to l-1 do
begin
Writeln('Searching for '+IntToStr(PumpColors[i]));
x:=MSCX-10;
y:=MSCY;
FindColorsSpiralTolerance(x,y,P1,Pumpcolors[i],MSX1,25,MSX2,MSY2,0);
P1:=ShrinkArray(P1);
m:=GetArrayLength(P1);
if m>0 then
begin
for j:= 0 to m-1 do
begin
if (j>50) then break;
MMouse(P1[j].x,P1[j].y,0,0);
Wait(80+random(20));
if (FindDTM(PumpText,x2,y2,1,1,260,25) or IsUpText('aterpump')) then
begin
GetMousePos(x,y);
Mouse(x,y,1,1,true);
FFlag(0);
result:=true;
Tries:=0;
exit;
end;
end;
end;
end;
end;
Writeln('Searching for PumpColor');
x:=MSCX-10;
y:=MSCY;
FindColorsSpiralTolerance(x,y,P2,PumpColor,MSX1,25,MSCX-10,MSY2,10);
P2:=ShrinkArray(P2);
l:=GetArrayLength(P2);
if l>0 then
begin
for k:= 0 to l-1 do
begin
if (k>20) then break;
MMouse(P2[k].x,P2[k].y,0,0);
Wait(80+random(20));
if (FindDTM(PumpText,x2,y2,1,1,260,25) or IsUpText('aterpump')) then
begin
GetMousePos(x1,y1);
TempColor:=GetColor(x1,y1);
CheckAndAddColor(TempColor);
FindBestColor(x1,y1);
Mouse(x1,y1,0,0,true);
FFlag(0);
result:=true;
Tries:=0;
exit;
end;
end;
end else Writeln('No points detected!');
Writeln('Could not find Water Pump!');
if FindSymbol(x,y,'water source') then
begin
Status('To pump via Water Symbol');
Mouse(x,y,3,3,true);
FTWait(8);
FFlag(0);
FTWait(3);
end else
begin
MakeCompass('N');
WalkToPump;
end;
if not(BucketSelected(EmptyBucket)) then if not(SelectBucket(EmptyBucket)) then exit;
result:=ClickWaterPump;
end;
procedure SoftenClay(BucketType:integer);
var x,y,x1,y1,i,n:integer;
var c:Tpoint;
begin
if TabExists(4) then GameTab(4) else
begin
FindNormalRandoms;
exit;
end;
if BucketType=EmptyBucket then
begin
FTWait(1);
if FlagPresent then
begin
FFlag(0);
FTWait(1);
end;
if not(BucketSelected(EmptyBucket)) then SelectBucket(EmptyBucket);
ClickWaterPump;
i:=0;
repeat
FindThoseRandoms;
if FindDTM(FullBucket,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
if FindDTM(ClayDTM,x1,y1,MIX1,MIY1,MIX2,MIY2) then
MMouse(x,y,2,2);
Wait(50+random(20));
break;
end;
Wait(200);
i:=i+1;
until (i>=30);
if not(FindDTM(FullBucket,x,y,MIX1,MIY1,MIX2,MIY2)) then
begin
Writeln('No full buckets found!');
exit;
end;
i:=0;
repeat
FindThoseRandoms;
if not(FindDTM(EmptyBucket,x,y,MIX1,MIY1,MIX2,MIY2)) then break;
i:=i+1;
Wait(300);
until (i>=100);
end;
if Players[CurrentPlayer].Strings[0]='fill' then exit;
i:=0;
n:=0;
if not(FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then exit;
repeat
if not(BucketSelected(FullBucket)) then SelectBucket(FullBucket);
n:=n+1;
{if n<=20 then i:=15+random(14) else} i:=1+random(28);
c:=ItemCoords(i);
if FindDTM(ClayDTM,x,y,c.x-25,c.y-25,c.x+25,c.y+25) then
begin
MMouse(x,y,3,3);
Wait(150+random(100));
GetMousePos(x,y);
Mouse(x,y,0,0,true);
FTWait(3+random(1));
if ClickNpcChatTextRight('oft') then
begin
Wait(250+random(100));
ChooseOption('ll');
break;
end else
begin
GetMousePos(x,y);
Mouse(x,y,0,0,true);
FTWait(3+random(1));
if ClickNpcChatTextRight('oft') then
begin
Wait(250+random(100));
ChooseOption('ll');
break;
end else SoftenClay(BucketType);
end;
end else Wait(100);
until n>50;
if n>50 then
begin
if not(FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then Writeln('No clay') else
SoftenClay(BucketType);
exit;
end;
i:=0;
repeat
if FindDTM(SoftClay,x,y,MIX1,MIY1,MIX2,MIY2) then break;
FTWait(1);
i:=i+1;
until (i>=100);
i:=0;
if FindDTM(SoftClay,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
repeat
FindThoseRandoms;
if not(FindDTM(FullBucket,x,y,MIX1,MIY1,MIX2,MIY2)) then break;
if not(FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then break;
Wait(300);
i:=i+1;
until (i>=100);
end;
if FindDTM(ClayDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
SoftenClay(BucketType);
exit;
end;
if FindDTM(EmptyBucket,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
SoftenClay(BucketType);
exit;
end;
end;
procedure UseBank;
var ran1, ran2, DBucketType, WBucketType, ClayType:integer;
begin
FixBank;
ran1:=random(2);
ran2:=random(2);
case lowercase(Players[CurrentPlayer].Strings[0]) of
'wet' : begin
ClayType:=ClayDTM;
DBucketType:=EmptyBucket;
WBucketType:=FullBucket;
end;
'fill' : begin
ClayType:=0;
DBucketType:=FullBucket;
WBucketType:=EmptyBucket;
ran1:=1;
end;
'both' : begin
ClayType:=ClayDTM;
DBucketType:=0;
WBucketType:=FullBucket;
ran1:=2;
end;
end;
case ran1 of
0: begin
DepositSoftClay;
case ran2 of
0: begin
WithDrawClay(ClayType,WBucketType);
DepositBuckets(DBucketType);
WithdrawBuckets(ClayType,WBucketType);
end;
1: begin
WithdrawBuckets(ClayType,WBucketType);
DepositBuckets(DBucketType);
WithdrawClay(ClayType,WBucketType);
end;
end;
end;
1: begin
DepositBuckets(DBucketType);
case ran2 of
0: begin
WithdrawClay(ClayType,WBucketType);
DepositSoftClay;
WithdrawBuckets(ClayType,WBucketType);
end;
1: begin
WithdrawBuckets(ClayType,WBucketType);
DepositSoftClay;
WithdrawClay(ClayType,WBucketType);
end;
end;
end;
2: begin
ran1:=random(2);
if FindDTM(EmptyBucket,x,y,MIX1,MIY1,MIX2,MIY2) and FindDTM(FullBucket,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
case ran1 of
0: begin
DepositBuckets(EmptyBucket);
case ran2 of
0: begin
WithdrawClay(ClayDTM,FullBucket);
DepositSoftClay;
WithdrawBuckets(ClayDTM,FullBucket);
end;
1: begin
WithdrawBuckets(ClayDTM,FullBucket);
DepositSoftClay;
WithdrawClay(ClayDTM,FullBucket);
end;
end;
end;
1: begin
DepositSoftClay;
case ran2 of
0: begin
WithdrawClay(ClayDTM,FullBucket);
DepositBuckets(EmptyBucket);
WithdrawBuckets(ClayDTM,FullBucket);
end;
1: begin
WithdrawBuckets(ClayDTM,FullBucket);
DepositBuckets(EmptyBucket);
WithdrawClay(ClayDTM,FullBucket);
end;
end;
end;
end;
end else
begin
DepositSoftClay;
if FindDTM(FullBucket,x,y,MSX1,MSY1,MSX2,MSY2) then
WBucketType:=FullBucket else
if FindDTM(FullBucket,x,y,MIX1,MIY1,MIX2,MIY2) then
WBucketType:=FullBucket else WBucketType:=EmptyBucket;
WithdrawClay(ClayDTM,WBucketType);
end;
end;
end;
end;
procedure RepeatMe;
begin
repeat
if RoadColor=0 then RoadColor:=FindFallyRoadColor;
if not(Findcolor(x,y,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor:=FindFallyRoadColor;
Players[CurrentPlayer].Loc:=FindPosition;
if not(lowercase(Players[CurrentPlayer].Loc)='fally') then
begin
LogMeOut;
Players[CurrentPlayer].Active:=False;
break;
end;
WalkToBank;
OpenTheBank;
if BankScreen then
begin
if CountItemDTM(SoftClay)>0 then
begin
Inc(Players[CurrentPlayer].Integers[0]);
Inc(Banks);
Inc(Loads);
Inc(ReportVars[0]);
end else if CountItemDTM(FullBucket)>0 then
begin
Inc(Players[CurrentPlayer].Integers[0]);
Inc(Banks);
Inc(Loads);
Inc(ReportVars[0]);
end;
UseBank;
end;
ClearReport;
ProgReport;
if Loads > 0 then
begin
if Loads mod LoadsToDo = 0 then
begin
Writeln('Completed Workload');
ClearReport;
SRLRandomsReport;
ProgReport;
LogMeOut;
end;
end;
if (TimeFromMark(PlayerTime)>((MaxTimePerPlayer)*60*1000)) then
begin
Writeln('Player Time Exceeded');
ClearReport;
SRLRandomsReport;
ProgReport;
LogMeOut;
end;
if LoggedIn then
begin
if BankScreen then CloseBank;
FTWait(1);
if BankScreen then
begin
FTWait(2);
if BankScreen then CloseBank;
end;
case lowercase(Players[CurrentPlayer].strings[0]) of
'wet' : SoftenClay(FullBucket);
'fill' : begin
WalkToPump;
SoftenClay(EmptyBucket);
end;
'both' : begin
if FindDTM(FullBucket,x,y,MIX1,MIY1,MIX2,MIY2) then
SoftenClay(FullBucket) else
begin
WalkToPump;
SoftenClay(EmptyBucket);
end;
end;
end;
end;
if not(LoggedIn) then break;
if Loads > 0 then
begin
if Loads mod (LoadsToDo+Randomizer) = 0 then break;
end;
if (TimeFromMark(PlayerTime)>((MaxTimePerPlayer+Randomizer)*60*1000)) then
begin
Writeln('Time Exceeded');
break;
end;
until not(LoggedIn);
LogMeOut;
NextPlayer(Players[CurrentPlayer].Active);
Tries:=0;
Loads:=0;
Randomizer:=random(4);
MarkTime(PlayerTime);
end;
begin
SetupScript;
repeat
RepeatMe;
until false;
end.