SRL Archive - SRL Archives

WC.scar - PickUpBirdsNest : Boolean


Nava2

2008-10-25 12:46:17

Since I have seen lots of slower, older ones. I made a faster and more up-to-date one! :)

// ACA v2 With mods from Nava2
function FindBirdsNest(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.40);

if not(FindColorsTolerance(arP, 2832187, MSX1, MSY1, MSX2, MSY2, 11)) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.06) and (X <= 8.30) and (Y >= 1.14) and (Y <= 8.78) and (Z >= 0.81) and (Z <= 5.83) then
for j := 0 to arL2 do
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;

ararP := SplitTPAEx(arAP, 10, 10);
SortATPAFrom(ararP, Point(MSCX, MSCY));
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 5) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x - 4, P.y - 4, 9, 9);
Wait(100 + Random(100));
if (IsUpText('Take Bird')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

GetMousePos(fx, fy);
end;

function PickUpBirdsNest : Boolean;

var
x, y, SAngle, TAngle, T : Integer;

begin
Result := False;
if Pos('nest falls', GetBlackChatMessage) = 10 then
begin
Writeln('PickUpBirdsNest : Bird''s Nest has dropped, searching.');
SetAngle(True);
if FindBirdsNest(x, y) then
begin
Mouse(x, y, 0, 0, True);
Result := True;
Flag;
end else
begin
SAngle := Round(rs_GetCompassAngleDegrees);
TAngle := SAngle;
MarkTime(T);
repeat
TAngle := TAngle + RandomRange(40, 60);
if TAngle > (SAngle + 360) then
SetAngle(False);
if TAngle > (SAngle + 360 * 2) then
begin
SetAngle(True);
TAngle := SAngle;
end;
MakeCompass(IntToStr(TAngle));
if FindBirdsNest(x, y) then
begin
Mouse(x, y, 0, 0, True);
Flag;
Result := True;
Break;
end;
Wait(RandomRange(200, 300));
until (TimeFromMark(T) > 90000) or Result;
if (TimeFromMark(t) > 90000) and not Result then
Writeln('PickUpBirdsNest : Could not find Bird''s nest in 90 seconds.');
MakeCompass(IntToStr(SAngle));
end;
end;
if Result then Writeln('PickUpBirdsNest : Found and picked up Birds Nest.');
end;

Usage:
if PickUpBirdsNest then
Inc(BirdsNestCount);

Rate, Hate?

TravisV10

2008-10-25 18:56:54

Wow nice job! This seems advanced. The 90 second limit is smart.

Claymore

2008-10-26 00:24:38

One thing, YOURS OWNZ! MINE! THIS IS INCREDIBLE! Mind if i add this to my Woodcutting scriptd below? I like yours cuz its full of style etc…

Shuttleu

2008-10-26 05:57:13

cool okay well as you said i could i will replace the one in UCB with this one

~shut

NiCbaZ

2008-10-26 06:22:03

Nice , i like your use of ACA people should use it more often , it makes l33t functions.

Nava2

2008-10-26 11:41:35

Thanks all, and I just made it even faster…

I'm a speed whore at times. :)

Shuttleu

2008-10-26 11:43:10

whats differant that has made it faster?

~shut

n3ss3s

2008-10-26 14:15:07

Nice , i like your use of ACA people should use it more often , it makes l33t functions.


They are Nielsie's and Sumilion's leet functions :(

Hmm… I think it's time for me to make a rock finder once more.

Nava2

2008-10-27 08:19:48

From: n3ss3s
They are Nielsie's and Sumilion's leet functions :(

Hmm… I think it's time for me to make a rock finder once more.


That they are. :) But, the rest is mine… :D and I COULD have done it myself, I just have NO idea how to do HSL Calcs etc.

@Shut : All I did was add an InRange instead of doing maths and changed how the ATPA is arranged.. You should use the new version. :)

Nava2

2008-11-01 19:39:03

Fixed.. realized an error that I didn't see before… :(