Markus
2007-12-05 14:18:33
I've been working on this for more then six months now (ok, I only had a character inside the rand for like 20 days ^^), and I'm proud to finally release it.
Features:
- Flawless statue detection. Detects EVERY statue 100% accurate
- Excellent fishing net pickup
- Can start ANYWHERE on the island
- It works ^^
If you got an account inside the random, pleeeaaase test this, and report any bugs to me.
I don't have a character inside the random anymore, so if you want me to fix bugs it'll help if you include your characters username/password ^^
Thanks to
- MastaRaymond, you were the first one to give me a char, and for the excellent servant finding :D
- Nielsie95, for giving a few chars to me ^^ (yea more then one :D )
- King of Knives, if he didn't release his one, I'd never finished this! :p
- Wizzup? For pointing out a bug :D
- Ruler, I stole his ratio's and idea to solve it from iBot's solver
Changelog
1.1.3
Fixed some compiling errors and some stupid hints
Remember, get the NEW GetTPABounds ^^
1.1.2
Dunno what I changed, but this one works ^^
1.1.1
Bug in FishingNetInInventory fixed
Fixed some stuff in the evil bob loop, causing it not to freak out
Made the fishing loop to wait to ensure we stopped walking
1.1
Removed ALL infinite loops
Removed a few useless functions
Added better failsafes to the fishing net pickup and the fishing part
Completely revamped fishing spot finder
Commented the debug screenie,
Made bobshot a local var
Checks now if we have a net in inventory, if we got it won't pickup a fishing net but goes straight to the fishing part :)
1.0
Initial release
Some proof it works:
[php]
Successfully compiled
SRL Compiled in 15 msec
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - analyzing the array
Bobsolver - finished analyzing
Bobsolver - Statue: dead cat
WaterColor = 12161406
WaterColor = 12161406
Bobsolver - uncooking fish…
Bobsolver - uncooked the fish :)
*******SOLVED EVIL BOB********
Successfully executed
[/php]
The script (you'll need a GetTPABounds for it to work, if you don't have one in a plugin, it's at the bottom of this post)
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป Evil Bob Island Routines --//
//-----------------------------------------------------------------//
// * procedure MiddleOfEvilBobIsland; // * by Markus
// * function FindBobsServant: Boolean; // * by MastaRaymond
// * procedure TalkToBobsServant; // * by Markus
// * function FilterBobPointsFast(points: tpointarray): TPoint; // * by Markus
// * 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
// * function LeaveBobsIsland: Boolean; // * by Markus
// * function FishingNetInInv: Boolean; // * by Markus
// * function SolveEvilBob: Boolean; // * by Markus
function GetMusic: string; forward;
{*******************************************************************************
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
TPA: TPointArray;
ATPA: TPointArrayArray;
I, cts ,x ,y, k: Integer;
begin
if (not LoggedIn) then Exit;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.10, 25);
FindColorsTolerance(TPA, 5143728, 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);
if (Pos('ervan', rs_GetUpText) <= 0) 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 : TPointArray;
var
x, cts, i : integer;
begin
writeln('Bobsolver - attempting to talk to the servant');
MiddleOfEvilBobIsland;
repeat
x := x + 1;
if x > 5 then
exit;
until(FindBobsServant);
repeat
writeln('Bobsolver - Waiting and clicking until the statue is there');
wait(500 + random(500));
ClickToContinue; //Click to continue until we see the cross top right corner
inc(i);
writeln(inttostr(i));
if (i > 10) then exit;
until(getcolor(497, 26) = 39423);
wait(1700); //Wait some time...
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.01, 3);
FindColorsTolerance(result, 3253191, msx1+10, msy1+10, msx2, msy2, 30);
ColorToleranceSpeed(cts);
SetColorspeed2Modifiers(0.2, 0.2); //to defaults
highestangle;
MakeCompass('n');
//DisplayDebugImgWindow(700, 500); //Uncomment this for debug purposes
//SafeDrawBitmap(bobshot, GetDebugCanvas, 0, 0);
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] > 3) 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
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.46, 2.23, 1.45, 1.2{, 1.6}]; //Credits to ruler for these
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');
1: writeln('Bobsolver - Statue: attacking cat');
2: writeln('Bobsolver - Statue: dead cat');
3: writeln('Bobsolver - Statue: scared cat');
//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:
begin
//Praying cat
DDTM.MainPoint.x := 661; //DDTM generated by SKy Scripters DDTM maker.
DDTM.MainPoint.y := 84;
DDTM.MainPoint.AreaSize := 0;
DDTM.MainPoint.AreaShape := 0;
DDTM.MainPoint.Color := 5610937;
DDTM.MainPoint.Tolerance := 255;
SetArrayLength(DDTM.SubPoints, 3);
DDTM.SubPoints[0].x := 606;
DDTM.SubPoints[0].y := 82;
DDTM.SubPoints[0].AreaSize := 2;
DDTM.SubPoints[0].AreaShape := 0;
DDTM.SubPoints[0].Color := 195836;
DDTM.SubPoints[0].Tolerance := 0;
DDTM.SubPoints[1].x := 592;
DDTM.SubPoints[1].y := 84;
DDTM.SubPoints[1].AreaSize := 2;
DDTM.SubPoints[1].AreaShape := 0;
DDTM.SubPoints[1].Color := 195836;
DDTM.SubPoints[1].Tolerance := 0;
end;
1:
begin
//Attacking cat
DDTM.MainPoint.x := 649;
DDTM.MainPoint.y := 94;
DDTM.MainPoint.AreaSize := 0;
DDTM.MainPoint.AreaShape := 0;
DDTM.MainPoint.Color := 7979730;
DDTM.MainPoint.Tolerance := 255;
SetArrayLength(DDTM.SubPoints, 4);
DDTM.SubPoints[0].x := 641;
DDTM.SubPoints[0].y := 47;
DDTM.SubPoints[0].AreaSize := 0;
DDTM.SubPoints[0].AreaShape := 0;
DDTM.SubPoints[0].Color := 195836;
DDTM.SubPoints[0].Tolerance := 0;
DDTM.SubPoints[1].x := 653;
DDTM.SubPoints[1].y := 46;
DDTM.SubPoints[1].AreaSize := 2;
DDTM.SubPoints[1].AreaShape := 0;
DDTM.SubPoints[1].Color := 195836;
DDTM.SubPoints[1].Tolerance := 0;
DDTM.SubPoints[2].x := 643;
DDTM.SubPoints[2].y := 102;
DDTM.SubPoints[2].AreaSize := 2;
DDTM.SubPoints[2].AreaShape := 0;
DDTM.SubPoints[2].Color := watercolor;
DDTM.SubPoints[2].Tolerance := 0;
DDTM.SubPoints[3].x := 655;
DDTM.SubPoints[3].y := 102;
DDTM.SubPoints[3].AreaSize := 0;
DDTM.SubPoints[3].AreaShape := 0;
DDTM.SubPoints[3].Color := watercolor;
DDTM.SubPoints[3].Tolerance := 0;
end;
2:
begin
//Death cat
DDTM.MainPoint.x := 650;
DDTM.MainPoint.y := 79;
DDTM.MainPoint.AreaSize := 0;
DDTM.MainPoint.AreaShape := 0;
DDTM.MainPoint.Color := 8111059;
DDTM.MainPoint.Tolerance := 255;
SetArrayLength(DDTM.SubPoints, 4);
DDTM.SubPoints[0].x := 633;
DDTM.SubPoints[0].y := 122;
DDTM.SubPoints[0].AreaSize := 2;
DDTM.SubPoints[0].AreaShape := 0;
DDTM.SubPoints[0].Color := 195836;
DDTM.SubPoints[0].Tolerance := 0;
DDTM.SubPoints[1].x := 645;
DDTM.SubPoints[1].y := 121;
DDTM.SubPoints[1].AreaSize := 2;
DDTM.SubPoints[1].AreaShape := 0;
DDTM.SubPoints[1].Color := 195836;
DDTM.SubPoints[1].Tolerance := 0;
DDTM.SubPoints[2].x := 641;
DDTM.SubPoints[2].y := 66;
DDTM.SubPoints[2].AreaSize := 0;
DDTM.SubPoints[2].AreaShape := 0;
DDTM.SubPoints[2].Color := watercolor;
DDTM.SubPoints[2].Tolerance := 0;
DDTM.SubPoints[3].x := 658;
DDTM.SubPoints[3].y := 65;
DDTM.SubPoints[3].AreaSize := 0;
DDTM.SubPoints[3].AreaShape := 0;
DDTM.SubPoints[3].Color := watercolor;
DDTM.SubPoints[3].Tolerance := 0;
end;
3, 4:
begin
//Scared cat
DDTM.MainPoint.x := 642;
DDTM.MainPoint.y := 86;
DDTM.MainPoint.AreaSize := 0;
DDTM.MainPoint.AreaShape := 0;
DDTM.MainPoint.Color := 8111059;
DDTM.MainPoint.Tolerance := 255;
SetArrayLength(DDTM.SubPoints, 4);
DDTM.SubPoints[0].x := 627;
DDTM.SubPoints[0].y := 77;
DDTM.SubPoints[0].AreaSize := 0;
DDTM.SubPoints[0].AreaShape := 0;
DDTM.SubPoints[0].Color := watercolor;
DDTM.SubPoints[0].Tolerance := 0;
DDTM.SubPoints[1].x := 632;
DDTM.SubPoints[1].y := 96;
DDTM.SubPoints[1].AreaSize := 0;
DDTM.SubPoints[1].AreaShape := 0;
DDTM.SubPoints[1].Color := watercolor;
DDTM.SubPoints[1].Tolerance := 0;
DDTM.SubPoints[2].x := 691;
DDTM.SubPoints[2].y := 82;
DDTM.SubPoints[2].AreaSize := 2;
DDTM.SubPoints[2].AreaShape := 0;
DDTM.SubPoints[2].Color := 195836;
DDTM.SubPoints[2].Tolerance := 0;
DDTM.SubPoints[3].x := 703;
DDTM.SubPoints[3].y := 82;
DDTM.SubPoints[3].AreaSize := 2;
DDTM.SubPoints[3].AreaShape := 0;
DDTM.SubPoints[3].Color := 195836;
DDTM.SubPoints[3].Tolerance := 0;
end;
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
MouseFindFlag(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 (rs_getuptext = 'Take Small fishing net / 2 more options') then
begin
Mouse(points[i].x, points[i].y, 0, 0, False);
Result := ChooseOption('ake')
FFlag(0);
Wait(1000 + Random(2000));
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: TPointArrayArray;
begin
Result := False;
if (not LoggedIn) then Exit;
d := DTMFromString('78DA63CC606260D0676440066D89760C1A401' +
'A24FA1F0818D3816AD450D54064612490CE07AA5127A0A6840873' +
'8A30DD83A12609A8C68C809A04A01A3DFC6A00EEB6098E'); //Dtm from cooked Fishlike thing
Gametab(4);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(mscx, mscy, points1, 1906709, msx1, msy1, msx2, msy2, 40);
findcolorsSpiraltolerance(mscx, mscy, points2, 5456179, msx1, msy1, msx2, msy2, 40);
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(10 + Random(25));
if (rs_getuptext = 'Net Fishing spot / 2 more options') then
begin
Result := True;
ColorToleranceSpeed(cts);
Mouse(x, y, 0, 0, True);
t := GetSystemTime;
repeat
Wait(500 + Random(500));
until (GetColor(434, 459) <> 6321792) 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(4);
dtmFish:= DTMFromString('78DA63CC606260D0676440066D89760C1A401' +
'A24FA1F0818D3816AD450D54064612490CE07AA5127A0A6840873' +
'8A30DD83A12609A8C68C809A04A01A3DFC6A00EEB6098E');
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;
if FindObjCustom(x, y, ['ncook'], [11167552], 20) then
begin
Mouse(x, y, 5, 5, True);
FFlag(0);
Wait(3000 + Random(5000));
Result := True;
WriteLn('Bobsolver - uncooked the fish :)');
end;
end;
{*******************************************************************************
function GiveBobDaFish: Boolean;
by: Markus
Description: Gives a raw fishlike thing to Evil Bob
*******************************************************************************}
function GiveBobDaFish: Boolean;
var
dtmRawFish, x, y: Integer;
begin
if (not LoggedIn) then Exit;
dtmRawFish := DTMFromString('78DA637464626008666440064E13AF33E8026' +
'990E87F20607402AAF142550391859140DA1AA8C69B801A53A01A' +
'7F026A4C806A2208A8B102AA8922A0C60DA82694809A40A09A000' +
'26AFC88F0BB17613500F0EC0BC1');
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);
if FindObjCustom(x, y, ['Bob'], [1776414], 25) then
begin
Mouse(x, y, 5, 5, True);
Result := True;
end;
end;
repeat
Wait(500 + Random(1000));
ClickToContinue;
until(GetColor(435, 459) = 6321792) or (not LoggedIn);
end;
{*******************************************************************************
function LeaveBobsIsland: Boolean;
by: Markus
Description: Leaves evil bobs island
*******************************************************************************}
function LeaveBobsIsland: Boolean;
var
x, y: Integer;
begin
if (not LoggedIn) then Exit;
if FindObjCustom(x, y, ['Portal'], [6729645], 25) then
begin
Mouse(x, y, 5, 5, True);
FFlag(0);
Wait(8000 + Random(8000));
ClickToContinue;
Wait(1000 + Random(2000));
ClickToContinue;
Result := (Pos('evil bob', LowerCase(GetMusic)) = 0);
if (Result) then
writeln('*******SOLVED EVIL BOB********');
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(49, 38, 'beNrtV9EKgEAI6/9/uiAoIuey' +
'8paEe4rj6NY2T5umRqPR+AfmFQXJzBu+5QPJfEVsP/f4YNdl3Kw+J' +
'5XgZgGfoHoaK+37PYmsswLjvLNI2NIjDdNLSHrchkYIRsUuptdg8A' +
'O9bbkSRYoI+vWgYO/6ZQPjlR7h9pLS5dE8S+m3U9AsqEkk7VmN/jI' +
'nvK0klj9prLcyPOIC58HgfmmmApg3GDMxH8JNOaLwWoPdpM5AXoGS' +
'52mFn5dSKg26ITWzeqMhwgLX8iL6');
GameTab(4);
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: Boolean;
label
WeSolvedItSoFar;
begin
if (not LoggedIn) then Exit;
Result := False;
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;
if (length(clrpnts) < 20) then
if (CanLeaveBobsIsland) then
begin
Goto WeSolvedItSoFar;
end;
clrpnts := FilterBobPointsFast(clrpnts);
FreeBitmap(bobshot);
size := GetTPABounds(clrpnts);
pnt.x := size.x2-size.x1;
pnt.y := size.y2-size.y1;
statue := GetStatue(pnt.y/pnt.x);
t := 0;
if (not(FishingNetInInv)) then
repeat
Inc(t);
if not WalkToStatue(statue) then
begin
MiddleOfEvilBobIsland;
WalkToStatue(statue);
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
MiddleOfEvilBobIsland;
WalkToStatue(statue);
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;
UncookBobFish;
GiveBobDaFish;
WeSolvedItSoFar:
if LeaveBobsIsland then
begin
Result := True;
Inc(BobIsland);
end else
Result := False;
end;
end;
GetTPABounds:
Function GetTPABounds(TPA: TPointArray): TBox;
var
i, l : Integer;
begin
l := High(TPA);
if l < 0 then exit;
Result.x1 := TPA[0].x;
Result.y1 := TPA[0].y;
Result.x2 := TPA[0].x;
Result.y2 := TPA[0].y;
For i := 1 to l do
begin
if TPA[i].x > Result.x2 then
Result.x2 := TPA[i].x
else if TPA[i].x < Result.x1 then
Result.x1 := TPA[i].x;
if TPA[i].y > Result.y2 then
Result.y2 := TPA[i].y
else if TPA[i].y < Result.y1 then
Result.y1 := TPA[i].y;
end;
end;
Feel free to use this in ANY script, as long as you leave the credits there!
Some rep would be nice too ;)