SCAR Code:
program UDL1;
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Misc\Users.Scar}
const
SRLID1 = '';
SRLPassword1 = '';
var
LoadsDone, TotalLoads, TotalWillows, NestsFound, EntsFound, Responded, Replaced, StrangeFruit, UDLFile, Levels, X, I: Integer;
DeBugText, Text: string;
procedure SetUpUDLScript;
begin
SRLPlayerForm(True, ['Is Axe Wielded?'], ['Pin Number?', 'Loads To Do'], [], []);
ActivateClient;
if (not (SRLID1 = '')) then
SRLID := SRLID1
else
SRLID := '3211';
if (not (SRLPassword1 = '')) then
SRLPassword := SRLPassword1
else
SRLPassword := 'thebest1';
WriteLn('Good Luck!');
Disguise('Ultimate Delux [UDL] Version 1');
LogInPlayer;
end;
procedure PlayersPreferance;
begin
Players[CurrentPlayer].Integers[2] := GetSkillLevel('Woodcutting');
MakeCompass('N');
SetAngle(True);
Wait(150 + Random(50));
SetRun(True);
Wait(50 + Random(25));
GameTab(4);
end;
function CountDTM(DTM: Integer): Integer;
var
I, X, Y: Integer;
TB: Tbox;
begin
GameTab(4);
for I := 1 to 28 do
begin
TB := InvBox(I);
if ExistsItem(I) then
if FindDTM(DTM, X, Y, TB.X1, TB.Y1, TB.X2, TB.Y2) then
Inc(Result);
end;
end;
function TextCoord(Text: Integer): TPoint;
begin
Result.X := 11;
Result.Y := 346 + (14 * (Text - 1));
end;
function GetBlueText(ChatLine: Integer): string;
var
TP: TPoint;
begin
TP := TextCoord(ChatLine);
Result := Trim(GetTextAtEx(TP.X - 2, TP.Y - 2, 0, SmallChars, False, False, 0, 1, 16711680, 80, False, tr_AllChars));
end;
function IsBlueText(Text: string; ChatLine: Integer): Boolean;
begin
Result := (Pos(Text, GetBlueText(ChatLine)) <> 0);
end;
function GetBlueChatMessage: string;
begin
Result := GetBlueText(8);
end;
function FindBlueChatMessage(ChatMsg: string): Boolean;
begin
Result := IsBlueText(ChatMsg, 8);
end;
function FindSafeSymbolIn(var X, Y: Integer; Name: string; X1, Y1, X2, Y2: Integer): Boolean;
var
Tries: Byte;
begin
Tries := 0;
while (Tries < 25) do
begin
Result := (GetSymbolColorIn(X, Y, LowerCase(Name), X1, Y1, X2, Y2) > 0);
if (Result) then
Exit;
Inc(Tries);
Wait(150 + Random(75));
end;
end;
function FindSafeSymbol(var X, Y: Integer; Name: string): Boolean;
var
Tries: Byte;
begin
Tries := 0;
while (Tries < 25) do
begin
Result := (GetSymbolColor(X, Y, LowerCase(Name)) > 0);
if (Result) then
Exit;
Inc(Tries);
Wait(150 + Random(75));
end;
end;
function Find2TPApoints(TPA1, TPA2: TPointArray; W, H: Integer): TPointArray;
var
I1, I2, L1, L2, R: LongInt;
begin
L1 := High(TPA1);
L2 := High(TPA2);
R := 0;
for I1 := 0 to L1 do
begin
for I2 := 0 to L2 do
begin
if (ABS(TPA1[I1].x - TPA2[I2].X) <= W) and (ABS(TPA1[I1].y - TPA2[I2].y) <= H) then
begin
Inc(R);
SetLength(Result, R + 1);
Result[r].x := ((TPA1[I1].x + TPA2[I2].X) div 2);
Result[r].y := ((TPA1[I1].y + TPA2[I2].Y) div 2);
end;
end;
end;
end;
function ItemCoordsDtm(Area: string; DTM: Integer): TPointArray;
var
StartX, StartY, Rowsize, Colsize, ColNumber, RowNumber, col, row: Integer;
X1, Y1, X2, Y2: Integer;
Itemx, Itemy: Integer;
I: Integer;
begin
SetArrayLength(Result, 0);
if (CheckArea(Area)) then
begin
Areainfo(Area, StartX, StartY, Rowsize, Colsize, ColNumber, RowNumber);
for row := 0 to RowNumber - 1 do
for col := 0 to ColNumber - 1 do
begin
X1 := StartX + col * Colsize;
Y1 := StartY + row * Rowsize;
X2 := X1 + Colsize;
Y2 := Y1 + Rowsize;
if (FindDTM(DTM, Itemx, Itemy, X1, Y1, X2, Y2)) then
begin
I := GetArrayLength(Result);
SetArrayLength(Result, I + 1);
Result[i].x := X1;
Result[i].y := Y1;
end;
end;
end;
end;
function CountItemsDtm(Area: string; DTM: Integer): Integer;
var
Coords: TPointArray;
begin
Coords := ItemCoordsDtm(Area, DTM);
Result := GetArrayLength(Coords);
end;
function FindStrangePlant: Boolean;
var
l, SPX, SPY, StartSPF, FruitCount, FruitDTM: Integer;
TPA1, TPA2, TPA3: TPointArray;
begin
if (not (LoggedIn)) then
Exit;
Result := False SPX := MSCX;
SPY := MSCY;
if (FindColorTolerance(SPX, SPY, 945749, MSCX - 100, MSCY - 110, MSCX + 100, MSCY + 90, 4)) and (FindColorTolerance(SPX, SPY, 743503, MSCX - 100, MSCY - 110, MSCX + 100, MSCY + 90, 4)) then
begin
FindColorsSpiralTolerance(SPX, SPY, TPA1, 945749, MSX1, MSY1, MSX2, MSY2, 4);
FindColorsSpiralTolerance(SPX, SPY, TPA2, 743503, MSX1, MSY1, MSX2, MSY2, 4);
SetLength(TPA1, HIgh(TPA1) + 1);
SetLength(TPA2, HIgh(TPA2) + 1);
TPA3 := Find2TPApoints(TPA1, TPA2, 18, 18);
l := HIgh(TPA3);
if (l >= 0) then
begin
if (FindObjTPA(SPX, SPY, 945749, 4, - 1, 18, 18, 4, ['trange'])) then
begin
WriteLn('Found Strange Plant attempting to Pick fruit.');
FruitDTM := DTMFromString('78DA63E4646060E0654001B30A8E30B0016 94' + '620FE0F048CDC400633031A60442281B40090E026A0860748 8812' + '50C30A244408A861C67433BA1A008467066B');
FruitCount := CountItemsDtm('Inv', FruitDTM);
Result := True;
MarkTime(StartSPF);
repeat
if (FindObjTPA(SPX, SPY, 945749, 4, - 1, 18, 18, 4, ['trange'])) then
begin
MMouse(SPX, SPY, 1, 1);
Wait(250 + Random(250));
if (isUpText('trange')) then
begin
Wait(250 + Random(250));
Mouse(SPX, SPY, 1, 1, false);
Wait(250 + Random(250));
ChooseOptIon('ick');
Wait(500 + Random(600));
if Pos('ready to', GetBlackChatMessage) > 5 then
Wait(2000 + Random(1000))
else if (Pos('fruit from', GetBlackChatMessage) > 5) or (CountItemsDtm('Inv', FruitDTM) > FruitCount) then
begin
Result := True;
WriteLn('Picked Fruit From Strange Plant. Waiting for Plant to die.');
FreeDTM(FruitDTM);
Inc(StrangeFruit);
ReportVars[5] := ReportVars[5] + 1;
repeat
BoredHuman;
Wait(2000 + random(1000));
until (not (FindObjTPA(SPX, SPY, 945749, 4, - 1, 18, 18, 4, ['trange']))) or (FindFight);
Exit;
end
else if (Pos('unable', GetBlackChatMessage) > 5) then
begin
Result := False;
WriteLn('The plant is not after you. Waiting for plant to go.');
FreeDTM(FruitDTM);
repeat
BoredHuman;
Wait(2000 + random(1000));
until (not (FindObjTPA(SPX, SPY, 945749, 4, - 1, 18, 18, 4, ['trange']))) or (FindFight);
Exit;
end;
end;
end
else
Break;
until (TimeFromMark(StartSPF) >= (120000)) or (FindFight);
WriteLn('Failed to Pick Fruit From Strange Plant.');
FreeDTM(FruitDTM);
end;
end;
end;
end;
function SearchBirdsNest: Boolean;
var
CTS, I, X, Y: Integer;
NestATPA: T2DPointArray;
NestTPA: TPointArray;
Nest: TPoint;
Timer: LongInt;
begin
if (FindText(X, Y, 'nest falls', SmallChars, 0, 400, 495, 460)) then
begin
MarkTime(Timer);
repeat
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
X := MSCX;
Y := MSCY;
FindColorsSpiralTolerance(X, Y, NestTPA, 3952984, MSCX - 100, MSCY - 100, MSCX + 100, MSCY + 100, 15);
NestATPA := TPAtoATPAEx(NestTPA, 5, 5);
for I := 0 to Length(NestATPA) - 1 do
begin
if (TimeFromMark(Timer) >= (10000)) then
Exit;
Nest := MIddleTPA(NestATPA[i]);
X := 0;
Y := 0;
MMouse(Nest.X, Nest.Y, 5, 5);
Wait(250);
if (isUpText('ird')) then
begin
Mouse(Nest.X, Nest.Y, 5, 5, True);
Result := True;
Inc(NestsFound);
ReportVars[6] := ReportVars[6] + 1;
Wait(250 + Random(150));
case (Random(8)) of
1: TypeSend('Found a Birds nest!');
2: TypeSend('Cool, I got a nest.');
3: TypeSend('Sweet! Found the nest!');
4: TypeSend('...');
5: TypeSend('Whew, got the nest.');
end;
Exit;
end;
end;
until (TimeFromMark(Timer) >= (10000)) or (Result);
Exit;
end
else
Exit;
end;
procedure RespondToPlayers;
var
Levels, Woodcutting: TStringArray;
CName, PName: string;
I: Byte;
begin
Woodcutting := ['Wc', 'wc', 'oodcut']
Levels := ['vl', 'evel', 'Lvl'];
LastChatter(CName);
PName := (Players[CurrentPlayer].Name);
for I := 0 to 2 do
begin
if (FindBlueChatMessage(Woodcutting[i])) then
if (FindBlueChatMessage(Levels[i])) then
begin
if (CName = (Lowercase(PName))) then
Exit;
case (Random(5)) of
1: TypeSend('Mine is ' + IntToStr(Players[CurrentPlayer].Integers[10]) + '.');
2: TypeSend(IntToStr(Players[CurrentPlayer].Integers[10]) + ', you?');
3: TypeSend(IntToStr(Players[CurrentPlayer].Integers[10]));
4: TypeSend('I have ' + IntToStr(Players[CurrentPlayer].Integers[10]) + ' Woodcutting.');
5: TypeSend('1, jokes! ' + IntToStr(Players[CurrentPlayer].Integers[10]) + '.');
end;
WriteLn('Responded [Levels]');
Inc(Responded);
Exit;
end;
Wait(150 + Random(50));
if (FindBlueChatMessage(Players[CurrentPlayer].Nick)) then
begin
if (CName = (Lowercase(PName))) then
Exit;
case (Random(5)) of
1: TypeSend('?');
2: TypeSend('Im too busy');
3: TypeSend('What?');
4: TypeSend('...');
5: TypeSend(' ');
end;
WriteLn('Responded [Players Nick]');
Inc(Responded);
Exit;
end;
end;
Exit;
end;
function FindEnt(RunAway: Boolean): Boolean;
var
MS, X, Y: Integer;
begin
if (not (IsUpText('illow'))) or (InvFull) or (not (LoggedIn)) then
Exit;
Result := FindColorTolerance(X, Y, 119764, 80, 6, 127, 20, 20);
if (Result) then
begin
Inc(EntsFound);
ReportVars[4] := ReportVars[4] + 1;
if (RunAway) then
begin
MS := MouseSpeed;
MouseSpeed := RandomRange(80, 100);
Mouse(MMCX - 10, MMCY - 10, 5, 5, True);
Flag();
Wait(500 + Random(250));
MouseSpeed := MS;
Mouse(MMCX + 10, MMCY + 10, 5, 5, True);
Flag;
end;
end;
Exit;
end;
procedure FindRandoms;
begin
if (not (IsUpText('illow'))) or (InvFull) or (not (LoggedIn)) then
Exit;
FindNormalRandoms;
Wait(500 + Random(250));
SearchBirdsNest;
FindStrangePlant;
Wait(500 + Random(250));
if (FindFight) then
RunTo('E', True);
end;
procedure FindLevelUp;
begin
if (not (LoggedIn)) then
Exit;
if (FindNPCChatText('gratu', Nothing)) then
begin
ReportVars[3] := ReportVars[3] + 1;
Inc(Levels);
end;
end;
procedure HumanMovement;
begin
if (not (LoggedIn)) or (InvFull) or (not (IsUpText('illow'))) then
Exit;
Wait(250 + Random(50));
case (Random(100)) of
1, 10, 25: IdleTime(500 + Random(500), 200, 0.01);
2, 12, 54:
begin
HoverSkill('Woodcutting', False);
Wait(500 + Random(250));
GameTab(4);
Exit;
end;
3, 30, 57:
begin
HoverSkill('Firemaking', False);
Wait(500 + Random(250));
GameTab(4);
Exit;
end;
4, 20, 48: RandomMovement;
5, 50, 75: PickUpMouse;
6, 36, 54: SleepAndMoveMouse(5000 + Random(750));
end;
end;
function DTMFromFunction(WhatDTM: Integer): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: array [0..5] of TDTMPointDef;
TempTDTM: TDTM;
begin
case (WhatDTM) of
0:
begin
dtmMainPoint.x := 626;
dtmMainPoint.y := 84;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 12961221;
dtmMainPoint.Tolerance := 255;
dtmSubPoints[0].x := 626;
dtmSubPoints[0].y := 84;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 12961221;
dtmSubPoints[0].Tolerance := 255;
dtmSubPoints[1].x := 617;
dtmSubPoints[1].y := 81;
dtmSubPoints[1].AreaSize := 4;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 195836;
dtmSubPoints[1].Tolerance := 5;
dtmSubPoints[2].x := 617;
dtmSubPoints[2].y := 72;
dtmSubPoints[2].AreaSize := 4;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 195836;
dtmSubPoints[2].Tolerance := 5;
dtmSubPoints[3].x := 609;
dtmSubPoints[3].y := 85;
dtmSubPoints[3].AreaSize := 4;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 195836;
dtmSubPoints[3].Tolerance := 5;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
1:
begin
dtmMainPoint.x := 577;
dtmMainPoint.y := 115;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 0;
dtmMainPoint.Tolerance := 255;
dtmSubPoints[0].x := 577;
dtmSubPoints[0].y := 115;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 0;
dtmSubPoints[0].Tolerance := 255;
dtmSubPoints[1].x := 570;
dtmSubPoints[1].y := 107;
dtmSubPoints[1].AreaSize := 4;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := FindRockColor;
dtmSubPoints[1].Tolerance := 1;
dtmSubPoints[2].x := 576;
dtmSubPoints[2].y := 123;
dtmSubPoints[2].AreaSize := 4;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := FindRockColor;
dtmSubPoints[2].Tolerance := 1;
dtmSubPoints[3].x := 580;
dtmSubPoints[3].y := 127;
dtmSubPoints[3].AreaSize := 4;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := FindRockColor;
dtmSubPoints[3].Tolerance := 1;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
end;
WriteLn(IntToStr(WhatDTM) + ' DTM has been loaded.');
Exit;
end;
function MMDTMRotated(DTM: Integer; var X, Y: Integer; X1, Y1, X2, Y2: Integer): Boolean;
var
T, S, AngleFound: Extended;
begin
if (FindDTM(DTM, X, Y, X1, Y1, X2, Y2)) then
if (RS_OnMiniMap(X, Y)) then
begin
Result := True;
Exit;
end;
repeat
S := 0.3;
repeat
if (FindDTMRotated(DTM, X, Y, X1, Y1, X2, Y2, 0 - T, 0 + T, S, AngleFound)) then
if (RS_OnMiniMap(X, Y)) then
begin
Result := True;
Exit;
end;
S := S - 0.1;
until (S <= 0.1);
T := T + (Pi / 20);
until (T >= Pi / 3);
end;
function IsAxeBroken: Boolean;
var
Dragon, Broken, X, Y: Integer;
begin
if (FindBlackChatMessage('an axe')) then
begin
if (Players[CurrentPlayer].Booleans[0] = True) then
GameTab(5);
if (Players[CurrentPlayer].Booleans[0] = False) then
GameTab(4);
Broken := DTMFromString('78DA63CC666260B8C580025A92051824813 42' + '310FF0702C662A09A3B0C6880118904D2A54035B709A82903 AAB9' + '4F404D3250CD47FC6A00A1090BB2');
if (FindDTM(Broken, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(Broken);
Result := True;
Wait(250 + Random(150));
Mouse(X, Y, 3, 3, True);
Wait(150 + Random(50));
GameTab(4);
end
else
begin
Dragon := DTMFromString('78DA632C61626078C48001FE03312388060 2C' + '622A09A37E82A1819B8A06AC0BC2A6CE6A0A94904AA794B40 4D31' + '50CD4DFC6A00B38F0BE6');
if (FindDTM(Dragon, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(Dragon);
Result := True;
Wait(250 + Random(150));
Mouse(X, Y, 3, 3, True);
Wait(150 + Random(50));
GameTab(4);
end
else
begin
FreeDTM(Dragon);
WriteLn('False Alarm.');
Wait(150 + Random(50));
GameTab(4);
Exit;
end;
end;
WriteLn('Found Broken Axe.');
Exit;
end;
end;
function WieldAxe: Boolean;
var
Dragon, Axe, X, Y: Integer;
begin
GameTab(4);
Wait(250 + Random(25));
Axe := DTMFromString('78DA63CC666260B8CD80025A92051824813 42' + '310FF0702C672A09A7B0C6880118904D2A540353708A82901 AA79' + '48404D3250CD47FC6A00A3CD0BB6');
if (FindDTM(Axe, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(Axe);
Result := True;
WriteLn('Wielded the Axe.');
Wait(250 + Random(100));
Mouse(X, Y, 3, 3, True);
Exit;
end
else
FreeDTM(Axe);
Dragon := DTMFromString('78DA63F4626260F062644007FF811824FA1 F0' + '8186D806ABCD1D530327041D580793E4035AE44A80926A0C6 04A8' + '2606BF1A00225D081C');
if (FindDTM(Dragon, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(Dragon);
Result := True;
WriteLn('Wielded the Dragon Axe.');
Wait(250 + Random(100));
Mouse(X, Y, 3, 3, True);
Exit;
end
else
FreeDTM(Dragon);
Exit;
end;
function DBToDT: Boolean;
var
DTM, X, Y: Integer;
begin
DTM := DTMFromFunction(0);
if (MMDTMRotated(DTM, X, Y, MMX1, MMY1, MMX2, MMY2)) then
begin
FreeDTM(DTM);
Mouse(X - 25, Y + 27, 5, 3, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found DTM0.');
end
else
begin
FreeDTM(DTM);
DTM := DTMFromFunction(1);
if (MMDTMRotated(DTM, X, Y, MMX1, MMY1, MMX2, MMY2)) then
begin
FreeDTM(DTM);
Mouse(X + 26, Y - 5, 5, 5, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found DTM1.');
end
else
begin
FreeDTM(DTM);
if (RadialRoadWalk(FindWaterColor, 200, 220, 60, 1, 1)) then
begin
Wait(500 + Random(250));
Flag;
WriteLn('Detected Water Color!');
end
else
begin
if (FindSafeSymbol(X, Y, 'Fish')) then
begin
Mouse(X, Y - 40, 10, 5, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found Fish symbol.');
end
else
begin
if (FindSafeSymbol(X, Y, 'Bank')) then
begin
Mouse(X - 32, Y + 40, 3, 5, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found Bank symbol.');
end
else
begin
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
end;
end;
end;
end;
Result := True;
Exit;
end;
function DTToDB: Boolean;
var
DTM, X, Y: Integer;
begin
DTM := DTMFromFunction(0);
if (MMDTMRotated(DTM, X, Y, MMX1, MMY1, MMX2, MMY2)) then
begin
FreeDTM(DTM);
Mouse(X, Y, 3, 5, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found DTM0.');
end
else
begin
HumanMovement;
FreeDTM(DTM);
if (FindSafeSymbol(X, Y, 'Bank')) then
begin
Mouse(X, Y, 5, 3, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found Bank symbol.');
end
else
begin
HumanMovement;
DTM := DTMFromFunction(1);
if (MMDTMRotated(DTM, X, Y, MMX1, MMY1, MMX2, MMY2)) then
begin
FreeDTM(DTM);
Mouse(X + 47, Y + 30, 3, 5, True);
Wait(500 + Random(250));
Flag;
WriteLn('Found DTM1.');
end
else
begin
FreeDTM(DTM);
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
end;
end;
Result := True;
Exit;
end;
function MouseOverTree(var A, B: Integer; Click: Boolean) : Boolean;
var
TreeColor : array[0..3] of Integer;
CX, CY, X, Y: Integer;
I, L: Byte;
begin
TreeColor[0] := 4415574;
TreeColor[1] := 1652011;
TreeColor[2] := 3560263;
I := 10;
CX := MSCX;
CY := MSCY;
Wait(1000);
repeat
if (FindColorSpiralTolerance(CX, CY, TreeColor[0], MSCX - 50, MSCY - 55, MSCX + 50, MSCY + 55, I)) then
for L := 0 to (3 - 1) do
if (FindColorTolerance(X, Y, TreeColor[L], CX - 25, CY - 30, CX + 25, CY + 30, I)) then
if (L = 2) then
begin
case (Random(2)) of
0 : begin
A := X;
B := Y;
end;
1 : begin
A := CX
B := CY;
end;
end;
MMouse(A, B, 5, 10);
Wait(150 + Random(75));
if (IsUpText('illow')) then
begin
GetMousePos(A, B);
if (Click) then
Mouse(A, B, 0, 0, True);
Result := True;
Exit;
end;
FindNormalRandoms;
end;
I := I + 5;
until(I > 25);
FindNormalRandoms;
end;
function FindWillowTree(var XX, YY: Integer; Color, X1, Y1, X2, Y2: Integer; Tolerance: Byte): Boolean;
var
ATPA: T2DPointArray;
TPA : TPointArray;
I, C, CTS, Count: Integer;
Colors : TIntegerArray;
SortedTPA : TPointArray;
X, Y, Z, H, S, L: Extended;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.15, 0.5);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, X1, Y1, X2, Y2, Tolerance);
ColorToleranceSpeed(CTS);
SetColorspeed2Modifiers(0.2, 0.2);
TPA:=ReArrangeandShortenArrayEx(TPA, 5, 5);
Colors := GetColors(TPA);
SetLength(SortedTPA, Length(TPA));
Count := 0;
for C := 0 to High(TPA) do
begin
ColorToXYZ(Colors[i], X, Y, Z);
if (X > 20) and (X < 30) then
if (Y > 13) and (Y < 23) then
if (Z > 26) and (Z < 36) then
begin
ColorToHSL(Colors[i], H, S, L);
if (H > 20) and (H < 30) then
if (S > 13) and (S < 23) then
if (L > 26) and (L < 36) then
begin
SortedTPA[Count] := TPA[C];
Inc(Count);
end;
end;
end;
SetLength(SortedTPA, Count);
SortedTPA := TPA;
begin
ATPA := SplitTPAEx(SortedTPA, 12, 12);
SortATPAFrom(ATPA, IntToPoint(MSCX, MSCY));
for I := 0 to High(ATPA) do
if Length(ATPA[i]) >= 50 then
begin
MiddleTPAEx(ATPA[i], XX, YY);
MMouse(XX, YY, 10, 15);
Wait(150 + Random(50));
if (IsUpText('illow')) and (not (FindEnt(False))) then
begin
GetMousePos(XX, YY);
Result := True;
Exit;
end;
end;
end;
end;
procedure GatherDraynorWillows;
var
X, Y, ColorA, ColorB, ColorC, ColorD: Integer;
Timer: LongInt;
Tries: Byte;
begin
if (not (LoggedIn)) then
Exit;
repeat
if (IsAxeBroken) then
Exit;
FindNormalRandoms;
if (FindWillowTree(X, Y, 4349520, MSX1, MSY1, MSX2, MSY2, 15)) or (IsUpText('illow')) then
begin
MarkTime(Timer);
Tries := 0;
Mouse(X, Y, 0, 0, True);
ColorA := GetColor(MMCX - 25, MMCY - 25);
ColorB := GetColor(MMCX + 25, MMCY + 25);
Wait(500);
Flag;
ColorC := GetColor(MMCX - 25, MMCY - 25);
ColorD := GetColor(MMCX + 25, MMCY + 25);
if (not (ColorA = ColorC)) and (not (ColorB = ColorD)) then
begin
MouseOverTree(X, Y, False);
if (FindEnt(True)) then
FindWillowTree(X, Y, 4349520, MSX1, MSY1, MSX2, MSY2, 15);
end;
repeat
if (FindEnt(True)) then
Break;
FindRandoms;
HumanMovement;
RespondToPlayers;
MMouse(X, Y, 5, 5);
until (TimeFromMark(Timer) >= (30000 + Random(5000))) or (not (IsUpText('illow'))) or (InvFull) or (not (LoggedIn));
end
else
begin
FindNormalRandoms;
Inc(Tries);
if (Tries > 15) then
begin
Players[CurrentPlayer].Active := False;
Tries := 0;
LogOut;
Exit;
end;
end;
FindLevelUp;
until (InvFull) or (not (LoggedIn));
WriteLn('Finished chopping Willows.');
Exit;
end;
function OpenTheBank:Boolean;
var
I, X, Y, CTS: Integer;
TPA: TPointArray;
Timer: LongInt;
begin
if (BankScreen) or (PinScreen) then
begin
Result := True;
Exit;
end;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX - 20, MSCY, TPA, 2578286, MSCX - 80, MSCY + 45, MSCX + 15, MSCY + 120, 10);
TPA := ReArrangeAndShortenArray(TPA, 15);
MarkTime(Timer);
for I := 0 to High(TPA) do
begin
MMouse(TPA[i].X, TPA[i].Y, 5, 5);
Wait(150 + Random(75));
if (IsUpText('booth')) then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
Wait(150 + Random(75));
ChooseOption('e-q');
Wait(500);
Flag;
Result := True;
ColorToleranceSpeed(CTS);
Exit;
end;
Wait(500 + Random(250));
if (TimeFromMark(Timer) > (75000 + (Random(2500)))) then
Exit;
if (BankScreen) or (PinScreen) then
begin
Result := True;
Exit;
end;
end;
ColorToleranceSpeed(CTS);
end;
function BankItems: Boolean;
var
DragonAxe, BrokenAxe, Replacement, Willow, EXPs, X, Y, Tries: Integer;
begin
if (not (LoggedIn)) then
Exit;
repeat
if (not (OpenTheBank)) then
if (not (OpenBankFast('db'))) then
HumanMovement;
if (not (LoggedIn)) then
begin
Players[CurrentPlayer].Active := False;
Tries := 0;
LogOut;
Exit;
end;
Inc(Tries);
if (Tries > 19) then
begin
Players[CurrentPlayer].Active := False;
Tries := 0;
LogOut;
Exit;
end;
until (BankScreen) or (PinScreen);
Wait(1500 + Random(500));
Tries := 0;
if (PinScreen) then
begin
InPin(IntToStr(Players[CurrentPlayer].Integers[0]));
WriteLn('Entered Players Pin Number.');
Wait(1750 + Random(250));
end;
if (BankScreen) then
begin
if (IsAxeBroken) then
begin
BrokenAxe := DTMFromString('78DA63CC666260B8C580025A92051824813 42' + '310FF0702C662A09A3B0C6880118904D2A54035B709A82903 AAB9' + '4F404D3250CD47FC6A00A1090BB2');
if (FindDTM(BrokenAxe, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(BrokenAxe);
Wait(250 + Random(50));
Mouse(X, Y, 3, 3, True);
WriteLn('Deposited the Broken Axe.');
end
else
begin
FreeDTM(BrokenAxe);
DragonAxe := DTMFromString('78DA632C61626078C48001FE03312388060 2C' + '622A09A37E82A1819B8A06AC0BC2A6CE6A0A94904AA794B40 4D31' + '50CD4DFC6A00B38F0BE6');
if (FindDTM(DragonAxe, X, Y, MIX1, MIY1, MIX2, MIY2)) then
begin
FreeDTM(DragonAxe);
Wait(250 + Random(50));
Mouse(X, Y, 3, 3, True);
WriteLn('Deposited the Dragon Axe.');
end
else
FreeDTM(DragonAxe);
Wait(250 + Random(50));
FIxBank;
Replacement := DTMFromString('78DA63CC666260B8CD80025A92051824813 42' + '310FF0702C672A09A7B0C6880118904D2A540353708A82901 AA79' + '48404D3250CD47FC6A00A3CD0BB6');
if FindDTM(Replacement, X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
FreeDTM(Replacement);
Wait(500 + Random(500));
Mouse(X, Y, 3, 3, True);
end
else
begin
FreeDTM(Replacement);
WriteLn('Failed to Find an Axe In the Bank.');
WriteLn('Make sure It is on the fIrst slot.');
CloseBank;
Wait(250);
Players[CurrentPlayer].Active := False;
LogOut;
Exit;
end;
WriteLn('Replaced the Old Axe wIth a New Axe.');
Inc(Replaced);
CloseBank;
Wait(500 + Random(250));
WieldAxe;
Exit;
end;
end;
Willow := DTMFromString('78DA63B463626078CA800242BCE51858813 42' + '310FF07024607A09A3B0C6880118904D23E40350F09A8B105 AAF9' + '48408D3150CD0BFC6A001AAD0A8C');
EXPs := CountDTM(Willow);
ReportVars[2] := ReportVars[2] + (EXPs * 68);
ReportVars[1] := ReportVars[1] + EXPs;
TotalWillows := TotalWillows + EXPs;
Wait(50 + Random(25));
if FindDTM(Willow, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
FreeDTM(Willow);
Mouse(X, Y, 3, 3, False);
Wait(175 + Random(50));
ChooseOptIon('t-A');
Result := True;
end
else
begin
FreeDTM(Willow);
Deposit(2, 28, True);
Result := True;
Wait(150 + Random(50));
end;
Wait(500 + Random(250));
if (Players[CurrentPlayer].Booleans[0] = False) then
begin
Deposit(2, 28, True);
end
else
Deposit(1, 28, True);
WriteLn('Finished Banking.');
CloseBank;
ReportVars[0] := ReportVars[0] + 1;
Inc(TotalLoads);
Inc(LoadsDone);
Exit;
end;
end;
procedure ProgressReport;
begin
ClearDeBug;
Text := '';
X := 148 - Length(TheDate(1));
for I := 1 to X do
Insert(chr(32), Text, Length(Text));
Writeln(Text + '.');
WriteLn(' _Progress Report_________________________________ ');
WriteLn('/ \');
WriteLn('| [UDL] Draynor Willow Whacker! |');
WriteLn('|________________________________________ _________|');
WriteLn('| | |');
WriteLn('| Time Running | ' + TimeRunning);
WriteLn('| Loads Done | ' + IntToStr(TotalLoads));
WriteLn('| Total Willows | ' + IntToStr(TotalWillows));
WriteLn('| Total EXP | ' + IntToStr(TotalWillows * 68));
WriteLn('| Total Levels | ' + IntToStr(Levels));
WriteLn('|________________________________________ _________|');
WriteLn('| |');
WriteLn('| Ents Found | ' + IntToStr(EntsFound));
WriteLn('| Plants Found | ' + IntToStr(StrangeFruit));
WriteLn('| Nests Found | ' + IntToStr(NestsFound));
WriteLn('| Response Made | ' + IntToStr(Responded));
WriteLn('| Axes Replaced | ' + IntToStr(Replaced));
WriteLn('|________________|_______________________ _________|');
WriteLn('| |');
WriteLn('| Version 2.0 |');
WriteLn('|________________________________________ _________|');
Text := '';
UDLFile := OpenFile(ScriptPath + '[UDL] Draynor Willow Whacker.txt', False);
ReadFileString(UDLFile, Text, FileSize(UDLFile));
CloseFile(UDLFile);
UDLFile := RewriteFile(ScriptPath + '[UDL] Draynor Willow Whacker.txt', False);
Delete(Text, LastPos(TheDate(1), Text) + Length(TheDate(1)) + Length(TheTime) + 3, Length(Text));
DebugText := GetDebugText;
DebugText := Copy(DebugText, LastPos('_Prog', DebugText) - X - 46, Length(DebugText));
Insert(DebugText, Text, Length(Text));
WriteFileString(UDLFile, Text);
CloseFile(UDLFile);
end;
procedure MainLoop;
begin
LogInPlayer;
PlayersPreferance;
repeat
DBToDT;
GatherDraynorWillows;
DTToDB;
BankItems;
ProgressReport;
until (LoadsDone >= Players[CurrentPlayer].Integers[1]) or (not (LoggedIn));
NextPlayer(Players[CurrentPlayer].Active);
LoadsDone := 0;
end;
begin
SetUpSRL;
Writeln('Progress Reports saved to ' + ScriptPath + '[UDL] Draynor Willow Whacker.txt');
Text := '';
if (FileExists(ScriptPath + '[UDL] Draynor Willow Whacker.txt')) then
begin
UDLFile := OpenFile(ScriptPath + '[UDL] Draynor Willow Whacker.txt', False);
ReadFileString(UDLFile, Text, FileSize(UDLFile));
CloseFile(UDLFile);
Writeln('Please post your current reports from the directory above on the script thread.');
end;
UDLFile := RewriteFile(ScriptPath + '[UDL] Draynor Willow Whacker.txt', False);
if (Text <> '') then
WriteFileString(UDLFile, Text);
WriteFileString(UDLFile, TheDate(1) + ', ' + TheTime + ' ');
CloseFile(UDLFile);
ScriptID := '1014';
SetUpUDLScript;
repeat
MainLoop;
until (Players[HowManyPlayers - 1].Active = False);
end.