SRL Archive - SRL Archives

Evilbob solver! 100% working


Markus

2007-12-05 14:18:33

Yea, this is my Evil Bob solver, designed to solve the Evil Bob fishing random.
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 ;)

King of Knives

2007-12-05 14:31:05

Nice work, Markus :D

I think we can safely say that this one beats mine :D Very nice job.

Let's hope that the admins can forget their pride and take a non-dev's random solver into SRL so we can auto even better :D :p.

-Knives

Markus

2007-12-05 14:32:37

Hmm, I forgot to credit you, if you didn't release yours, I'd never start thinking of finishing mine ;)
Lemme edit my post.

Wizzup?

2007-12-05 14:35:29

 for i := 0 to L do
if (YNo[i] > 3) then break; //Zo, ff de goede vinden in de Array
if i = L then
MinY := 0 //Als we zijn gecrasht: Failsafe!

If i = L + 1 then miny:=0;

program New;

var
i: integer;
begin
for I := 0 to 4 do
wait(1);
writeln(inttostr(i));
end.

EDIT: SolveEvilBob should not call the actual detection with music, FindNormalRandoms in SRL should do that.
EDIT2: Good job, ofcourse…

Markus

2007-12-05 14:38:30

Wizzup? That's what it is NOT supposed to do ;) It has nothing to do with the array-length.

The scary cat has a tail sticking out, the tail is two to three pixels wide.
First it stores for every Y in an integer array how many points there are at that Y. Then it'll look for the first Y with more then three points, that's when it breaks, and stores the minimum Y. Then it removes all points before that Y, so you'll get a cat without tail :D Poor cat :(, but improves the detection of it from 25% change to 100% accurate.

edit: I should read -.- Never noticed it TBH, it just works fine, hmm lets edit it, forget everything posted above please :garfield:

edit:edit: I did the music detection to be sure it'll continue solving until it leaves the island.

Hugolord

2007-12-05 14:41:14

GJ! execellent will soon test and learn how you did it !

thanks

SKy Scripter

2007-12-05 15:19:49

Nice Job XD
Edit: by anychance does anyone have this random :)????

mastaraymond

2007-12-05 15:24:20

Wow great job! Im glad you've finished it!

It took you a while ^^, but im glad your done!

Wizzup?

2007-12-05 15:26:01

From: Markus
edit:edit: I did the music detection to be sure it'll continue solving until it leaves the island.


Ah. Of course! Good one.

WT-Fakawi

2007-12-05 15:27:54

Haha, you did it! Great job man. Aaand, since Evil Bob is properly detected, it is only a matter of seconds to implement this into SRL! I am not in the fishing mood, I have been more or less continiously mining for the last month, but I bet any dev would kindly paste this into SRL, right guys?

Markus

2007-12-05 15:44:59

Wow, thanks :D
Well, this is a pretty rare random. I just used wizzups essminer on one char 100 loads until my mom turned the computer off (thus destroying the fcking report), next day I looked at the char, and he was inside.
Oh, and it's a bit buggy btw (fishing spot finding), and it needs a few failsafes, as now it can continue uhm, for ever. It always seems fuck up the scared cat, as FindObjCustom will not look to the right to find the color, hence why the MakeCompass (didn't test it, as I solved it myself).

nielsie95

2007-12-05 16:41:38


SRL Compiled in 0 msec
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
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********

Nice work! You might want to add net detection (if the user already has a net?)

n3ss3s

2007-12-05 16:56:00

OMG!

GRATZ AND THANKS!

Its 24.00 here, gotta go sleep, but definetly check further tomorrow.

Bobarkinator

2007-12-05 17:41:13

Good job, we will soon get all the randoms :)

Narcle

2007-12-05 18:34:05

The dragon one (Mordaut?) will be hard. I've solved it a lot, and today I encountered 2 new problems in it. Really threw me off. Idk if RS added them just recently or what.

Harry

2007-12-05 18:41:59

WOWAWAWEWA! Good job, I rember like months ago I let you use my account for like 3 days :garfield:

WT-Fakawi

2007-12-05 19:12:42

From: Markus
…and it needs a few failsafes, as now it can continue uhm, for ever. …


No we dont want endless loops now do we :)

Harry

2007-12-05 19:24:57

Successfully compiled
SRL Compiled in 0 msec
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
[Runtime Error] : Out Of Range in line 201 in script C:\Program Files\SCAR 3.12\Scripts\Bobber.scar

-_- :|

inc(YNo[points.y-Box.Y1]); //Ok, voor iedere Y een index in de Array, en eentje optelle als ie dr in zit ;) is that line.

R0b0t1

2007-12-05 19:32:09

I guess that that is dutch! Do I win anything!


I can't believe how nice this is though, although I can't test it.

legendaryhero90

2007-12-05 20:39:59

oh nice.

i hope i can test this soon.

and are you guys going to implement this into the SRL randoms?

Markus

2007-12-06 00:55:45

You just won the translation :D
Every Y has it's own index, lets increment this Y in the array (Or something like that).
Tonight I gonna add the failsafes and make the loops infinite. Couldn't be bothered to do yesterday ;)

n3ss3s

2007-12-06 03:56:28

Mostly what gets implemented to SRL, are procedures by the devs, plus they don't add any 'betas' / almost working there, no offense markus.

Markus

2007-12-06 06:46:52

Like I care if this gets implemented in SRL :) Na seriously, I don't.
But this isn't a beta n3ss3s, I kept all the betas private, see this as version 1.0 ;)

the scar noob

2007-12-06 15:11:00

Nice move mark! Great to see that a new random is getting o nhis way to be solved;)

Keep it up!

-Tsn.

Harry

2007-12-06 15:20:56

Oi, what about the runtime error I always get? :|

Rikje

2007-12-06 15:38:23

Looks great! to bad i almost never have a account on evil bob. :(

Markus

2007-12-06 16:05:50

Updated to version 1.1
Removed the infinity of all loops, they now break after a while.
NEW fishing spot finder
Removed some depreciated functions (calculateratio, analyzetpointarray blablabla)
Made the var bobshot local, no global vars needed
Added detection of fishing net, now checks if we got a fishing net :D
@Hy71194: try again with this new version, it works perfect for me :D

nielsie95

2007-12-06 17:02:26

hmm.. =\


Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Statue: praying cat
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
WaterColor = 12161405
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Statue: scared cat
WaterColor = 12161405
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Statue: scared cat
WaterColor = 12161405
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Statue: attacking cat
WaterColor = 12161405
Bobsolver - attempting to talk to the servant

It just kept on looping.. Didn't open GameTab(4) to search for a net. Walked to the correct position, but didn't fish and just walked back..

Markus

2007-12-07 09:26:38

Five lines I accidentally forgot to add :duh:
Try the new version. I tested it four times on your char and it worked flawless every time.

nielsie95

2007-12-07 11:32:28

Ok :)

Tested it, worked very good again.

Added to dev-srl, let's see how it works!

King of Knives

2007-12-08 18:07:09

[Runtime Error] : Out Of Range in line 141 in script

Cough!

Fix it, now :p Lol

-Knives

mastaraymond

2007-12-08 19:08:23

From: King of Knives
Cough!

Fix it, now :p Lol

-Knives

Your using the old version..

pwnaz0r

2007-12-09 03:05:58

Yes you only get it when you fish

Hugolord

2007-12-09 03:15:24

From: pwnaz0r
Yes you only get it when you fish


no…..?

I got it (long time ago) while mining like stuff like ess and iron ore

King of Knives

2007-12-09 07:33:54

From: mastaraymond
Your using the old version..

Where the hell can I get the new one, then?

-Knives

Markus

2007-12-09 07:42:34

Hold on, I post it now.
And I got this random a while back while powerteleporting, and one week ago when essmining.

King of Knives

2007-12-09 08:50:08

function LeaveBobsIsland : boolean;
var
x, y : integer;
begin
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
begin
writeln('*************SOLVED EVIL BOB**************');
WriteFileString(log // hmm?
// Missing an end;
end;
end;
Still gives me Runtime Error on this line:

for i := 0 to L do
inc(YNo[points[i].y-Box.Y1]); //This line
L := box.y2-box.y1;
I can't have my main waiting in there much longer, Markus… :p :D

-Knives

Harry

2007-12-09 09:55:05

@King: Me too >_>

Markus

2007-12-09 10:00:44

GetTPABounds was broken. Please get it again.
And fixed the compiling errors ^^

Harry

2007-12-09 10:01:32

How Do I do that? Just re-download SRL Rev?

Markus

2007-12-09 10:03:49

No.
You got to the first post and copy+paste it again -.-

King of Knives

2007-12-09 10:11:32

Still doesn't work :(
KIDDING! Works great :D Awesome-ness.

Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Waiting and clicking until the statue is there
Bobsolver - Statue: scared cat
WaterColor = 11436653
WaterColor = 11436653
Bobsolver - uncooking fish…
Bobsolver - uncooked the fish :)
*************SOLVED EVIL BOB**************

May I suggest a better "Bob-finding" (tried 5 spots of black color before finding the damn bastard).
Oh, and maybe add a li'l wait after giving Bob the fish. It clicked Bob, then after not very long, it clicked the portal. I suggest FFlag(0) and Wait(2000+random(3000))

Other than that, it's truly great. Rep+.

-Knives

Markus

2007-12-09 15:03:21

Once I get a new account in the random, I promise I'll make a better bob finder ;). Maybe you want some better portal finding too? :D When I tested it it wasn't perfect, but I didn't bother making it 100% as it worked.

King of Knives

2007-12-10 07:14:39

BobFinder: Could be improved
PortalFinder: Works great as it is.

-Knives

Naum

2007-12-22 05:25:03

Wow markus. I have a char in the island and my friends on is stuck in scaperune ill see if yours and K O N s' solvers work :)

King of Knives

2007-12-24 19:22:32

Maybe a slight bump, but still.

Markus, the script still works perfectly. Truly perfectly. But you still need a 1 second wait (atleast) after giving bob the fish. That would truly make it 100% perfect.

-Knives

Markus

2007-12-26 07:57:48

New version, as it will be in SRL posted at the frontpage.
Has a few bugs fixed AND is S.M.A.R.T. compatible :)