SRL Archive - SRL Archives

EvilBob


Naum

2009-12-26 09:42:16

The first post has the most recent version.

This is the EvilBob solver I made some time ago. It's been tested well by me and fellow members. But, I still need other people to test the code for this solver. Replace your current EvilBob.Scar with the code (see below):

To find the statue it uses density, which is basically the length of points on the statue divided by the area of the box, or basically:

StatueDensity := (Length(TPA) / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1) * 1.0));

Thanks to IceFire908 for the account, and Tara :).
Thanks to anyone who gave me tips, etc.

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Evil Bob Island Routines --//
//-----------------------------------------------------------------//
// * Function InEvilBobsIsland: Boolean; // * by ZephyrsFury, lordsaturn
// * Procedure EB_MiddleIsland; // * by Naum
// * Function EB_FindServent : Boolean; // * by Naum
// * Function EB_GetStatueInfo : TStatue; // * by Naum, idea from Zeph
// * Function EB_FindFishSpot : TPoint; // * by Naum
// * Function EB_PerformTask : Boolean; // * by Naum
// * Function EB_UncookFish : Boolean; // * by Naum
// * Function EB_TalkToBob : Boolean; // * by Naum
// * Procedure EB_FindPortal; // * by Naum
// * Function SolveEvilBob : Boolean; // * by Naum, info from Markus

{ BIG Kudos to Markus, whom without his solver,
would have never thought it possible. }

Type
TStatue = Record //the Tstatue type stores the needed information
StatueLoc : String;
StatueCoords : TPoint;
End;

Var TempInfo : TStatue; //so we dont have to call the function over and over again
EB_Solved : Boolean;

Procedure EB_FindPortal; Forward;

{********************************************************************************}
{ 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 EB_MiddleIsland; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Walks to the middle of the island }
{********************************************************************************}

Procedure EB_MiddleIsland;
Var TPA : TPointArray;
Begin
If Not LoggedIn Then Exit;

TPA := GetMiniMapDots('npc'); //gets all npc dots (1 is ALWAYS visible)
If High(TPA) = -1 Then // if it fails..
Begin
WriteLn('Could Not walk to Middle?');
Exit;
End;

If Not PointInBox(TPA[0], IntToBox(MMCX -10, MMCY - 10, MMCX + 10, MMCY + 10)) Then
If MouseFlag(TPA[0].X - 4, TPA[0].Y, 0, 4, 0) Then //clicks on dot
WriteLn('Walked to middle of island');
End;

{********************************************************************************}
{ Function EB_FindServent; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds evil bob's servent }
{********************************************************************************}

Function EB_FindServent : Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
I : Integer;
X, Y, II : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.07, 0.58); //gets all servent like colors with 17 tol
FindColorsSpiralTolerance(MSCX + 10, MSCY, TPA, 4940926, MSX1, MSY1, MSX2, MSY2, 17);
ATPA := TPAToATPAEx(TPA, 10, 8); //splits it into boxes of 10x8

SortATPASize(ATPA, True); //Sorts the size 'big - first'
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //loops through all tpa's
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //the uptext col count
//If WaitUpText('erva', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
Wait(1400 + Random(1000));
//incase already solved ;)
If FindNPCChatText('uickly', Nothing) Then
Begin
WriteLn('Solved');
Wait(1200 + Random(200)); //yay it's solved
EB_FindPortal;
Wait(10000 + Random(2000));
ClickContinue(True, True); //waits for the duration of the teleport
EB_Solved := True;
End;

II := 0;
While ClickContinue(True, True) And (II <= 7) Do
Begin
Wait(600 + Random(100)); //gets dialouge done
Inc(II);
End;

WriteLn('Found servent, Identifying statue...');
Result := True;
Exit;
End Else
Continue; //until all the points (12) run out
End;
End;

{********************************************************************************}
{ Function EB_GetStatueInfo : TStatue; }
{ By: Naum idea from Zeph }
{ Date: 30 Dec 2009 }
{ Description: Grabs the statue's density, and locates it on the map }
{ Stores the co-ordinates and the map direction in the TStaute type }
{********************************************************************************}

Function EB_GetStatueInfo : TStatue;
Var TPA : TPointArray;
StatueDensity : Extended;
TB : TBox;
Mark : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 1.18); //COREECT MODS
MarkTime(Mark); //time mark
Repeat
FindColorsTolerance(TPA, 2401230, MSX1, MSY1, MSX2, MSY2, 16); //statue color
Wait(15); //to avoid lag
Until(Length(TPA) > 1900) Or (TimeFromMark(Mark) > 30000); //waits until it's in the slot
If Length(TPA) > 1900 Then
Begin
TB := GetTPABounds(TPA); //gets the box
StatueDensity := (Length(TPA) / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1) * 1.0)); //THE MAIN THING
Case StatueDensity Of //sets the type 'Tstatue'
0.49..0.60 : Begin
Result.StatueLoc := 'North';
Result.StatueCoords := Point(MMCX, MMCY - 50);
End;

0.40..0.47 : Begin
Result.StatueLoc := 'East';
Result.StatueCoords := Point(MMCX + 60, MMCY);
End;

0.3266..0.39 : Begin
Result.StatueLoc := 'West';
Result.StatueCoords := Point(MMCX - 60, MMCY);
End;

0.21..0.3259 : Begin
Result.StatueLoc := 'South';
Result.StatueCoords := Point(MMCX, MMCY + 50);
End;

End;
End Else
Begin
WriteLn('Could NOT identify statue!'); //If it cant find statue
Exit;
End;
WriteLn('Statue Density Is = '+FloatToStr(StatueDensity));
WriteLn('Found Statue in the '+Result.StatueLoc+' direction');
End;

{********************************************************************************}
{ Function EB_FindFishSpot : TPoint; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Stores the co-ordinates of the found fish spot (.X and .Y) }
{********************************************************************************}

Function EB_FindFishSpot : TPoint;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.19);
FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
ATPA := SplitTPA(TPA, 6); //splits the tpa with 'dist' of 6
SortATPAFromSize(ATPA, 30, True); //Sorts it by relative average size '30'

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
If InRange(CountColorTolerance(13816324, 7, 7, 160, 50, 24), 2, 502) Then //uptext
//If WaitUpText('ishi', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
Exit;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function EB_PerformTask : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Gets the fish from the statue, to cook. If there is no net in the }
{ inventory, or it is full. Then it will drop some items and click }
{ on a red item dot (close to the statue) and pick a net up. }
{ Will then fish from the spot closest to the statue }
{ }
{********************************************************************************}

Function EB_PerformTask : Boolean;
Var I, X, Y, TX, NetBmp : Integer;
RetardedFish : Integer;
OldCount : Integer; //variables needed (bitmaps and params).
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
Begin
If Not LoggedIn Then Exit;

TP := TempInfo.StatueCoords; //loading information
NetBmp := BitmapFromString(7, 8, 'beNo9jdsKwjAMhsvuxEPtbGZms9KD6' +
'5gdE8YuBC8UH8D3fxwjEyF8fPz5SUQhRBGNNrBn4Zk6Yj6n9ja4zm' +
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
// if we dont have a bitmap in the inventory
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
Begin
If InvCount = 28 Then //if the inventory is full
Begin
WriteLn('Oops Inventory seems to be full.. Dropping 2 items');

For I := 0 To 27 Do //make room
Begin
If DropItem(28 - I) Then
Inc(TX); //drop the last 2 items
If TX >= 2 Then Break;
End;

End;
Wait(1500 + Random(1000));
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin //goes to get a fishing net, near the right statue
OldCount := InvCount;
WriteLn('Retrieving a fishing net');
ColorToleranceSpeed(1); //fast but less accurate

FindColorsTolerance(TPA, 237, MMX1, MMY1, MMX2, MMY2, 30); //gets all red dots
FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items

Mouse(TPA[0].X - 2, TPA[0].Y + 2, 5, 5, True); //walks to it

While IsMoving Do //while wallking, some mouse movement
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));

If Not IsMoving Then
Begin
ColorToleranceSpeed(2); //finds the fishing net
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 13); //fishing net like colors
ATPA := SplitTPA(TPA, 8); //splittpa with dist of 6
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY)); //sorts all of the ATPA's from mainscreen center

For I := 0 To High(ATPA) Do //loops through
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1); //so the 'uptext' works fine
If InRange(CountColorTolerance(3635924, 7, 7, 160, 27, 22), 2, 502) Then
//If WaitUpText('mall', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
Break;
End Else
Continue;
End;
I := 0;
While (InvCount = OldCount) And (I < 10) Do //waits for the net to be picked up
Begin
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));
Inc(I);
End;
Wait(800 + Random(100));

If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Retrieved the net!'); //if found the net in inventory
FreeBitmap(NetBmp);
End Else
Begin
WriteLn('Could Not Retrieve Net');
FreeBitmap(NetBmp); //if not found net
Result := False;
Exit;
End;
End;
End;
End;

Begin
Mouse(TP.X, TP.Y, 10, 10, True); //clicks again to get to the fishing spot

While IsMoving Do
SleepAndMoveMouse(400 + Random(800)); //antiban

OldCount := InvCount; //stores invcount
TP := EB_FindFishSpot; //finds fish spot
Mouse(TP.X, TP.Y, 0, 0, True); //clicks the fish spot
I := 0;
While (InvCount = OldCount) And (I < 10) Do
Begin
SleepAndMoveMouse(400 + Random(800));
Inc(I); //waits until the fish appears in inv
End;

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Fished the fish')
Result := True; //double check
FreeBitmap(RetardedFish);
Exit;
End;
//decides outcome
Begin
Result := False;
FreeBitmap(RetardedFish);
Exit;
End;

End;
Wait(8);
End;

{********************************************************************************}
{ Function EB_UncookFish : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Uncooks the just-fished 'cooked fish' }
{********************************************************************************}

Function EB_UncookFish : Boolean;
Var I, X, Y : Integer;
CookedRetardedFish, RetardedFish : Integer; // bitmaps
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.59, 0.14); //correct mods

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
Else
Begin
WriteLn('Could not find retarded fish in inventory');
FreeBitmap(RetardedFish); //if it's not there..
Exit;
End;

FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
ATPA := TPAToATPA(TPA, 15); //splits it into 15 radius circles
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //sorts it, close to the player

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(13816324, 160, 9, 260, 50, 24) > 125 Then
//If WaitUpText('ook', srl_MaxWaitTime) Then ^ uptext
Begin
GetMousePos(X, Y);
Result := True;
Mouse(X, Y, 2, 2, True); //clicks on the pot
Break;
End Else
Continue;
End;
FreeBitmap(RetardedFish);

Wait(6000 + Random(1200)); //wait while the player cooks it
CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
WriteLn('Un cooked the retarded fish :)');
End;

{********************************************************************************}
{ Function EB_TalkToBob : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Talks to bob, finds if we need to fish more or to exit }
{********************************************************************************}

Function EB_TalkToBob : Boolean;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TSA : TStringArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2); //medium speed, accurate
SetColorSpeed2Modifiers(0.93, 0.28);
FindColorsTolerance(TPA, 2960944, MSX1, MSY1, MSX2, MSY2, 11); //find's blck-liek colors
ATPA := SplitTPA(TPA, 10);

SortATPAFromSize(ATPA, 72, True); //sorts it by average length
//so bob is likely to come first
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another object finding loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //up text fix
//If WaitUpText('vil', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Result := True;

While IsMoving Do Wait(100);

Begin
TSA := ['no-good', 'hungry']; //the responses to see if we need to get another fish
Begin
ClickContinue(True, True); //gets rid of first chat dialouge 'i got the fish...'
Wait(SRL_MaxWaitTime + Random(300));

EB_Solved := True; //If its proven false in the next part then it isn't, else it is

For I := 0 To High(TSA) Do
If FindNPCChatText(TSA[I], Nothing) Then
Begin
EB_Solved := False; //if any of those phrases are found in bob's speech
Break; //then we need to get another one
End;
If (Not (EB_Solved)) Then
WriteLn('Going to get another fish'); //debugs we need to get another one.

If FindNPCChatText('isgu', Nothing) Then
Begin
WriteLn('Whoops! Got the wrong fish..'); // we got the wrong fish -_-
EB_Solved := False;
End;

If Random(2) = 1 Then
Begin
ClickContinue(True, True); //does random click to continue.
If Random(2) = 1 Then
ClickContinue(True, True);
End;
Exit;
End;
End;
End Else
Continue;
End;
Wait(1);
End;

{********************************************************************************}
{ Procedure EB_FindPortal; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds the portal needed to exit }
{********************************************************************************}

Procedure EB_FindPortal;
Var I, X, Y, TX, TY : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.62); //finds all portal like colors
FindColorsTolerance(TPA, 7388602, MSX1, MSY1, MSX2, MSY2, 7)
ATPA := SplitTPA(TPA, 10);

SortTPAFrom(TPA, Point(MSCX - 20, MSCY)); //sorts the tpa's within the ATPA's
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //Sorts all the ATPAs from center

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another obj loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If FindColorTolerance(TX, TY, 13816324, 7, 7, 160, 50, 24) Then //uptext fix
//If WaitUpText('orta', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True);
WriteLn('Found the Portal'); //clicks on portal if found
FFlag(0);
Wait(1300 + Random(1000));
//Incase of confirmation thingy
If FindColor(TX, TY, 2070783, 234, 46, 254, 56) Then
Mouse(172, 199, 100, 4, True);

Break;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function SolveEvilBob : Boolean; }
{ By: Naum, info from Markus }
{ Date: 30 Dec 2009 }
{ Description: Solves the EvilBob event }
{********************************************************************************}

Function SolveEvilBob : Boolean;
Var Mark : Integer;
Begin
MarkTime(Mark); //mark time
MakeCompass('N'); //sets optimum object finding.
SetAngle(True);
SetRun(True);

Repeat
EB_MiddleIsland; //walks to the middle of the island

Wait(2000 + Random(1000));

Result := EB_FindServent //finds servent
If EB_Solved Then Break;
If Not Result Then
Begin
LogOut;
Exit;
End;

TempInfo := EB_GetStatueInfo; //gets info
Wait(1000 + Random(1000));
ClickContinue(True, True);

Result := EB_PerformTask; //performs the task
If Not Result Then
Begin
LogOut;
Exit;
End;

Wait(1000 + Random(1000));
ClickContinue(True, True);

EB_MiddleIsland; //goes back to middle
Wait(2000 + Random(1000));

Result := EB_UncookFish; //un-cooks fish
If Not Result Then
Begin
LogOut;
Exit;
End;

Result := EB_TalkToBob; //talks again to bob
If Not Result Then
Begin
LogOut;
Exit;
End;
Until(EB_Solved = True) Or (Not (LoggedIn));

If (EB_Solved) Then
Begin
WriteLn('Solved');
Wait(1200 + Random(200)); //yay it's solved
EB_FindPortal;
WriteLn('Solved Evil Bob'#39's Island in '+IntToStr(TimeFromMark(Mark))+' msec');

Wait(10000 + Random(2000));
ClickContinue(True, True); //waits for the duration of the teleport
End Else
Exit;

Wait(1);
End;

{EXACT Density Ranges

North =
Density Range = 0.52 - 0.55

East =
Density Range = 0.43 - 0.46

South =
Density Range = 0.30 - 0.33 //close to west

West =
Density Range = 0.35 - 0.37 //too close to south}

Success reports:

Found servent, Identifying statue...
Statue Density Is = 0.363757115749526
Found Statue in the West direction
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Solved Evil Bobs Island in 60625 msec

{-----------------------------------------------}

Found servent, Identifying statue...
Statue Density Is = 0.449838932351588
Found Statue in the East direction
Oops Inventory seems to be full.. Dropping 2 items
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Solved Evil Bobs Island in 64531 msec

Also, if it fails, for what ever reason. I would love to have the account so I can tweak it etc.
I'll constify it later :).

Thanks :)


Please note: This script uses 'crude' methods for the uptext (Color finding), it works. But once uptext is fixed just uncomment the commented stuff.

A video I made because I was bored: http://www.youtube.com/watch?v=fgt9MYH7fMI

Nava2

2009-12-26 10:00:16

I lol'd really really hard at the ``retardedFish'' variable.

PLEASE USE PROPER STANDARDS :(

ZephyrsFury

2009-12-26 10:05:52

Nice work Naum, good job :)

marpis

2009-12-26 10:36:03

Awesome job! :) One of the hardest randoms!

Wanted

2009-12-26 14:32:58

A lot of the object finders are pretty unstable… the map walking functions often throw Out of Range Errors because you don't Exit if length is less than one. And the statue detection lags to death.

something like a simple Wait(15) would fix the detection lag:

  Repeat
FindColorsTolerance(TPA, 2401230, MSX1, MSY1, MSX2, MSY2, 16);
Wait(15);
Until(Length(TPA) > 1900) Or (TimeFromMark(Mark) > 30000);

for the out of range erros:

  TPA := GetMiniMapDots('npc');
If Length(TPA) < 1 Then Exit;

and it's still really unstable with the object/NPC finding… logs out often even though statue was correctly detected. That should be the hard part.

All in all, it needs some fixing up… but good job.

Naum

2009-12-27 05:39:09

From: IceFire908
A lot of the object finders are pretty unstable… the map walking functions often throw Out of Range Errors because you don't Exit if length is less than one. And the statue detection lags to death.

something like a simple Wait(15) would fix the detection lag:

  Repeat
FindColorsTolerance(TPA, 2401230, MSX1, MSY1, MSX2, MSY2, 16);
Wait(15);
Until(Length(TPA) > 1900) Or (TimeFromMark(Mark) > 30000);

for the out of range erros:

  TPA := GetMiniMapDots('npc');
If Length(TPA) < 1 Then Exit;

and it's still really unstable with the object/NPC finding… logs out often even though statue was correctly detected. That should be the hard part.

All in all, it needs some fixing up… but good job.


Hey, thanks so much for the feedback, rep+.

The object finders work fine, just need a better replacement for UpText rather than a FindColor. I completely re-did the object finder hue/sat and tolerance for the 'EvilBob Cat', as it would click on the deposit box instead.

I'll add your other suggestions, but I have no reason why it would throw and out of range, or log out for that matter. This is because there is always one NPC dot visible - no matter where the character is.

I'll try and fix it up today and have it working. But please keep up the testing, as that is why it is situated here :).

Thanks for the support, nice comments and everything, guys :)

EDIT: Upped new version!:

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Evil Bob Island Routines --//
//-----------------------------------------------------------------//
// * Function InEvilBobsIsland: Boolean; // * by ZephyrsFury, lordsaturn
// * Procedure EB_MiddleIsland; // * by Naum
// * Function EB_FindServent : Boolean; // * by Naum
// * Function EB_GetStatueInfo : TStatue; // * by Naum, idea from Zeph
// * Function EB_FindFishSpot : TPoint; // * by Naum
// * Function EB_PerformTask : Boolean; // * by Naum
// * Function EB_UncookFish : Boolean; // * by Naum
// * Function EB_TalkToBob : Boolean; // * by Naum
// * Procedure EB_FindPortal; // * by Naum
// * Function SolveEvilBob : Boolean; // * by Naum, info from Markus

{ BIG Kudos to Markus, whom without his solver,
would have never thought it possible. }

Type
TStatue = Record //the Tstatue type stores the needed information
StatueLoc : String;
StatueCoords : TPoint;
End;

Var TempInfo : TStatue; //so we dont have to call the function over and over again
EB_Solved : Boolean;

{********************************************************************************}
{ 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 EB_MiddleIsland; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Walks to the middle of the island }
{********************************************************************************}

Procedure EB_MiddleIsland;
Var TPA : TPointArray;
Begin
If Not LoggedIn Then Exit;

TPA := GetMiniMapDots('npc'); //gets all npc dots (1 is ALWAYS visible)
If High(TPA) = -1 Then // if it fails..
Begin
WriteLn('Could Not walk to Middle?');
Exit;
End;

If Not PointInBox(TPA[0], IntToBox(MMCX -10, MMCY - 10, MMCX + 10, MMCY + 10)) Then
If MouseFlag(TPA[0].X - 4, TPA[0].Y, 0, 4, 0) Then //clicks on dot
WriteLn('Walked to middle of island');
End;

{********************************************************************************}
{ Function EB_FindServent; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds evil bob's servent }
{********************************************************************************}

Function EB_FindServent : Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
I : Integer;
X, Y, II : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.07, 0.58); //gets all servent like colors with 17 tol
FindColorsSpiralTolerance(MSCX + 10, MSCY, TPA, 4940926, MSX1, MSY1, MSX2, MSY2, 17);
ATPA := TPAToATPAEx(TPA, 10, 8); //splits it into boxes of 10x8

SortATPASize(ATPA, True); //Sorts the size 'big - first'
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //loops through all tpa's
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //the uptext col count
//If WaitUpText('erva', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
Wait(1400 + Random(1000));

II := 0;
While ClickContinue(True, True) And (II <= 7) Do
Begin
Wait(600 + Random(100)); //gets dialouge done
Inc(II);
End;

WriteLn('Found servent, Identifying statue...');
Result := True;
Exit;
End Else
Continue; //until all the points (12) run out
End;
End;

{********************************************************************************}
{ Function EB_GetStatueInfo : TStatue; }
{ By: Naum idea from Zeph }
{ Date: 30 Dec 2009 }
{ Description: Grabs the statue's density, and locates it on the map }
{ Stores the co-ordinates and the map direction in the TStaute type }
{********************************************************************************}

Function EB_GetStatueInfo : TStatue;
Var TPA : TPointArray;
StatueDensity : Extended;
TB : TBox;
Mark : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 1.18); //COREECT MODS
MarkTime(Mark); //time mark
Repeat
FindColorsTolerance(TPA, 2401230, MSX1, MSY1, MSX2, MSY2, 16); //statue color
Wait(15); //to avoid lag
Until(Length(TPA) > 1900) Or (TimeFromMark(Mark) > 30000); //waits until it's in the slot
If Length(TPA) > 1900 Then
Begin
TB := GetTPABounds(TPA); //gets the box
StatueDensity := (Length(TPA) / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1) * 1.0)); //THE MAIN THING
Case StatueDensity Of //sets the type 'Tstatue'
0.49..0.60 : Begin
Result.StatueLoc := 'North';
Result.StatueCoords := Point(MMCX, MMCY - 50);
End;

0.40..0.47 : Begin
Result.StatueLoc := 'East';
Result.StatueCoords := Point(MMCX + 60, MMCY);
End;

0.3266..0.39 : Begin
Result.StatueLoc := 'West';
Result.StatueCoords := Point(MMCX - 60, MMCY);
End;

0.21..0.3259 : Begin
Result.StatueLoc := 'South';
Result.StatueCoords := Point(MMCX, MMCY + 50);
End;

End;
End Else
Begin
WriteLn('Could NOT identify statue!'); //If it cant find statue
Exit;
End;
WriteLn('Statue Density Is = '+FloatToStr(StatueDensity));
WriteLn('Found Statue in the '+Result.StatueLoc+' direction');
End;

{********************************************************************************}
{ Function EB_FindFishSpot : TPoint; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Stores the co-ordinates of the found fish spot (.X and .Y) }
{********************************************************************************}

Function EB_FindFishSpot : TPoint;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.19);
FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
ATPA := SplitTPA(TPA, 6); //splits the tpa with 'dist' of 6
SortATPAFromSize(ATPA, 30, True); //Sorts it by relative average size '30'

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
If InRange(CountColorTolerance(13816324, 7, 7, 160, 50, 24), 2, 502) Then //uptext
//If WaitUpText('ishi', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
Exit;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function EB_PerformTask : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Gets the fish from the statue, to cook. If there is no net in the }
{ inventory, or it is full. Then it will drop some items and click }
{ on a red item dot (close to the statue) and pick a net up. }
{ Will then fish from the spot closest to the statue }
{ }
{********************************************************************************}

Function EB_PerformTask : Boolean;
Var I, X, Y, TX, NetBmp : Integer;
RetardedFish : Integer;
OldCount : Integer; //variables needed (bitmaps and params).
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
Begin
If Not LoggedIn Then Exit;

TP := TempInfo.StatueCoords; //loading information
NetBmp := BitmapFromString(7, 8, 'beNo9jdsKwjAMhsvuxEPtbGZms9KD6' +
'5gdE8YuBC8UH8D3fxwjEyF8fPz5SUQhRBGNNrBn4Zk6Yj6n9ja4zm' +
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
// if we dont have a bitmap in the inventory
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
Begin
If InvCount = 28 Then //if the inventory is full
Begin
WriteLn('Oops Inventory seems to be full.. Dropping 2 items');

For I := 0 To 27 Do //make room
Begin
If DropItem(28 - I) Then
Inc(TX); //drop the last 2 items
If TX >= 2 Then Break;
End;

End;
Wait(1500 + Random(1000));
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin //goes to get a fishing net, near the right statue
OldCount := InvCount;
WriteLn('Retrieving a fishing net');
ColorToleranceSpeed(1); //fast but less accurate

FindColorsTolerance(TPA, 237, MMX1, MMY1, MMX2, MMY2, 30); //gets all red dots
FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items

Mouse(TPA[0].X - 2, TPA[0].Y + 2, 5, 5, True); //walks to it

While IsMoving Do //while wallking, some mouse movement
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));

If Not IsMoving Then
Begin
ColorToleranceSpeed(2); //finds the fishing net
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 13); //fishing net like colors
ATPA := SplitTPA(TPA, 8); //splittpa with dist of 6
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY)); //sorts all of the ATPA's from mainscreen center

For I := 0 To High(ATPA) Do //loops through
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1); //so the 'uptext' works fine
If InRange(CountColorTolerance(3635924, 7, 7, 160, 27, 22), 2, 502) Then
//If WaitUpText('mall', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
Break;
End Else
Continue;
End;
I := 0;
While (InvCount = OldCount) And (I < 10) Do //waits for the net to be picked up
Begin
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));
Inc(I);
End;
Wait(800 + Random(100));

If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Retrieved the net!'); //if found the net in inventory
FreeBitmap(NetBmp);
End Else
Begin
WriteLn('Could Not Retrieve Net');
FreeBitmap(NetBmp); //if not found net
Result := False;
Exit;
End;
End;
End;
End;

Begin
Mouse(TP.X, TP.Y, 10, 10, True); //clicks again to get to the fishing spot

While IsMoving Do
SleepAndMoveMouse(400 + Random(800)); //antiban

OldCount := InvCount; //stores invcount
TP := EB_FindFishSpot; //finds fish spot
Mouse(TP.X, TP.Y, 0, 0, True); //clicks the fish spot
I := 0;
While (InvCount = OldCount) And (I < 10) Do
Begin
SleepAndMoveMouse(400 + Random(800));
Inc(I); //waits until the fish appears in inv
End;

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Fished the fish')
Result := True; //double check
FreeBitmap(RetardedFish);
End
Else //decides outcome
Begin
Result := False;
FreeBitmap(RetardedFish);
Exit;
End;
End;
Wait(8);
End;

{********************************************************************************}
{ Function EB_UncookFish : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Uncooks the just-fished 'cooked fish' }
{********************************************************************************}

Function EB_UncookFish : Boolean;
Var I, X, Y : Integer;
CookedRetardedFish, RetardedFish : Integer; // bitmaps
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.59, 0.14); //correct mods

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
Else
Begin
WriteLn('Could not find retarded fish in inventory');
FreeBitmap(RetardedFish); //if it's not there..
Exit;
End;

FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
ATPA := TPAToATPA(TPA, 15); //splits it into 15 radius circles
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //sorts it, close to the player

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If InRange(CountColorTolerance(13816324, 160, 9, 260, 50, 24), 2, 502) Then
//If WaitUpText('ook', srl_MaxWaitTime) Then ^ uptext
Begin
GetMousePos(X, Y);
Result := True;
Mouse(X, Y, 2, 2, True); //clicks on the pot
Break;
End Else
Continue;
End;
FreeBitmap(RetardedFish);

Wait(7000 + Random(1200)); //wait while the player cooks it
CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
WriteLn('Un cooked the retarded fish :)');
End;

{********************************************************************************}
{ Function EB_TalkToBob : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Talks to bob, finds if we need to fish more or to exit }
{********************************************************************************}

Function EB_TalkToBob : Boolean;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TSA : TStringArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2); //medium speed, accurate
SetColorSpeed2Modifiers(0.93, 0.28);
FindColorsTolerance(TPA, 2960944, MSX1, MSY1, MSX2, MSY2, 11); //find's blck-liek colors
ATPA := SplitTPA(TPA, 10);

SortATPAFromSize(ATPA, 72, True); //sorts it by average length
//so bob is likely to come first
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another object finding loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //up text fix
//If WaitUpText('vil', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Result := True;

While IsMoving Do Wait(100);

Begin
TSA := ['no-good', 'delicious', 'hungry']; //the responses to see if we need to get another fish
Begin
ClickContinue(True, True); //gets rid of first chat dialouge 'i got the fish...'
Wait(SRL_MaxWaitTime + Random(300));

EB_Solved := True; //If its proven false in the next part then it isn't, else it is

For I := 0 To High(TSA) Do
If FindNPCChatText(TSA[I], Nothing) Then
Begin
EB_Solved := False; //if any of those phrases are found in bob's speech
Break; //then we need to get another one
End;
If (Not (EB_Solved)) Then
WriteLn('Going to get another fish'); //debugs we need to get another one.

If FindNPCChatText('isgu', Nothing) Then
Begin
WriteLn('Whoops! Got the wrong fish..'); // we got the wrong fish -_-
EB_Solved := False;
End;

If Random(2) = 1 Then
Begin
ClickContinue(True, True); //does random click to continue.
If Random(2) = 1 Then
ClickContinue(True, True);
End;
Exit;
End;
End;
End Else
Continue;
End;
Wait(1);
End;

{********************************************************************************}
{ Procedure EB_FindPortal; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds the portal needed to exit }
{********************************************************************************}

Procedure EB_FindPortal;
Var I, X, Y, TX, TY : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.62); //finds all portal like colors
FindColorsTolerance(TPA, 7388602, MSX1, MSY1, MSX2, MSY2, 7)
ATPA := SplitTPA(TPA, 10);

SortTPAFrom(TPA, Point(MSCX - 20, MSCY)); //sorts the tpa's within the ATPA's
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //Sorts all the ATPAs from center

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another obj loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If FindColorTolerance(TX, TY, 13816324, 7, 7, 160, 50, 24) Then //uptext fix
//If WaitUpText('orta', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True);
WriteLn('Found the Portal'); //clicks on portal if found
FFlag(0);
Wait(1300 + Random(1000));
//Incase of confirmation thingy
If FindColor(TX, TY, 2070783, 234, 46, 254, 56) Then
Mouse(172, 199, 100, 4, True);

Break;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function SolveEvilBob : Boolean; }
{ By: Naum, info from Markus }
{ Date: 30 Dec 2009 }
{ Description: Solves the EvilBob event }
{********************************************************************************}

Function SolveEvilBob : Boolean;
Var Mark : Integer;
Begin
MarkTime(Mark); //mark time
MakeCompass('N'); //sets optimum object finding.
SetAngle(True);
SetRun(True);

Repeat
EB_MiddleIsland; //walks to the middle of the island

Wait(2000 + Random(1000));
Result := EB_FindServent //finds servent
If Not Result Then
Begin
LogOut;
Exit;
End;

TempInfo := EB_GetStatueInfo; //gets info
Wait(1000 + Random(1000));
ClickContinue(True, True);

Result := EB_PerformTask; //performs the task
If Not Result Then
Begin
LogOut;
Exit;
End;

Wait(1000 + Random(1000));
ClickContinue(True, True);

EB_MiddleIsland; //goes back to middle
Wait(2000 + Random(1000));

Result := EB_UncookFish; //un-cooks fish
If Not Result Then
Begin
LogOut;
Exit;
End;

Result := EB_TalkToBob; //talks again to bob
If Not Result Then
Begin
LogOut;
Exit;
End;
Until(EB_Solved = True) Or (Not (LoggedIn));

If (EB_Solved) Then
Begin
WriteLn('Solved');
Wait(1200 + Random(200)); //yay it's solved
EB_FindPortal;
WriteLn('Solved Evil Bob'#39's Island in '+IntToStr(TimeFromMark(Mark))+' msec');

Wait(10000 + Random(2000));
ClickContinue(True, True); //waits for the duration of the teleport
End Else
Exit;

Wait(1);
End;

{EXACT Density Ranges

North =
Density Range = 0.52 - 0.55

East =
Density Range = 0.43 - 0.46

South =
Density Range = 0.30 - 0.33 //close to west

West =
Density Range = 0.35 - 0.37 //too close to south}

Exiting and/or getting another fish has to be tested.

THIS IS THE OLD VERSION, NEW ONE IS IN THE FIRST POST!

Wanted

2009-12-27 13:47:56

To avoid confusion, just update the first post with the script/attachment instead of reposting it every time you change something.

After I added in the Wait(15) to the statue detection it worked pretty well

{.Include SRL\SRL.SCAR}

begin
SetUpSRL;
ActivateClient;
Wait(1000);
WriteLn(SolveEvilBob);
end.

SRL Compiled in 47 msec
Walked to middle of island
Found servent, Identifying statue...
Statue Density Is = 0.361777944486122
Found Statue in the West direction
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Solved Evil Bob's Island in 75516 msec
1
Successfully executed

marpis

2009-12-27 13:53:18

Wooo! :) This is awesome! On of the hardest randoms solved with color!
I'd never have believed this random is indeed solveable.

Markus

2009-12-27 14:33:46

From: marpis
Wooo! :) This is awesome! On of the hardest randoms solved with color!
I'd never have believed this random is indeed solveable.


You know that I actually solved it over 2 years ago with colour :rolleyes:


But still good job :)

nielsie95

2009-12-27 15:04:28

I think Marpis means the Prison Pete..

Nice work, Naum :)

Wanted

2009-12-27 15:24:59

From: nielsie95
I think Marpis means the Prison Pete..

Nice work, Naum :)


1) Mime
2) Prison pete
3) Mordaut
4) Evil bob
5) Leo
6) Maze
7) Pinball
8) Quiz
9) Molly
9.5) Abbysal (with angle)
10) Demon
11) Forester
12) Pillory
13) Abyssal (no angle)
14) Beekeeper
15) Sandwhich
16) Frog

Dunno where capn arrav and certer fit in there, but IMO those are the hardest in order.

marpis

2009-12-29 07:25:06

From: nielsie95
I think Marpis means the Prison Pete..

Nice work, Naum :)


No, I actually meant Bob :rolleyes: The statue recognizing, correct walking, pickinging the net, fishing, walking again, uncooking… Most of the tasks are easy but there are so many of them. And there are other players too who might mess things up.

Naum

2009-12-29 08:54:13

Here's another success log:

Walked to middle of island
Found servent, Identifying statue...
Statue Density Is = 0.312879409351928
Found Statue in the South direction
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Going to get another fish
Found servent, Identifying statue...
Statue Density Is = 0.521241830065359
Found Statue in the North direction
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Going to get another fish
Found servent, Identifying statue...
Statue Density Is = 0.530956329463792
Found Statue in the North direction
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Successfully executed //ended to use again for portal. + exiting

I'll post up a video soon, once it uploads.
Thanks guys, big thanks to Tara whose account I used it on :)

Here's the video: http://www.youtube.com/watch?v=fgt9MYH7fMI, as proof that it works.

Need to fix exiting, but i'll get that done tomorrow, hopefully :).

EDIT: Actually, I'd made a stupid mistake, I think I've fixed it.


PLEASE TEST UPDATED VERSION!

THIS IS THE OLD VERSION, NEW ONE IS IN THE FIRST POST!

HyperSecret

2009-12-29 19:01:31

It looks like it needs some work on finding that person to talk to on the island but besides that it looks awesome!

Good job!

Town

2009-12-30 20:48:34

***** STR: FOUND RANDOM: 'Evil Bob's Island' *****
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
1
Bobsolver - Waiting and clicking until the statue is there
2
Bobsolver - Waiting and clicking until the statue is there
3
Bobsolver - Waiting and clicking until the statue is there
4
Bobsolver - Statue: dead cat
ratio: 1
***** STR: 'Evil Bob's Island' RANDOM SOLVING FAILED! *****

It may have an infinite loop at the end. Otherwise, I got impatient before it moved on to the next player. Logged out standing next to the original Evil Bob.

Naum

2009-12-31 08:39:20

From: Town
***** STR: FOUND RANDOM: 'Evil Bob's Island' *****
Bobsolver - attempting to talk to the servant
Bobsolver - Waiting and clicking until the statue is there
1
Bobsolver - Waiting and clicking until the statue is there
2
Bobsolver - Waiting and clicking until the statue is there
3
Bobsolver - Waiting and clicking until the statue is there
4
Bobsolver - Statue: dead cat
ratio: 1
***** STR: 'Evil Bob's Island' RANDOM SOLVING FAILED! *****

It may have an infinite loop at the end. Otherwise, I got impatient before it moved on to the next player. Logged out standing next to the original Evil Bob.


One small problem…

That's the old solver.

Town

2009-12-31 12:05:45

I didn't realize that there was a solver before yours, sorry.

Naum

2010-01-01 15:41:21

From: Town
I didn't realize that there was a solver before yours, sorry.


No problem, we all make mistakes :).

You might want to run this version (the most up-to date one):

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Evil Bob Island Routines --//
//-----------------------------------------------------------------//
// * Function InEvilBobsIsland: Boolean; // * by ZephyrsFury, lordsaturn
// * Procedure EB_MiddleIsland; // * by Naum
// * Function EB_FindServent : Boolean; // * by Naum
// * Function EB_GetStatueInfo : TStatue; // * by Naum, idea from Zeph
// * Function EB_FindFishSpot : TPoint; // * by Naum
// * Function EB_PerformTask : Boolean; // * by Naum
// * Function EB_UncookFish : Boolean; // * by Naum
// * Function EB_TalkToBob : Boolean; // * by Naum
// * Procedure EB_FindPortal; // * by Naum
// * Function SolveEvilBob : Boolean; // * by Naum, info from Markus

{ BIG Kudos to Markus, whom without his solver,
would have never thought it possible. }

Type
TStatue = Record //the Tstatue type stores the needed information
StatueLoc : String;
StatueCoords : TPoint;
End;

Var TempInfo : TStatue; //so we dont have to call the function over and over again
EB_Solved : Boolean;

{********************************************************************************}
{ 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 EB_MiddleIsland; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Walks to the middle of the island }
{********************************************************************************}

Procedure EB_MiddleIsland;
Var TPA : TPointArray;
Begin
If Not LoggedIn Then Exit;

TPA := GetMiniMapDots('npc'); //gets all npc dots (1 is ALWAYS visible)
If High(TPA) = -1 Then // if it fails..
Begin
WriteLn('Could Not walk to Middle?');
Exit;
End;

If Not PointInBox(TPA[0], IntToBox(MMCX -10, MMCY - 10, MMCX + 10, MMCY + 10)) Then
If MouseFlag(TPA[0].X - 4, TPA[0].Y, 0, 4, 0) Then //clicks on dot
WriteLn('Walked to middle of island');
End;

{********************************************************************************}
{ Function EB_FindServent; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds evil bob's servent }
{********************************************************************************}

Function EB_FindServent : Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
I : Integer;
X, Y, II : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.07, 0.58); //gets all servent like colors with 17 tol
FindColorsSpiralTolerance(MSCX + 10, MSCY, TPA, 4940926, MSX1, MSY1, MSX2, MSY2, 17);
ATPA := TPAToATPAEx(TPA, 10, 8); //splits it into boxes of 10x8

SortATPASize(ATPA, True); //Sorts the size 'big - first'
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //loops through all tpa's
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //the uptext col count
//If WaitUpText('erva', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
Wait(1400 + Random(1000));

II := 0;
While ClickContinue(True, True) And (II <= 7) Do
Begin
Wait(600 + Random(100)); //gets dialouge done
Inc(II);
End;

WriteLn('Found servent, Identifying statue...');
Result := True;
Exit;
End Else
Continue; //until all the points (12) run out
End;
End;

{********************************************************************************}
{ Function EB_GetStatueInfo : TStatue; }
{ By: Naum idea from Zeph }
{ Date: 30 Dec 2009 }
{ Description: Grabs the statue's density, and locates it on the map }
{ Stores the co-ordinates and the map direction in the TStaute type }
{********************************************************************************}

Function EB_GetStatueInfo : TStatue;
Var TPA : TPointArray;
StatueDensity : Extended;
TB : TBox;
Mark : Integer;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 1.18); //COREECT MODS
MarkTime(Mark); //time mark
Repeat
FindColorsTolerance(TPA, 2401230, MSX1, MSY1, MSX2, MSY2, 16); //statue color
Wait(15); //to avoid lag
Until(Length(TPA) > 1900) Or (TimeFromMark(Mark) > 30000); //waits until it's in the slot
If Length(TPA) > 1900 Then
Begin
TB := GetTPABounds(TPA); //gets the box
StatueDensity := (Length(TPA) / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1) * 1.0)); //THE MAIN THING
Case StatueDensity Of //sets the type 'Tstatue'
0.49..0.60 : Begin
Result.StatueLoc := 'North';
Result.StatueCoords := Point(MMCX, MMCY - 50);
End;

0.40..0.47 : Begin
Result.StatueLoc := 'East';
Result.StatueCoords := Point(MMCX + 60, MMCY);
End;

0.3266..0.39 : Begin
Result.StatueLoc := 'West';
Result.StatueCoords := Point(MMCX - 60, MMCY);
End;

0.21..0.3259 : Begin
Result.StatueLoc := 'South';
Result.StatueCoords := Point(MMCX, MMCY + 50);
End;

End;
End Else
Begin
WriteLn('Could NOT identify statue!'); //If it cant find statue
Exit;
End;
WriteLn('Statue Density Is = '+FloatToStr(StatueDensity));
WriteLn('Found Statue in the '+Result.StatueLoc+' direction');
End;

{********************************************************************************}
{ Function EB_FindFishSpot : TPoint; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Stores the co-ordinates of the found fish spot (.X and .Y) }
{********************************************************************************}

Function EB_FindFishSpot : TPoint;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.19);
FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
ATPA := SplitTPA(TPA, 6); //splits the tpa with 'dist' of 6
SortATPAFromSize(ATPA, 30, True); //Sorts it by relative average size '30'

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
If InRange(CountColorTolerance(13816324, 7, 7, 160, 50, 24), 2, 502) Then //uptext
//If WaitUpText('ishi', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
Exit;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function EB_PerformTask : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Gets the fish from the statue, to cook. If there is no net in the }
{ inventory, or it is full. Then it will drop some items and click }
{ on a red item dot (close to the statue) and pick a net up. }
{ Will then fish from the spot closest to the statue }
{ }
{********************************************************************************}

Function EB_PerformTask : Boolean;
Var I, X, Y, TX, NetBmp : Integer;
RetardedFish : Integer;
OldCount : Integer; //variables needed (bitmaps and params).
TPA : TPointArray;
ATPA : T2DPointArray;
TP : TPoint;
Begin
If Not LoggedIn Then Exit;

TP := TempInfo.StatueCoords; //loading information
NetBmp := BitmapFromString(7, 8, 'beNo9jdsKwjAMhsvuxEPtbGZms9KD6' +
'5gdE8YuBC8UH8D3fxwjEyF8fPz5SUQhRBGNNrBn4Zk6Yj6n9ja4zm' +
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
// if we dont have a bitmap in the inventory
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
Begin
If InvCount = 28 Then //if the inventory is full
Begin
WriteLn('Oops Inventory seems to be full.. Dropping 2 items');

For I := 0 To 27 Do //make room
Begin
If DropItem(28 - I) Then
Inc(TX); //drop the last 2 items
If TX >= 2 Then Break;
End;

End;
Wait(1500 + Random(1000));
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin //goes to get a fishing net, near the right statue
OldCount := InvCount;
WriteLn('Retrieving a fishing net');
ColorToleranceSpeed(1); //fast but less accurate

FindColorsTolerance(TPA, 237, MMX1, MMY1, MMX2, MMY2, 30); //gets all red dots
FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items

Mouse(TPA[0].X - 2, TPA[0].Y + 2, 5, 5, True); //walks to it

While IsMoving Do //while wallking, some mouse movement
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));

If Not IsMoving Then
Begin
ColorToleranceSpeed(2); //finds the fishing net
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 13); //fishing net like colors
ATPA := SplitTPA(TPA, 8); //splittpa with dist of 6
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY)); //sorts all of the ATPA's from mainscreen center

For I := 0 To High(ATPA) Do //loops through
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1); //so the 'uptext' works fine
If InRange(CountColorTolerance(3635924, 7, 7, 160, 27, 22), 2, 502) Then
//If WaitUpText('mall', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
Break;
End Else
Continue;
End;
I := 0;
While (InvCount = OldCount) And (I < 10) Do //waits for the net to be picked up
Begin
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));
Inc(I);
End;
Wait(800 + Random(100));

If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Retrieved the net!'); //if found the net in inventory
FreeBitmap(NetBmp);
End Else
Begin
WriteLn('Could Not Retrieve Net');
FreeBitmap(NetBmp); //if not found net
Result := False;
Exit;
End;
End;
End;
End;

Begin
Mouse(TP.X, TP.Y, 10, 10, True); //clicks again to get to the fishing spot

While IsMoving Do
SleepAndMoveMouse(400 + Random(800)); //antiban

OldCount := InvCount; //stores invcount
TP := EB_FindFishSpot; //finds fish spot
Mouse(TP.X, TP.Y, 0, 0, True); //clicks the fish spot
I := 0;
While (InvCount = OldCount) And (I < 10) Do
Begin
SleepAndMoveMouse(400 + Random(800));
Inc(I); //waits until the fish appears in inv
End;

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Fished the fish')
Result := True; //double check
FreeBitmap(RetardedFish);
End
Else //decides outcome
Begin
Result := False;
FreeBitmap(RetardedFish);
Exit;
End;
End;
Wait(8);
End;

{********************************************************************************}
{ Function EB_UncookFish : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Uncooks the just-fished 'cooked fish' }
{********************************************************************************}

Function EB_UncookFish : Boolean;
Var I, X, Y : Integer;
CookedRetardedFish, RetardedFish : Integer; // bitmaps
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.59, 0.14); //correct mods

RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
Else
Begin
WriteLn('Could not find retarded fish in inventory');
FreeBitmap(RetardedFish); //if it's not there..
Exit;
End;

FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
ATPA := TPAToATPA(TPA, 15); //splits it into 15 radius circles
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //sorts it, close to the player

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If InRange(CountColorTolerance(13816324, 160, 9, 260, 50, 24), 2, 502) Then
//If WaitUpText('ook', srl_MaxWaitTime) Then ^ uptext
Begin
GetMousePos(X, Y);
Result := True;
Mouse(X, Y, 2, 2, True); //clicks on the pot
Break;
End Else
Continue;
End;
FreeBitmap(RetardedFish);

Wait(7000 + Random(1200)); //wait while the player cooks it
CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
WriteLn('Un cooked the retarded fish :)');
End;

{********************************************************************************}
{ Function EB_TalkToBob : Boolean; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Talks to bob, finds if we need to fish more or to exit }
{********************************************************************************}

Function EB_TalkToBob : Boolean;
Var I, X, Y : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
TSA : TStringArray;
Begin
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2); //medium speed, accurate
SetColorSpeed2Modifiers(0.93, 0.28);
FindColorsTolerance(TPA, 2960944, MSX1, MSY1, MSX2, MSY2, 11); //find's blck-liek colors
ATPA := SplitTPA(TPA, 10);

SortATPAFromSize(ATPA, 72, True); //sorts it by average length
//so bob is likely to come first
For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another object finding loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If CountColorTolerance(120277, 58, 7, 116, 23, 10) > 30 Then //up text fix
//If WaitUpText('vil', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Result := True;

While IsMoving Do Wait(100);

Begin
TSA := ['no-good', 'delicious', 'hungry']; //the responses to see if we need to get another fish
Begin
ClickContinue(True, True); //gets rid of first chat dialouge 'i got the fish...'
Wait(SRL_MaxWaitTime + Random(300));

EB_Solved := True; //If its proven false in the next part then it isn't, else it is

For I := 0 To High(TSA) Do
If FindNPCChatText(TSA[I], Nothing) Then
Begin
EB_Solved := False; //if any of those phrases are found in bob's speech
Break; //then we need to get another one
End;
If (Not (EB_Solved)) Then
WriteLn('Going to get another fish'); //debugs we need to get another one.

If FindNPCChatText('isgu', Nothing) Then
Begin
WriteLn('Whoops! Got the wrong fish..'); // we got the wrong fish -_-
EB_Solved := False;
End;

If Random(2) = 1 Then
Begin
ClickContinue(True, True); //does random click to continue.
If Random(2) = 1 Then
ClickContinue(True, True);
End;
Exit;
End;
End;
End Else
Continue;
End;
Wait(1);
End;

{********************************************************************************}
{ Procedure EB_FindPortal; }
{ By: Naum }
{ Date: 30 Dec 2009 }
{ Description: Finds the portal needed to exit }
{********************************************************************************}

Procedure EB_FindPortal;
Var I, X, Y, TX, TY : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
Begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.06, 0.62); //finds all portal like colors
FindColorsTolerance(TPA, 7388602, MSX1, MSY1, MSX2, MSY2, 7)
ATPA := SplitTPA(TPA, 10);

SortTPAFrom(TPA, Point(MSCX - 20, MSCY)); //sorts the tpa's within the ATPA's
SortATPAFromFirstPoint(ATPA, Point(MSCX - 20, MSCY)); //Sorts all the ATPAs from center

For I := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[I], X, Y) Then //another obj loop
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
If FindColorTolerance(TX, TY, 13816324, 7, 7, 160, 50, 24) Then //uptext fix
//If WaitUpText('orta', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True);
WriteLn('Found the Portal'); //clicks on portal if found
FFlag(0);
Wait(1300 + Random(1000));
//Incase of confirmation thingy
If FindColor(TX, TY, 2070783, 234, 46, 254, 56) Then
Mouse(172, 199, 100, 4, True);

Break;
End Else
Continue;
End;
End;

{********************************************************************************}
{ Function SolveEvilBob : Boolean; }
{ By: Naum, info from Markus }
{ Date: 30 Dec 2009 }
{ Description: Solves the EvilBob event }
{********************************************************************************}

Function SolveEvilBob : Boolean;
Var Mark : Integer;
Begin
MarkTime(Mark); //mark time
MakeCompass('N'); //sets optimum object finding.
SetAngle(True);
SetRun(True);

Repeat
EB_MiddleIsland; //walks to the middle of the island

Wait(2000 + Random(1000));
Result := EB_FindServent //finds servent
If Not Result Then
Begin
LogOut;
Exit;
End;

TempInfo := EB_GetStatueInfo; //gets info
Wait(1000 + Random(1000));
ClickContinue(True, True);

Result := EB_PerformTask; //performs the task
If Not Result Then
Begin
LogOut;
Exit;
End;

Wait(1000 + Random(1000));
ClickContinue(True, True);

EB_MiddleIsland; //goes back to middle
Wait(2000 + Random(1000));

Result := EB_UncookFish; //un-cooks fish
If Not Result Then
Begin
LogOut;
Exit;
End;

Result := EB_TalkToBob; //talks again to bob
If Not Result Then
Begin
LogOut;
Exit;
End;
Until(EB_Solved = True) Or (Not (LoggedIn));

If (EB_Solved) Then
Begin
WriteLn('Solved');
Wait(1200 + Random(200)); //yay it's solved
EB_FindPortal;
WriteLn('Solved Evil Bob'#39's Island in '+IntToStr(TimeFromMark(Mark))+' msec');

Wait(10000 + Random(2000));
ClickContinue(True, True); //waits for the duration of the teleport
End Else
Exit;

Wait(1);
End;

{EXACT Density Ranges

North =
Density Range = 0.52 - 0.55

East =
Density Range = 0.43 - 0.46

South =
Density Range = 0.30 - 0.33 //close to west

West =
Density Range = 0.35 - 0.37 //too close to south}

Fixed the object finding. exiting and loads of other stuff. Added commenting to.

Okay, here's another log, ran it today on IceFire's account:

Walked to middle of island
Found servent, Identifying statue...
Statue Density Is = 0.288858530661809
Found Statue in the South direction
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Going to get another fish
Found servent, Identifying statue...
Statue Density Is = 0.524287652645862
Found Statue in the North direction
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Successfully executed //stopped here.

THIS IS THE OLD VERSION, NEW ONE IS IN THE FIRST POST!

Thanks to Markus for moving it.

Gu3st...

2010-01-09 06:19:28

Found servent, Identifying statue...
Statue Density Is = 0,530800542740841
Found Statue in the North direction
Oops Inventory seems to be full.. Dropping 2 items
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Solved Evil Bob's Island in 76066 msec
No flaws :)

Naum

2010-01-09 06:30:46

From: Zyt3x
Found servent, Identifying statue...
Statue Density Is = 0,530800542740841
Found Statue in the North direction
Oops Inventory seems to be full.. Dropping 2 items
Retrieving a fishing net
Retrieved the net!
Fished the fish
Walked to middle of island
Un cooked the retarded fish :)
Solved
Found the Portal
Solved Evil Bob's Island in 76066 msec
No flaws :)


Very nice to hear :)