From: pwnaz0r
got the DTM's already made, don't know why i didn't use mask. If you want, check new functions section, its under new find pick, close to the top. Finds broken pickaxe too :D
EDIT : http://www.villavu.com/forum/showthread.php?t=18813
I'll let you have a peek of mine, its alot better then the basic one :D, its still a work in process though :S
program New;
{.include SRL/SRL.Scar}
var
Ore, PickHead, PickHandle, BrokenPickHead, DetachedPickHead : Integer;
PicksFound : Integer;
HeadColor : TIntegerArray;
EquipPick, NoPick : Boolean;
procedure Load;
begin
Ore := 0;
PickHead := BitmapFromString(29, 13, 'beNqtk0EOACAIw/j/p/FmDAbs' +
'hN1MpGEwzLj8kA0poFSy5/rDSu7Iz49xPUs686/hDjRrlttR4XcGC' +
'gLvIXt2ghc49WogWe1kw3n2tEtZxfvLNQ==');
PickHandle := 0;
BrokenPickHead := BitmapFromString(26, 11, 'beNpjYMAP/iMBBsoAmg' +
'lEGvgfNyDVNOK9MJhNI95AgoFGnu3EaCE1wWDGJtYoJsMvyFz8rsI' +
'qhaadhHAGAJ1rsFA=');
DetachedPickHead := BitmapFromString(22, 15, 'beNpjYCAb/P//n4GB' +
'Uu2UGDLgJiBrJMOQAdH+HwmQEZu4lJHkAPK043I5MW7Dowt/qBKvE' +
'dMEXD4lCPCrJ8EpALiioV8=');
end;
function FindPickHeadColors : Boolean;
var
a : TPointArray;
Colors : TIntegerArray;
i, GenericColor : Integer;
x, y, tx, ty : Integer;
begin
Result := False;
if FindBitmapMaskTolerance(PickHead, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
begin
Result := True;
GenericColor := GetColor(x + 20, y + 7);
SetArrayLength(a, 350); //325-350
i := 0;
for tx := x to x + 30 do
for ty := y to y + 10 do
begin
a[i] := IntToPoint(tx, ty);
Inc(i);
end
Colors := GetColors(a);
ClearSameIntegers(Colors);
ColorToleranceSpeed(2);
for i := 0 to Length(Colors) - 1 do
if SimilarColors(GenericColor, Colors[i], 20) then
begin
SetLength(HeadColor, Length(HeadColor) + 1);
HeadColor[Length(HeadColor) - 1] := Colors[i];
end
ColorToleranceSpeed(1);
AddToReport('HeadColor Length = '+IntToStr(Length(HeadColor)));
for i := 0 to Length(HeadColor) - 1 do
AddToReport('HeadColor['+IntToStr(i)+'] = '+IntToStr(HeadColor[i]));
end
end;
function FindPick : Boolean;
var
a : TPointArray;
e : TPointArrayArray;
i, h : Integer;
x, y, tx, ty : Integer;
begin
Result := False;
NoPick := False;
if ( GetColor(461, 378) = 0 ) and ( GetColor(486, 388) = 0 ) then
if FindText(x, y, 'Pickaxe', NPCChars, 115, 375, 180, 395) then
begin
WriteLn('You need a pickaxe to mine this rock.');
if EquipPick then
GameTab(5)
else
GameTab(4);
Wait(200 + Random(200));
if FindBitmapMaskTolerance(BrokenPickHead, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
begin
WriteLn('Broken pickaxe');
NoPick := True;
if EquipPick then
Mouse(x + 10, y + 10, 5, 5, True);
GameTab(4);
Exit;
end
GameTab(4);
if InvCount >= 27 then
begin
for i := 0 to 1 do
if FindBitmapMaskTolerance(Ore, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
begin
Mouse(x + 10, y + 10, 5, 5, False);
ChooseOption('Drop');
Wait(50);
end
end
HighestAngle;
ColorToleranceSpeed(2);
for i := 0 to Length(HeadColor) - 1 do
begin
WriteLn('Search attempt #'+IntToStr(i));
FindColorsSpiralTolerance(MSCX, MSCY, a, HeadColor[i], MSX1, MSY1, MSX2, MSY2, 20);
if Length(a) <> 0 then
begin
WriteLn('a = '+IntToStr(Length(a)));
e := TPAToATPA(a, 10);
for h := 0 to High(e) do
begin
WriteLn('e['+IntToStr(h)+'] = '+IntToStr(Length(e[h])));
if ( not InRange(Length(e[h]), 5, 30) ) then
Continue;
MiddleTPAEx(e[h], x, y);
MMouse(x, y, 2, 2);
Wait(100 + Random(100));
if IsUpTextMultiCustom(['pick', 'head']) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
FFlag(0);
Wait(500 + Random(500));
Break;
end
end
end
if FindBitmapMaskTolerance(DetachedPickHead, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
Break;
if Random(10) = 0 then
begin
KeyDown(VK_Left);
Wait(Random(750));
KeyUp(VK_Left);
end
else
begin
KeyDown(VK_Right);
Wait(Random(750));
KeyUp(VK_Right);
end
end
ColorToleranceSpeed(1);
if EquipPick then
begin
WriteLn('Unequipping handle');
GameTab(5);
Wait(200 + Random(200));
if FindBitmapMaskTolerance(PickHandle, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
Mouse(x + 10, y + 10, 5, 5, True);
GameTab(4);
Wait(200 + Random(200));
end
if ( not FindBitmapMaskTolerance(DetachedPickHead, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) ) then
begin
WriteLn('Failed to find head');
NoPick := True;
Exit;
end
WriteLn('Found head');
if FindBitmapMaskTolerance(DetachedPickHead, tx, ty, MIX1, MIY1, MIX2, MIY2, 5, 5) and
FindBitmapMaskTolerance(PickHandle, x, y, MIX1, MIY1, MIX2, MIY2, 5, 5) then
begin
Mouse(tx + 10, ty + 10, 5, 5, True);
Wait(500 + Random(500));
Mouse(x + 10, y + 10, 5, 5, True);
WriteLn('Attached head & handle');
Result := True;
Inc(PicksFound);
if EquipPick then
begin
Wait(RandomRange(500, 1000));
WriteLn('Reequiping pick');
if FindBitmapMaskTolerance(PickHead, tx, ty, MIX1, MIY1, MIX2, MIY2, 5, 5) then
Mouse(x + 10, y + 10, 5, 5, True);
end
end
end
end;
begin
SetupSRL;
Load;
ClearDebug;
FindPickHeadColors;
end.