Well I've broken down the detection function for ScapeRune, and all of the code works perfectly…Maybe your script just lagged when it got to that part? I really don't know what would of caused it not to detect it. It detects it fine right now.
I found out it was failing at
FindBobsServant. The
rs_GetUpText was causing the problem, so was the color being used. I fixed that and it started finding the servant perfectly. Here's the working function:
function FindBobsServant: Boolean;
var
ATPA: T2DPointArray;
TPA: TPointArray;
I, cts ,x ,y, k: Integer;
begin
if (not LoggedIn) then Exit;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.03, 0.22);
FindColorsTolerance(TPA, 1071730, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := TPAtoATPAEx(TPA, 50, 50);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
k := High(atpa);
For I:= 0 to k do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 1, 1);
Wait(150 + Random(70));
GetMousePos(x, y);
Wait(150 + Random(50));
if(InRange(CountColorTolerance(180931, 7, 7, 124, 24, 36), 75, 85))then
Continue;
Mouse(x, y, 0, 0, True);
FFlag(0);
ColorToleranceSpeed(cts);
Result := True;
Exit;
end;
end;
The
PickUpFishingNet function was also messing up because of the UpText. Fixed this also:
function PickupFishingNet: Boolean;
var
cts, bmpDropDot, cx, cy, tries, i, pntl: integer;
Points: TPointArray;
begin
if (not LoggedIn) then Exit;
bmpDropDot := BitmapFromString(4, 3, 'FF3636FE2020FC0606E90000FE0C0CF' +
'C0606F10000CE0000000001D90000BC0000000001');
repeat
cx := mmcx;
cy := mmcy;
if FindBitmapSpiralTolerance(bmpdropdot, cx, cy, mmx1, mmy1, mmx2, mmy2, 30) then
MFNF(cx + 3, cy + 3, 1, 1);
FFlag(0);
Wait(1000 + Random(1000));
MakeCompass('n');
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.016, 5.5);
FindColorsSpiralTolerance(mscx, mscy, points, 1845815, msx1, msy1, msx2, msy2, 15);
SetColorspeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
ReArrangeandShortenArrayEx(points, 40, 40);
SortTPAFrom(points, point(mscx, mscy));
points := RemovePointsInBox(points, IntToBox(mscx-25, mscy-30, mscx+25, mscy+30));
points := FilterTPA(mscx, mscy, 100, points);
if (GetArrayLength(points) > 5) then
pntl := 5
else
pntl := GetArraylength(points) - 1;
for i := 0 to pntl-1 do
begin
MMouse(points[i].x, points[i].y, 0, 0);
Wait(500 + Random(500));
if (InRange(CountColorTolerance(3636702, 7, 7, 124, 24, 36), 250, 350)) then
begin
Mouse(points[i].x, points[i].y, 0, 0, False);
Result := ChooseOption('ake')
FFlag(0);
Wait(2000 + Random(1000));
Freebitmap(bmpDropDot);
Exit;
//Break;
end else
tries := tries + 1;
end;
end;
until ((Result) or (tries > 5));
Result := False;
Freebitmap(bmpDropDot);
end;
The DTM walking on
WalkToStatue was really messed up, only the scared cat was working. I replaced them with simple MouseBox's where the statue and a net was always visible no matter where in the box was clicked. It will also be in a spot to be able to find a fishing spot. Here's the working function:
function WalkToStatue(statue: integer): Boolean;
var
DDTM: TDTM;
bx, by, ptc, x, y: Integer;
begin
if (not LoggedIn) then Exit;
if (not FindColor(x, y, WaterColor, MMX1, MMY1, MMX2, MMY2)) or (WaterColor < 1) then
WaterColor := FindWaterColor;
case statue of
0 : MouseBox(674, 86, 683, 95, 1);
1 : MouseBox(615, 120, 620, 128, 1);
2 : MouseBox(618, 42, 625, 48, 1);
3, 4 : MouseBox(573, 72, 581, 84, 1);
end;
ptc := AddDTM(ddtm);
if DTMRotated(ptc, bx, by, mmx1, mmy1, mmx2, mmy2) then
begin
MFF(bx, by, 1, 1); //Walk to it
FFlag(0);
Result := True;
end else
Result := False;
FreeDTM(ptc);
end;
Also, the
FishAThing function was messing up because of the UpText, fixed this too. Here's the working function:
function FishAThing: Boolean;
var
points1, points2, rp: TPointArray;
l, i, cts, x, y, t, d: integer;
atpa: T2DPointArray;
begin
Result := False;
if (not LoggedIn) then Exit;
d := DTMFromString('78DA63CC606260D0676440066D89760C1A401' +
'A24FA1F0818D3816AD450D54064612490CE07AA5127A0A6840873' +
'8A30DD83A12609A8C68C809A04A01A3DFC6A00EEB6098E'); //Dtm from cooked Fishlike thing
GameTab(tab_Inv);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(mscx, mscy, points1, 11512485, msx1, msy1, msx2, msy2, 20);
findcolorsSpiraltolerance(mscx, mscy, points2, 11578022, msx1, msy1, msx2, msy2, 20);
rp := CombineTPA(points1, points2);
atpa := TPAtoATPAEx(rp, 30, 30);
l := High(atpa);
if (l > 5) then
l := 5;
for i := 0 to l do
begin
MiddleTPAEx(atpa[i], x, y);
MMouse(x, y, 5, 5);
Wait(500 + Random(25));
if (InRange(CountColorTolerance(15460378, 7, 7, 121, 21, 36), 130, 160)) then
begin
Result := True;
ColorToleranceSpeed(cts);
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
t := GetSystemTime;
repeat
Wait(2000 + Random(500));
until (ClickContinue(True, True)) or ((GetSystemTime - t) > 10000);
if ((GetSystemTime - t) < 10000) then
if (FindDTM(d, x, y, mix1, miy1, mix2, miy2)) then
begin
Result := True;
ColorToleranceSpeed(cts);
FreeDTM(d);
exit;
end;
end;
end;
FreeDTM(d);
ColorToleranceSpeed(cts);
end;
The
UncookBobFish function needed a new DTM and had to be fixed for the UpText. Here's the working function:
function UncookBobFish: Boolean;
var
dtmFish, x, y: Integer;
begin
if (not LoggedIn) then Exit;
WriteLn('Bobsolver - uncooking fish...');
GameTab(tab_Inv);
dtmFish:= DTMFromString('78DA639CCAC4C0F0840105C8589E07D38C503' +
'E632750CD7B0634C084AAA603C87F4940CD4220FF0E01353380FC' +
'D704D4F403F9F709A8590AE43F25A0662290FF96801A90DF1F11E' +
'1E6BB04D42C266C0E00556111A2');
if not(FindDTM(dtmFish, x, y, mix1, miy1, mix2, miy2)) then
begin
FreeDTM(dtmFish);
Result := False;
Exit;
end
else
begin
FreeDTM(dtmFish);
Mouse(x, y, 5, 5, False);
Chooseoption('Use');
end;
Wait(500 + Random(200));
if(FindColor(x, y, 1579288, MSX1, MSY1, MSX2, MSY2))then
begin
MouseBox(228, 109, 254, 127, 1);
FFlag(0);
Wait(3000 + Random(5000));
Result := True;
WriteLn('Bobsolver - uncooked the fish :)');
end;
end;
GiveBobDaFish needed a new DTM and had to be fixed for the UpText as well. Here's the working script:
function GiveBobDaFish: Boolean;
var
dtmRawFish, x, y, fx, fy, i, Hi, CTS: Integer;
P: TPointArray;
aP: T2DPointArray;
begin
if (not LoggedIn) then Exit;
dtmRawFish := DTMFromString('78DA639CC6C4C0F0840105C8589E07D38C503' +
'E631750CD070634C084AAA613C87F4C40CD2220FF0E0135CB30DD' +
'83A1663A90FF86809A8940FE3D22DCF390809A0E20FF250135938' +
'0FCB704D4F400F90F08A89903E43F27C2EF77F1AB0100EC9114A1' +
'');
if (not(FindDTM(dtmRawFish, x, y, mix1, miy1, mix2, miy2))) then
begin
FreeDTM(dtmRawFish);
Exit;
end else
begin
FreeDTM(dtmRawFish);
Mouse(x, y, 5, 5, True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MSCX, MSCY, P, 3947585, MSX1, MSY1, MSX2, MSY2, 20);
if Length(P) = 0 then
begin
ColorToleranceSpeed(CTS);
Mouse(x, y, 5, 5, True);
Exit;
end;
aP := SplitTPA(P, 3);
SortATPASize(aP, True);
Hi := High(aP);
for i := 0 to Min(Hi, 5) do
begin
MiddleTPAEx(aP[i], fx, fy);
MMouse(fx, fy, 3, 3);
Wait(500+Random(200));
if FindColorTolerance(x, y, 3289653, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MouseBox(232, 178, 236, 184, 1);
FFlag(0);
Wait(1000+Random(1000));
Result := True;
Break;
end;
end;
ColorToleranceSpeed(CTS);
if not Result then
begin
Mouse(x, y, 5, 5, True); //unselect
exit;
end;
end;
repeat
Wait(500 + Random(1000));
ClickContinue(True, True);
until(GetColor(435, 458) = 6321792) or (not LoggedIn);
end;
LeaveBobsIsland needed to be updated for the UpText. Here's the working function:
function LeaveBobsIsland: Boolean;
begin
Result := False;
if (not LoggedIn) then Exit;
if InRange(CountColorTolerance(180931, 7, 7, 116, 23, 36), 120, 160) then
begin
MouseBox(186, 172, 202, 185, 1);
FFlag(0);
Wait(2000+Random(1000));
if CountColor(0, MCX1, MCY1, MCX2, MCY2) = 1238 then
Exit;
Wait(8000 + Random(5000));
ClickContinue(True, True);
Wait(1000 + Random(2000));
ClickContinue(True, True);
Result := (Pos('evil bob', LowerCase(GetMusic)) = 0);
if (Result) then
begin
AddToSRLLog('*******SOLVED EVIL BOB********');
WriteLn('*******SOLVED EVIL BOB********');
end;
end;
end;
That's all of the updates that were needed to make the script run. Here's the full EvilBob.Scar file:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Evil Bob Island Routines --//
//-----------------------------------------------------------------//
// * function InEvilBobsIsland: Boolean; // * by ZephyrsFury, lordsaturn
// * procedure MiddleOfEvilBobIsland; // * by Markus
// * function FindBobsServant: Boolean; // * by MastaRaymond
// * procedure TalkToBobsServant; // * by Markus
// * function FilterBobPointsFast(points: tpointarray): TPoint; // * by Markus
// * function GetStatue(ratio: extended): integer; // * by Markus, ratios by Ruler, lordsaturn
// * function WalkToStatue(statue: integer): Boolean; // * by Markus
// * function FilterTPA(midx, midy, dist: integer; points: TPointArray): TPointarray; // * by Markus
// * function RemovePointsInBox(points: TPointArray; box: TBox): TPointArray; // * by Markus
// * function PickupFishingNet: Boolean; // * by Markus
// * function FishAThing: Boolean; // * by Markus
// * function UncookBobFish: Boolean; // * by Markus
// * function GiveBobDaFish: Boolean; // * by Markus, lordsaturn
// * function LeaveBobsIsland: Boolean; // * by Markus, lordsaturn
// * function FishingNetInInv: Boolean; // * by Markus
// * function CanLeaveBobsIsland: Boolean; // * by Markus
// * function SolveEvilBob: Boolean; // * by Markus
{*******************************************************************************
function InEvilBobsIsland: Boolean;
by: ZephyrsFury
Description: Checks if we're in Evil Bob's Island.
*******************************************************************************}
function InEvilBobsIsland: Boolean;
var
Pts: TPointArray;
ATPA: T2DPointArray;
X, Y, L: Integer;
begin
if (FindColor(X, Y, 60909, MMX1, MMY1, MMX2, MMY2)) then
begin
FindColorsTolerance(Pts, 60909, MMX1, MMY1, MMX2, MMY2, 0);
L := Length(Pts);
if InRange(L, 1, 2) then
begin
if L = 1 then
begin
x := MMCX;
y := MMCY;
end else
begin
x := Pts[1].x;
y := Pts[1].y;
end;
if (InRange(Distance(Pts[0].X, Pts[0].Y, x, y), 9, 13)) then
if (FindColorsTolerance(Pts, 217, MMX1, MMY1, MMX2, MMY2, 0)) then
begin
ATPA := SplitTPAEx(Pts, 20, 20);
if (Length(ATPA) > 3) then
Result := IsChatBoxTextAnyLine('ScapeRune', clMessage);
end;
end;
end;
end;
{*******************************************************************************
procedure MiddleOfEvilBobIsland;
by: Markus
Description: Walks to the middle of the Evil Bob island
*******************************************************************************}
procedure MiddleOfEvilBobIsland;
var
x, y: integer;
p: tpointarray;
begin
if (not LoggedIn) then Exit;
FindColorsTolerance(p, 195836, mmx1, mmy1, mmx2, mmy2, 0);
MiddleTPAEx(p, x, y);
Mouse(x, y, 5, 5, True);
FFlag(0);
Wait(1000 + Random(2000));
end;
{*******************************************************************************
function FindBobsServant: Boolean;
by: MastaRaymond
Description: Finds Evil Bob's servant
*******************************************************************************}
function FindBobsServant: Boolean;
var
ATPA: T2DPointArray;
TPA: TPointArray;
I, cts ,x ,y, k: Integer;
begin
if (not LoggedIn) then Exit;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.03, 0.22);
FindColorsTolerance(TPA, 1071730, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := TPAtoATPAEx(TPA, 50, 50);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
k := High(atpa);
For I:= 0 to k do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 1, 1);
Wait(150 + Random(70));
GetMousePos(x, y);
Wait(150 + Random(50));
if(InRange(CountColorTolerance(180931, 7, 7, 124, 24, 36), 75, 85))then
Continue;
Mouse(x, y, 0, 0, True);
FFlag(0);
ColorToleranceSpeed(cts);
Result := True;
Exit;
end;
end;
{*******************************************************************************
procedure TalkToBobsServant;
by: Markus
Description: Talks to the servant until the text Fish here is in the corner, takes a screenie
*******************************************************************************}
function TalkToBobsServant(var done : boolean) : TPointArray;
var
x, cts, i : integer;
P : TPointArray;
D : T2DPointArray;
begin
writeln('Bobsolver - attempting to talk to the servant');
MiddleOfEvilBobIsland;
repeat
x := x + 1;
if x > 5 then
exit;
until(FindBobsServant);
wait(500 + random(1000));
if (trim(GetTextAtEx(76, 402, 0, NPCChars, false, false, 0, 2, 0, 41, false, tr_AllChars)) = 'Evil Bob has fallen asleep, come quickly!') then
begin
writeln('Bobsolver - detected we already solved the random');
done := true;
exit;
end;
repeat
writeln('Bobsolver - Waiting and clicking until the statue is there');
wait(1500 + random(750));
ClickContinue(True, True); //Click to continue until we see the cross top right corner
inc(i);
writeln(inttostr(i));
if (i > 10) then exit;
until(getcolor(10, 30) = 2070783);
wait(2000); //Wait some time...
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.01, 3);
FindColorsTolerance(P, 3253191, msx1+10, msy1+10, msx2, msy2, 30);
ColorToleranceSpeed(cts);
SetColorspeed2Modifiers(0.2, 0.2); //to defaults
d := SplitTPAEx(P, 5, 5);
SortATPASize(d, true);
if (length(d) > 0) then
result := d[0]
else
writeln('Bobsolver - No points found!');
SetAngle(True);
MakeCompass('n');
end;
{*******************************************************************************
function FilterBobPointsFast(points: tpointarray): TPoint;
by: Markus
Description: Filters the points, only used to filter the tail of the scared cat
*******************************************************************************}
function FilterBobPointsFast(points: tpointarray): TPointArray;
var
YNo: TIntegerArray;
i, L, count, MinY: integer;
box: TBox;
begin
box := GetTPABounds(points);
SetLength(YNo, box.y2-box.y1+1);
L := Length(points)-1;
for i := 0 to L do
Inc(YNo[points[i].y-Box.Y1]);
L := box.y2-box.y1;
for i := 0 to L do
if (YNo[i] > 4) then Break;
if i = L then
MinY := 0
else
MinY := i;
L := Length(points)-1;
SetLength(Result, l+1);
for i := 0 to l do
begin
if (points[i].y >= (MinY + Box.Y1)) then
begin
Result[count] := points[i];
Inc(count);
end;
end;
SetLength(Result, count);
end;
{*******************************************************************************
function GetStatue(ratio: extended): integer;
by: Markus, ratios by Ruler, lordsaturn
Description: Returns the statue
*******************************************************************************}
function GetStatue(ratio: extended): Integer;
var
closest, rat: Extended;
ratios: array of Extended;
i: integer;
begin
SetArrayLength(ratios, 4);
closest := 10;
//ratios := [2.4, 2.2, 1.45, 1.2{, 1.6}];
ratios := [1.35, 2.3, 0.9, 0.52];
//0: 1.5, 1.4, 1.47, 1.4, 1.333, 1.4, 1.4375, 1.1428, 1.285, 1.285, 1.23, 1.411, 1.153
//1: 2.35, 2.4, 2.176, 2.1875, 2.3125, 2.45, 2.315, 2.3529, 2.22, 2.4
//2: 1.035, 1.07, 0.75, 1, 2/3, 0.85, 1.04, 0.92, 1.03, 1, 1, 1, 1
//3: 0.714, 2/3, 0.8, 2/3, 2/3, 2/3, 0.777, 0.571, 0.4, 1, 0.5, 0.833, 1, 0.714
for i := 0 to 3 do
begin
rat := abs(ratio - ratios[i]);
if (rat < closest) then
begin
closest := rat;
Result := i;
end;
end;
case Result of
0: writeln('Bobsolver - Statue: praying cat'); //E
1: writeln('Bobsolver - Statue: attacking cat'); //S
2: writeln('Bobsolver - Statue: dead cat'); //N
3: writeln('Bobsolver - Statue: scared cat'); //W
//4: writeln('Scared cat w/out filtering');
end;
end;
{*******************************************************************************
function WalkToStatue(statue: integer): Boolean;
by: Markus
Description: Walks to the statue
*******************************************************************************}
function WalkToStatue(statue: integer): Boolean;
var
DDTM: TDTM;
bx, by, ptc, x, y: Integer;
begin
if (not LoggedIn) then Exit;
if (not FindColor(x, y, WaterColor, MMX1, MMY1, MMX2, MMY2)) or (WaterColor < 1) then
WaterColor := FindWaterColor;
case statue of
0 : MouseBox(674, 86, 683, 95, 1);
1 : MouseBox(615, 120, 620, 128, 1);
2 : MouseBox(618, 42, 625, 48, 1);
3, 4 : MouseBox(573, 72, 581, 84, 1);
end;
ptc := AddDTM(ddtm);
if DTMRotated(ptc, bx, by, mmx1, mmy1, mmx2, mmy2) then
begin
MFF(bx, by, 1, 1); //Walk to it
FFlag(0);
Result := True;
end else
Result := False;
FreeDTM(ptc);
end;
{*******************************************************************************
function FilterTPA(midx, midy, dist: integer; points: TPointArray): TPointarray;
by: Markus
Description: Filters points by max dist of MidX and MidY
*******************************************************************************}
function FilterTPA(midx, midy, dist: integer; points: TPointArray): TPointarray;
var
i, ll: integer;
begin
for i := 0 to High(points) do
if (distance(midx, midy, points[i].x, points[i].y) <= dist) then
begin
ll := ll + 1;
SetArrayLength(Result, ll);
Result[ll - 1] := points[i];
end;
end;
{*******************************************************************************
function RemovePointsInBox(points: TPointArray; box: TBox): TPointArray;
by: Markus
Description: Removes all points in tpa 'points' in a box specified by 'box'
*******************************************************************************}
function RemovePointsInBox(points: TPointArray; box: TBox): TPointArray;
var
i, L, rescnt: Integer;
begin
L := GetArrayLength(points)-1
for i := 0 to L do
begin
if not PointInBox(points[i], box) then
begin
rescnt := rescnt + 1;
SetArrayLength(Result, rescnt);
Result[rescnt - 1] := points[i];
end;
end;
end;
{*******************************************************************************
function PickupFishingNet: Boolean;
by: Markus
Description: Used in Evil Bob solver. Picks up an fishing net
*******************************************************************************}
function PickupFishingNet: Boolean;
var
cts, bmpDropDot, cx, cy, tries, i, pntl: integer;
Points: TPointArray;
begin
if (not LoggedIn) then Exit;
bmpDropDot := BitmapFromString(4, 3, 'FF3636FE2020FC0606E90000FE0C0CF' +
'C0606F10000CE0000000001D90000BC0000000001');
repeat
cx := mmcx;
cy := mmcy;
if FindBitmapSpiralTolerance(bmpdropdot, cx, cy, mmx1, mmy1, mmx2, mmy2, 30) then
MFNF(cx + 3, cy + 3, 1, 1);
FFlag(0);
Wait(1000 + Random(1000));
MakeCompass('n');
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.016, 5.5);
FindColorsSpiralTolerance(mscx, mscy, points, 1845815, msx1, msy1, msx2, msy2, 15);
SetColorspeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
ReArrangeandShortenArrayEx(points, 40, 40);
SortTPAFrom(points, point(mscx, mscy));
points := RemovePointsInBox(points, IntToBox(mscx-25, mscy-30, mscx+25, mscy+30));
points := FilterTPA(mscx, mscy, 100, points);
if (GetArrayLength(points) > 5) then
pntl := 5
else
pntl := GetArraylength(points) - 1;
for i := 0 to pntl-1 do
begin
MMouse(points[i].x, points[i].y, 0, 0);
Wait(500 + Random(500));
if (InRange(CountColorTolerance(3636702, 7, 7, 124, 24, 36), 250, 350)) then
begin
Mouse(points[i].x, points[i].y, 0, 0, False);
Result := ChooseOption('ake')
FFlag(0);
Wait(2000 + Random(1000));
Freebitmap(bmpDropDot);
Exit;
//Break;
end else
tries := tries + 1;
end;
end;
until ((Result) or (tries > 5));
Result := False;
Freebitmap(bmpDropDot);
end;
{*******************************************************************************
function FishAThing: Boolean;
by: Markus
Description: Fishes a Fishlike thing
*******************************************************************************}
function FishAThing: Boolean;
var
points1, points2, rp: TPointArray;
l, i, cts, x, y, t, d: integer;
atpa: T2DPointArray;
begin
Result := False;
if (not LoggedIn) then Exit;
d := DTMFromString('78DA63CC606260D0676440066D89760C1A401' +
'A24FA1F0818D3816AD450D54064612490CE07AA5127A0A6840873' +
'8A30DD83A12609A8C68C809A04A01A3DFC6A00EEB6098E'); //Dtm from cooked Fishlike thing
GameTab(tab_Inv);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(mscx, mscy, points1, 11512485, msx1, msy1, msx2, msy2, 20);
findcolorsSpiraltolerance(mscx, mscy, points2, 11578022, msx1, msy1, msx2, msy2, 20);
rp := CombineTPA(points1, points2);
atpa := TPAtoATPAEx(rp, 30, 30);
l := High(atpa);
if (l > 5) then
l := 5;
for i := 0 to l do
begin
MiddleTPAEx(atpa[i], x, y);
MMouse(x, y, 5, 5);
Wait(500 + Random(25));
if (InRange(CountColorTolerance(15460378, 7, 7, 121, 21, 36), 130, 160)) then
begin
Result := True;
ColorToleranceSpeed(cts);
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
t := GetSystemTime;
repeat
Wait(2000 + Random(500));
until (ClickContinue(True, True)) or ((GetSystemTime - t) > 10000);
if ((GetSystemTime - t) < 10000) then
if (FindDTM(d, x, y, mix1, miy1, mix2, miy2)) then
begin
Result := True;
ColorToleranceSpeed(cts);
FreeDTM(d);
exit;
end;
end;
end;
FreeDTM(d);
ColorToleranceSpeed(cts);
end;
{*******************************************************************************
function UncookBobFish: Boolean;
by: Markus
Description: Uncooks a fishlike thing
*******************************************************************************}
function UncookBobFish: Boolean;
var
dtmFish, x, y: Integer;
begin
if (not LoggedIn) then Exit;
WriteLn('Bobsolver - uncooking fish...');
GameTab(tab_Inv);
dtmFish:= DTMFromString('78DA639CCAC4C0F0840105C8589E07D38C503' +
'E632750CD7B0634C084AAA603C87F4940CD4220FF0E01353380FC' +
'D704D4F403F9F709A8590AE43F25A0662290FF96801A90DF1F11E' +
'1E6BB04D42C266C0E00556111A2');
if not(FindDTM(dtmFish, x, y, mix1, miy1, mix2, miy2)) then
begin
FreeDTM(dtmFish);
Result := False;
Exit;
end
else
begin
FreeDTM(dtmFish);
Mouse(x, y, 5, 5, False);
Chooseoption('Use');
end;
Wait(500 + Random(200));
if(FindColor(x, y, 1579288, MSX1, MSY1, MSX2, MSY2))then
begin
MouseBox(228, 109, 254, 127, 1);
FFlag(0);
Wait(3000 + Random(5000));
Result := True;
WriteLn('Bobsolver - uncooked the fish :)');
end;
end;
{*******************************************************************************
function GiveBobDaFish: Boolean;
by: Markus, lordsaturn
Description: Gives a raw fishlike thing to Evil Bob
*******************************************************************************}
function GiveBobDaFish: Boolean;
var
dtmRawFish, x, y, fx, fy, i, Hi, CTS: Integer;
P: TPointArray;
aP: T2DPointArray;
begin
if (not LoggedIn) then Exit;
dtmRawFish := DTMFromString('78DA639CC6C4C0F0840105C8589E07D38C503' +
'E631750CD070634C084AAA613C87F4C40CD2220FF0E0135CB30DD' +
'83A1663A90FF86809A8940FE3D22DCF390809A0E20FF250135938' +
'0FCB704D4F400F90F08A89903E43F27C2EF77F1AB0100EC9114A1' +
'');
if (not(FindDTM(dtmRawFish, x, y, mix1, miy1, mix2, miy2))) then
begin
FreeDTM(dtmRawFish);
Exit;
end else
begin
FreeDTM(dtmRawFish);
Mouse(x, y, 5, 5, True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(MSCX, MSCY, P, 3947585, MSX1, MSY1, MSX2, MSY2, 20);
if Length(P) = 0 then
begin
ColorToleranceSpeed(CTS);
Mouse(x, y, 5, 5, True);
Exit;
end;
aP := SplitTPA(P, 3);
SortATPASize(aP, True);
Hi := High(aP);
for i := 0 to Min(Hi, 5) do
begin
MiddleTPAEx(aP[i], fx, fy);
MMouse(fx, fy, 3, 3);
Wait(500+Random(200));
if FindColorTolerance(x, y, 3289653, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MouseBox(232, 178, 236, 184, 1);
FFlag(0);
Wait(1000+Random(1000));
Result := True;
Break;
end;
end;
ColorToleranceSpeed(CTS);
if not Result then
begin
Mouse(x, y, 5, 5, True); //unselect
exit;
end;
end;
repeat
Wait(500 + Random(1000));
ClickContinue(True, True);
until(GetColor(435, 458) = 6321792) or (not LoggedIn);
end;
{*******************************************************************************
function LeaveBobsIsland: Boolean;
by: Markus, lordsaturn
Description: Leaves evil bobs island
*******************************************************************************}
function LeaveBobsIsland: Boolean;
begin
Result := False;
if (not LoggedIn) then Exit;
if InRange(CountColorTolerance(180931, 7, 7, 116, 23, 36), 120, 160) then
begin
MouseBox(186, 172, 202, 185, 1);
FFlag(0);
Wait(2000+Random(1000));
if CountColor(0, MCX1, MCY1, MCX2, MCY2) = 1238 then
Exit;
Wait(8000 + Random(5000));
ClickContinue(True, True);
Wait(1000 + Random(2000));
ClickContinue(True, True);
Result := (Pos('evil bob', LowerCase(GetMusic)) = 0);
if (Result) then
begin
AddToSRLLog('*******SOLVED EVIL BOB********');
WriteLn('*******SOLVED EVIL BOB********');
end;
end;
end;
{*******************************************************************************
function FishingNetInInv: Boolean;
by: Markus
Description: Used in Evil Bob solver to detect if we got a fishing net in our
inventory. Uses bitmap masks, slow but working.
*******************************************************************************}
function FishingNetInInv: Boolean;
var
bmpmskNet, x, y: Integer;
begin
if (not LoggedIn) then Exit;
bmpmskNet := BitmapFromString(30, 26, 'beNqtldsOwCAIQ/3/n3bJkiWG' +
'y6EyeNiDYqG1jrX02G+s0Tgx9xcjsLDeLnG26gH9twFrjkOhtggKF' +
'wU5a7UsocBCfigXOAduJ+tZ6dysmLb9VepWDLd8Y6yqP35qBRTAjS' +
'FTxcaiCXWflJmG7BV+JpdPyOizaFwiOx7aGJ4M4/MbUayrqKSXYL6' +
'300S59MYUyCiUP4fBEv/nI6s0NXzHYUfk7cQDBvcXBg==');
GameTab(tab_Inv);
Result := FindBitmapMaskTolerance(bmpmskNet, x, y, mix1, miy1, mix2, miy2, 0, 0);
Freebitmap(bmpmskNet);
end;
{*******************************************************************************
function CanLeaveBobsIsland : boolean;
by: Markus
Description: Returns true if the random is solved but we are still trying to
solve (misclick failsafe)
*******************************************************************************}
function CanLeaveBobsIsland : boolean;
begin
result := false;
if (not(loggedin)) then exit;
MiddleOfEvilBobIsland;
if (FindBobsServant) then
begin
wait(2000 + random(2000));
if (GetTextAtEx(79, 404, 0, NPCChars, false, false, 0, 2, 0, 41, false, tr_AllChars) = 'Evil Bob has fallen asleep, come quickly!') then
result := true;
end;
end;
{*******************************************************************************
function SolveEvilBob: Boolean;
by: Markus
Description: Solves the Evil Bob island Random
*******************************************************************************}
function SolveEvilBob: Boolean;
var
clrpnts: TPointArray;
Statue, bobshot, time, t: integer;
pnt: TPoint;
size: Tbox;
MadeError, done, WeSolvedItSoFar: Boolean;
begin
if (not LoggedIn) then Exit;
Result := False;
SetRun(True);
if (not(FishingNetInInv)) then
begin
if (invcount > 26) then
Exit;
end else
if (invcount > 27) then
Exit;
time := GetSystemTime;
while (pos('evil bob', lowercase(getmusic)) <> 0) and (LoggedIn) do
begin
MadeError := False;
if ((GetSystemTime - time) > 360000) then
Exit;
clrpnts := TalkToBobsServant(done);
if (Done) then
WeSolvedItSoFar := True;
if not WeSolvedItSoFar then
if (length(clrpnts) < 20) then
if (CanLeaveBobsIsland) then
begin
WeSolvedItSoFar := True;
end;
if not WeSolvedItSoFar then
begin
clrpnts := FilterBobPointsFast(clrpnts);
FreeBitmap(bobshot);
size := GetTPABounds(clrpnts);
pnt.x := size.x2-size.x1;
pnt.y := size.y2-size.y1;
try
statue := GetStatue(pnt.y/pnt.x);
writeln('ratio: '+floattostr(pnt.y/pnt.x));
except end;
t := 0;
if (not(FishingNetInInv)) then
repeat
Inc(t);
if not WalkToStatue(statue) then
begin
WalkToStatue(statue);
Wait(1000 + Random(750));
end;
if (t > 5) then
begin
MadeError := True;
Break;
end;
until(PickupFishingNet) or (not LoggedIn);
if (MadeError) or (not LoggedIn) then
continue;
t := 0;
repeat
Inc(t);
MakeCompass('n');
if not WalkToStatue(statue) then
begin
WalkToStatue(statue);
Wait(1000 + Random(750));
end;
Wait(2000 + Random(2000));
if (t > 5) then
begin
MadeError := True;
Break;
end;
until(FishAThing) or (not LoggedIn);
if (MadeError) or (not LoggedIn) then
continue;
MiddleOfEvilBobIsland;
SetRun(False);
UncookBobFish;
GiveBobDaFish;
end;
WeSolvedItSoFar := False;
if CanLeaveBobsIsland then
Result := LeaveBobsIsland
else
Result := False;
end;
end;
I hope this helps :)
~Camo