SRL Archive - SRL Archives

FindPick!


n3ss3s

2008-03-13 13:36:43

Okay, well SRL's current FindPick uses the colors got with FindPickHeadColors from inventory with zero tolerance to find the pick head that started to fly - ever wondered where did all those pick heads end up while you were testing your powerminer? :p

QuickFix:

function FindPick: Boolean;
var
c, XH, YH, dx, dy, ex, ey, x, y, cts: Integer;
EC: TBox;
begin // checks for Blue ClickToContinue, but doesnt handle ClickToContinue.
result := true;
if FindColor(x, y, 16711680, 182, 439, 346, 457) then
begin
if FindNPCChatText('Pickaxe', Nothing) then // check for word PickAxe
begin
if InvFull then // First make some space for PickAxeHead
begin
if (FindBitmapSpiralTolerance(Ore, x, y, MIx1, MIy1, MIx2, MIy2, 50)) then
begin
Mouse(x, y, 5, 5, False);
ChooseOption('Drop');
end;
end;

case Wielding of // switch to appropriate GameTab;
True:
begin
GameTab(5);
EC.x1 := 570; EC.y1 := 287; EC.x2 := 603; EC.y2 := 320;
end;
False:
begin
GameTab(4);
EC.x1 := MIx1; EC.y1 := MIy1; EC.x2 := MIx2; EC.y2 := MIy2;
end
end;

if FindBitmapMaskTolerance(BrokenPick, dx, dy, EC.x1, EC.y1, EC.x2, EC.y2, 10, 10) then
begin // Broken Pickaxe Handler
NoPick := True;
case Random(5) of
0: TypeSend('arg');
1: TypeSend('aarg');
2: TypeSend('arghh');
3: TypeSend('dam');
4: TypeSend('sjee.');
end;
Result := False;
Exit;
end;

if FindBitmapMaskTolerance(PickAxeHandle, dx, dy, EC.x1, EC.y1, EC.x2, EC.y2, 10, 10) then
begin // PickHead & Handle Handler
GameTab(4);
repeat
if not (LoggedIn) then Exit;
x := Random(510) + 5;
y := Random(330) + 5;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if (FindColorSpiralTolerance(x, y, hc1, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc2, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc3, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc4, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc5, MSx1, MSy1, MSx2, MSy2, 10)) then
begin
MMouse(x, y, 2, 2);
if IsUpTextMultiCustom(['Take', 'pick', 'head']) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end;
FFlag(0);
Wait(1000 + Random(100));
end;
c := c + 1;
until ((FindBitmapMaskTolerance(PickAxeHead, x, y, MIx1, MIy1, MIx2, MIy2, 10, 10))
or (c >= 10));
ColorToleranceSpeed(cts);

if not FindBitmapMaskTolerance(PickAxeHead, x, y, MIx1, MIy1, MIx2, MIy2, 10, 10) then
begin
NoPick := True;
Result := False;
Exit;
end;
end;

// Attach
if Wielding then
begin
GameTab(5);
if FindBitmapMaskTolerance(PickAxeHandle, Xh, Yh, 560, 280, 615, 322, 10, 10) then
begin
WriteLn('Found Handle');
Mouse(Xh + 5, Yh + 11, 2, 2, True); // remove the handle, if any.
end;
end;

Wait(500);
GameTab(4);
Wait(500);

if FindBitmapMaskTolerance(PickAxeHead, dx, dy, MIx1, MIy1, MIx2, MIy2, 10, 10)
and FindBitmapMaskTolerance(PickAxeHandle, ex, ey, MIx1, MIy1, MIx2, MIy2, 10, 10) then
begin
Mouse(dx, dy, 0, 0, True);
Wait(1000 + Random(100));
Mouse(ex + 5, ey + 11, 2, 2, True);
PickAxeAttached := PickAxeAttached + 1;
WriteLn('Attached Head & Handle');
NoPick := False;
Result := True;
if Wielding then
begin
Wait(3000);
if FindColor(dx, dy, hc1, MIx1, MIy1, MIx2, MIy2) then
Mouse(dx, dy, 0, 0, True);
end;
end;
end;
end;
end;

Harry

2008-03-13 14:34:37

From: n3ss3s

if FindColor(x, y, 16711680, 182, 439, 346, 457) then


Can be replaced with if ClickContinue(False,False) then …

False, False finds the text, but will not wait for it, nor click on it.

n3ss3s

2008-03-13 14:38:41

Harry read…


a) I said this is a QuickFix
b) That was already in SRL
c) I fixed what is need to be fixed, no style stuffs fixed…

EvilChicken!

2008-03-18 12:22:54

I think this needs more attention if what you're written is correct. (About the pickaxe heads.) Nice work!

I.. Don't really have so much more to say about this. Devs should really take a look. Maybe for REV15 this will be included, who knows?

n3ss3s

2008-03-18 14:10:40

Well I once asked Wizzup did he commit it… /check… Well he has a strong opinion about "bbl" :rolleyes:

Wizzup?

2008-03-18 16:48:00

From: n3ss3s
Well I once asked Wizzup did he commit it… /check… Well he has a strong opinion about "bbl" :rolleyes:


I just committed it. ;)