SRL Archive - SRL Suggestions

EvilBob Solver (Fix);


NCDS

2010-08-03 20:35:00

I noticed the current solver has failed quite a few times while running my Yew Cutter, so I went through and updated some thing's.
    THING'S I CHANGED:
  • Procedure EB_FindPortal; used WaitUpTextMulti(); which in my opinion is better to use in general so I made all the functions use WaitUpTextMulti(); as opposed to WaitUpText();
  • Updated UnCooked/Cooked Fish .bmp's
  • It looks like the Cooked and UnCooked Fish might be able to be found by the same DDTM. I can test and find out if anyone else is interested.
  • Updated Fish Spot Color/Hue/Sat/Tol's.
  • Updated Cooking Pot Color/Hue/Sat/Tol's.

Current SRL version:

{********************************************************************************}
{ 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, 5, 5);
if (Length(ATPA) >= 4)and (Length(ATPA) < 12)then //There are 7 dots on the island
Result := IsChatBoxTextAnyLine('ScapeRune', clMessage) or (FindTextTpa(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'ask to come here', NPCChars, Nothing));
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 : Boolean; }
{ 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 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;
Exit;
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 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,NetBMP2 : 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, 6, 'beNpjYHI2VWNgYLI1UAaSQKSnLAEkT' +
'TRkNOTFIj1MFSSFNRXERQV5gYLe1tr2hipA5GGp5WSiJiMmaKEjD9' +
'HlYKxqpacIYajKiEIEgQqApKqsKMRMK10FXRVpoKyIAI+suKCxhgw' +
'DAGuqDWk=');
NetBMP2 := 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
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
Begin
GameTab(tab_inv);
If InvCount >= 27 Then //if the inventory is full
Begin
WriteLn('Oops Inventory seems to be full.. Dropping items');

For I := 0 To 27 Do //make room
Begin
If DropItem(InvCount - 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
{$ifdef Simba}
FilterPointsDist(TPA,13.20,75.00,MMCX,MMCY);
{$else}
FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
{$endif}
SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items

Mouse(TPA[0].X - 3, TPA[0].Y + 3, 3,3, True); //walks to it
Wait(4321 + random(500));
While IsMoving Do //while wallking, some mouse movement
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));
Wait(2345 + random(500));
If Not IsMoving Then
Begin
ColorToleranceSpeed(2); //finds the fishing net
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 14); //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);
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))
else
Wait(400 + random(800));
Inc(I);
End;
FFlag(0);
Wait(800 + Random(100));

If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) or
FindBitmapToleranceIn(NetBmp2, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Retrieved the net!'); //if found the net in inventory
FreeBitmap(NetBmp);
FreeBitmap(NetBmp2);
End Else
Begin
WriteLn('Could Not Retrieve Net');
FreeBitmap(NetBmp); //if not found net
FreeBitmap(NetBmp2);
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
FFlag(0);
Wait(500+Random(500));
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 WaitUpText('ook', srl_MaxWaitTime) Then
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 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 WaitUpTextMulti(['orta','Ente','nter','tal'],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));

while (ClickContinue(True, True)) do
Wait(500 + Random(500)); //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}


With my updates:

{********************************************************************************}
{ 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, 5, 5);
if (Length(ATPA) >= 4)and (Length(ATPA) < 12)then //There are 7 dots on the island
Result := IsChatBoxTextAnyLine('ScapeRune', clMessage) or (FindTextTpa(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'ask to come here', NPCChars, Nothing));
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 : Boolean; }
{ 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 WaitUpTextMulti(['erva', 'ant'], 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;
Exit;
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.38, 0.44); //11380643
FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //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 WaitUpTextMulti(['ishi', 'ing s', 'hing'], 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,NetBMP2 : 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, 6, 'beNpjYHI2VWNgYLI1UAaSQKSnLAEkT' +
'TRkNOTFIj1MFSSFNRXERQV5gYLe1tr2hipA5GGp5WSiJiMmaKEjD9' +
'HlYKxqpacIYajKiEIEgQqApKqsKMRMK10FXRVpoKyIAI+suKCxhgw' +
'DAGuqDWk=');
NetBMP2 := BitmapFromString(7, 8, 'beNo9jdsKwjAMhsvuxEPtbGZms9KD6' +
'5gdE8YuBC8UH8D3fxwjEyF8fPz5SUQhRBGNNrBn4Zk6Yj6n9ja4zm' +
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
'tWipyZSWVhn45gEAl/kKXg==');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
Begin
GameTab(tab_inv);
If InvCount >= 27 Then //if the inventory is full
Begin
WriteLn('Oops Inventory seems to be full.. Dropping items');

For I := 0 To 27 Do //make room
Begin
If DropItem(InvCount - 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
{$ifdef Simba}
FilterPointsDist(TPA,13.20,75.00,MMCX,MMCY);
{$else}
FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
{$endif}
SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items

Mouse(TPA[0].X - 3, TPA[0].Y + 3, 3,3, True); //walks to it
Wait(4321 + random(500));
While IsMoving Do //while wallking, some mouse movement
If Random(2) = 1 Then
SleepAndMoveMouse(400 + Random(800));
Wait(2345 + random(500));
If Not IsMoving Then
Begin
ColorToleranceSpeed(2); //finds the fishing net
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 14); //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);
If WaitUpTextMulti(['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))
else
Wait(400 + random(800));
Inc(I);
End;
FFlag(0);
Wait(800 + Random(100));

If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) or
FindBitmapToleranceIn(NetBmp2, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Begin
WriteLn('Retrieved the net!'); //if found the net in inventory
FreeBitmap(NetBmp);
FreeBitmap(NetBmp2);
End Else
Begin
WriteLn('Could Not Retrieve Net');
FreeBitmap(NetBmp); //if not found net
FreeBitmap(NetBmp2);
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
FFlag(0);
Wait(500+Random(500));
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(16.67, 1.62); //correct mods

RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
'tWipyZSWVhn45gEAl/kKXg==');

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, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //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 WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
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(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
'q6tr0VKTKS2tuloqBwDT4g0w');
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 WaitUpTextMulti(['vil', 'ob'], 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 WaitUpTextMulti(['orta','Ente','nter','tal'],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));

while (ClickContinue(True, True)) do
Wait(500 + Random(500)); //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}

Results with current SRL version:

***** STR: FOUND RANDOM: 'Evil Bob's Island' *****
Screenshot of: Found Evil Bob's Island random 38 Minutes and 7 Seconds
Found servent, Identifying statue...
Statue Density Is = 0.346914623837701
Found Statue in the West direction
Retrieving a fishing net
Retrieved the net!
***** STR: 'Evil Bob's Island' RANDOM SOLVING FAILED! *****

Code I tested my version with:

program New;
{.include SRL/SRL.scar}

begin
SetupSRL;
ActivateClient;
if SolveEvilBob then
Writeln('you fixed it!@');
end.

Output:

Succesfully saved: C:\Simba\Includes\SRL\SRL\core\AntiRandoms\EvilBob.scar
New window: 6424702
New window: 6424702
Compiled succesfully in 562 ms.
SRL Compiled in 15 msec
Found servent, Identifying statue...
Statue Density Is = 0.34879032258064
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 74569 msec
you fixed it!@
Successfully executed.


Diff:

Index: EvilBob.scar
===================================================================
--- EvilBob.scar (revision 579)
+++ EvilBob.scar (working copy)
@@ -116,7 +116,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('erva', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['erva', 'ant'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
@@ -221,8 +221,8 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.13, 0.19);
- FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
+ SetColorSpeed2Modifiers(0.38, 0.44); //11380643
+ FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //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'

@@ -231,7 +231,7 @@
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ishi', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['ishi', 'ing s', 'hing'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
@@ -272,9 +272,8 @@
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
@@ -327,7 +326,7 @@
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1);
- If WaitUpText('mall', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['mall'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
@@ -416,11 +415,10 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(1.59, 0.14); //correct mods
+ SetColorSpeed2Modifiers(16.67, 1.62); //correct mods

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
@@ -431,7 +429,7 @@
Exit;
End;

- FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
+ FindColorsTolerance(TPA, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //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

@@ -440,7 +438,7 @@
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ook', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Result := True;
@@ -452,9 +450,8 @@
FreeBitmap(RetardedFish);

Wait(6000 + Random(1200)); //wait while the player cooks it
- CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
- 'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
- 'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
+ CookedRetardedFish := BitmapFromString(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
+ 'q6tr0VKTKS2tuloqBwDT4g0w');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
@@ -488,7 +485,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('vil', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['vil', 'ob'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Index: EvilBobold.scar
===================================================================
--- EvilBobold.scar (revision 0)
+++ EvilBobold.scar (revision 0)
@@ -0,0 +1,668 @@
+//-----------------------------------------------------------------//
+//-- 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, 5, 5);
+ if (Length(ATPA) >= 4)and (Length(ATPA) < 12)then //There are 7 dots on the island
+ Result := IsChatBoxTextAnyLine('ScapeRune', clMessage) or (FindTextTpa(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'ask to come here', NPCChars, Nothing));
+ 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 : Boolean; }
+{ 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 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;
+ Exit;
+ 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 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,NetBMP2 : 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, 6, 'beNpjYHI2VWNgYLI1UAaSQKSnLAEkT' +
+ 'TRkNOTFIj1MFSSFNRXERQV5gYLe1tr2hipA5GGp5WSiJiMmaKEjD9' +
+ 'HlYKxqpacIYajKiEIEgQqApKqsKMRMK10FXRVpoKyIAI+suKCxhgw' +
+ 'DAGuqDWk=');
+ NetBMP2 := 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
+ GameTab(tab_inv);
+ If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
+ Begin
+ GameTab(tab_inv);
+ If InvCount >= 27 Then //if the inventory is full
+ Begin
+ WriteLn('Oops Inventory seems to be full.. Dropping items');
+
+ For I := 0 To 27 Do //make room
+ Begin
+ If DropItem(InvCount - 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
+ {$ifdef Simba}
+ FilterPointsDist(TPA,13.20,75.00,MMCX,MMCY);
+ {$else}
+ FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
+ {$endif}
+ SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items
+
+ Mouse(TPA[0].X - 3, TPA[0].Y + 3, 3,3, True); //walks to it
+ Wait(4321 + random(500));
+ While IsMoving Do //while wallking, some mouse movement
+ If Random(2) = 1 Then
+ SleepAndMoveMouse(400 + Random(800));
+ Wait(2345 + random(500));
+ If Not IsMoving Then
+ Begin
+ ColorToleranceSpeed(2); //finds the fishing net
+ SetColorSpeed2Modifiers(0.07, 0.19);
+ FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 14); //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);
+ 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))
+ else
+ Wait(400 + random(800));
+ Inc(I);
+ End;
+ FFlag(0);
+ Wait(800 + Random(100));
+
+ If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) or
+ FindBitmapToleranceIn(NetBmp2, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
+ Begin
+ WriteLn('Retrieved the net!'); //if found the net in inventory
+ FreeBitmap(NetBmp);
+ FreeBitmap(NetBmp2);
+ End Else
+ Begin
+ WriteLn('Could Not Retrieve Net');
+ FreeBitmap(NetBmp); //if not found net
+ FreeBitmap(NetBmp2);
+ 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
+ FFlag(0);
+ Wait(500+Random(500));
+ 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 WaitUpText('ook', srl_MaxWaitTime) Then
+ 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 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 WaitUpTextMulti(['orta','Ente','nter','tal'],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));
+
+ while (ClickContinue(True, True)) do
+ Wait(500 + Random(500)); //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}
I was only able to test it once as I only had one account in it, but feel free to test and post results please :)

Nava2

2010-08-03 20:51:04

Could you just post a diff? I'll apply it then. :)

After a few more tests of course.

EvilChicken!

2010-08-03 20:52:13

.. I'm starting to like you more and more.
This is pretty neat, I'd love to commit it once it gets more replies and actually gets tested. For instance, I'd love to test if someone provided me with an account in Evil Bob. :)

I skimmed through the code; only thing I could come to think of, was adding more debug options and marking all the WriteLns with WriteLn('EvilBob: ' + ActualDebugStr); just to remove any possibilities of confusing the debug info for the random, with any other debug info.


E: Where'd you come from, Nava? D:
Although it's a good point; a diff would be nice. I was thinking about it, but actually forgot it.
Nevertheless, a diff version with any comments you've added, removed. :)

NCDS

2010-08-03 21:20:04

This is what WinMerge gives me? Sorry never worked with Diff's before(I can read them though :p ). Please no windows/ "Diff noob" jokes :redface:


90c90
< If WaitUpText('erva', srl_MaxWaitTime) Then
---
> If WaitUpTextMulti(['erva', 'ant'], srl_MaxWaitTime) Then
195,196c195,196
< SetColorSpeed2Modifiers(0.13, 0.19);
< FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
---
> SetColorSpeed2Modifiers(0.38, 0.44); //11380643
> FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //gets fishspot-like colors
205c205
< If WaitUpText('ishi', srl_MaxWaitTime) Then
---
> If WaitUpTextMulti(['ishi', 'ing s', 'hing'], srl_MaxWaitTime) Then
246,248c246,247
< RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
< 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
< 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
---
> RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
> 'tWipyZSWVhn45gEAl/kKXg==');
301c300
< If WaitUpText('mall', srl_MaxWaitTime) Then
---
> If WaitUpTextMulti(['mall'], srl_MaxWaitTime) Then
390c389
< SetColorSpeed2Modifiers(1.59, 0.14); //correct mods
---
> SetColorSpeed2Modifiers(16.67, 1.62); //correct mods
392,394c391,392
< RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
< 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
< 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
---
> RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
> 'tWipyZSWVhn45gEAl/kKXg==');
405c403
< FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
---
> FindColorsTolerance(TPA, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //finds all cooking pot like colors
414c412
< If WaitUpText('ook', srl_MaxWaitTime) Then
---
> If WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
426,428c424,425
< CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
< 'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
< 'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
---
> CookedRetardedFish := BitmapFromString(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
> 'q6tr0VKTKS2tuloqBwDT4g0w');
462c459
< If WaitUpText('vil', srl_MaxWaitTime) Then
---
> If WaitUpTextMulti(['vil', 'ob'], srl_MaxWaitTime) Then
639c636
< Density Range = 0.35 - 0.37 //too close to south}
\ No newline at end of file
---
> Density Range = 0.35 - 0.37 //too close to south}
\ No newline at end of file

Maybe this one is easier to read?

*** C:/Program Files/WinMerge/old Tue Aug 03 09:16:03 2010
--- C:/Program Files/WinMerge/new Tue Aug 03 09:16:18 2010
***************
*** 87,93 ****
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpText('erva', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
--- 87,93 ----
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpTextMulti(['erva', 'ant'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
***************
*** 192,199 ****
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'

--- 192,199 ----
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
! SetColorSpeed2Modifiers(0.38, 0.44); //11380643
! FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //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'

***************
*** 202,208 ****
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpText('ishi', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
--- 202,208 ----
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpTextMulti(['ishi', 'ing s', 'hing'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
***************
*** 243,251 ****
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

! RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
! 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
! 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
--- 243,250 ----
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

! RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
! 'tWipyZSWVhn45gEAl/kKXg==');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
***************
*** 298,304 ****
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1);
! If WaitUpText('mall', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
--- 297,303 ----
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1);
! If WaitUpTextMulti(['mall'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
***************
*** 387,397 ****
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
--- 386,395 ----
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
! SetColorSpeed2Modifiers(16.67, 1.62); //correct mods

! RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
! 'tWipyZSWVhn45gEAl/kKXg==');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
***************
*** 402,408 ****
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

--- 400,406 ----
Exit;
End;

! FindColorsTolerance(TPA, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //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

***************
*** 411,417 ****
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpText('ook', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Result := True;
--- 409,415 ----
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Result := True;
***************
*** 423,431 ****
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..
--- 421,428 ----
FreeBitmap(RetardedFish);

Wait(6000 + Random(1200)); //wait while the player cooks it
! CookedRetardedFish := BitmapFromString(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
! 'q6tr0VKTKS2tuloqBwDT4g0w');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
***************
*** 459,465 ****
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpText('vil', srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
--- 456,462 ----
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
! If WaitUpTextMulti(['vil', 'ob'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
***************
*** 636,639 ****
Density Range = 0.30 - 0.33 //close to west

West =
! Density Range = 0.35 - 0.37 //too close to south}
\ No newline at end of file
--- 633,636 ----
Density Range = 0.30 - 0.33 //close to west

West =
! Density Range = 0.35 - 0.37 //too close to south}
\ No newline at end of file

@EC: I've always liked you! and I hope the feeling has been mutual!;)

tarajunky

2010-08-03 22:19:49

FYI, 9 times out of 10 this solver fails AFTER catching the cooked fish, and leaves your player standing with the caught fish next to the fishing spot.

NCDS

2010-08-03 22:21:10

From: tarajunky
FYI, 9 times out of 10 this solver fails AFTER catching the cooked fish, and leaves your player standing with the caught fish next to the fishing spot.


That was because the Cooked Fish .bmp was outdated. I updated it though and it works great. I tested that part probably 4 or 5 times.

FYI, I wouldn't post something unless it was worth while ;)

mormonman

2010-08-03 22:21:12

Doesn't tortoisesvn have a diff tool?

Nava2

2010-08-04 02:49:52

svn diff ./X > ./my.diff

:) then we can just apply it as a patch!

Naum

2010-08-04 14:52:34

I thank you, personally, for this.

Coh3n

2010-08-04 15:46:45

From: mormonman
Doesn't tortoisesvn have a diff tool?

Yeah, you can right click on the file you've modified and go to TortoiseSVN > Diff
or you can do the same and create a patch, which can then be applied by anyone (I think).

PS good job NCDS. :)

NCDS

2010-08-04 16:41:02

Here's the .Diff finally :)


Index: EvilBob.scar
===================================================================
--- EvilBob.scar (revision 579)
+++ EvilBob.scar (working copy)
@@ -116,7 +116,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('erva', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['erva', 'ant'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
@@ -221,8 +221,8 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.13, 0.19);
- FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
+ SetColorSpeed2Modifiers(0.38, 0.44); //11380643
+ FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //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'

@@ -231,7 +231,7 @@
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ishi', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['ishi', 'ing s', 'hing'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
@@ -272,9 +272,8 @@
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
@@ -327,7 +326,7 @@
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1);
- If WaitUpText('mall', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['mall'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
@@ -416,11 +415,10 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(1.59, 0.14); //correct mods
+ SetColorSpeed2Modifiers(16.67, 1.62); //correct mods

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
@@ -431,7 +429,7 @@
Exit;
End;

- FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
+ FindColorsTolerance(TPA, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //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

@@ -440,7 +438,7 @@
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ook', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Result := True;
@@ -452,9 +450,8 @@
FreeBitmap(RetardedFish);

Wait(6000 + Random(1200)); //wait while the player cooks it
- CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
- 'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
- 'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
+ CookedRetardedFish := BitmapFromString(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
+ 'q6tr0VKTKS2tuloqBwDT4g0w');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
@@ -488,7 +485,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('vil', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['vil', 'ob'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Index: EvilBobold.scar
===================================================================
--- EvilBobold.scar (revision 0)
+++ EvilBobold.scar (revision 0)
@@ -0,0 +1,668 @@
+//-----------------------------------------------------------------//
+//-- 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, 5, 5);
+ if (Length(ATPA) >= 4)and (Length(ATPA) < 12)then //There are 7 dots on the island
+ Result := IsChatBoxTextAnyLine('ScapeRune', clMessage) or (FindTextTpa(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'ask to come here', NPCChars, Nothing));
+ 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 : Boolean; }
+{ 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 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;
+ Exit;
+ 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 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,NetBMP2 : 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, 6, 'beNpjYHI2VWNgYLI1UAaSQKSnLAEkT' +
+ 'TRkNOTFIj1MFSSFNRXERQV5gYLe1tr2hipA5GGp5WSiJiMmaKEjD9' +
+ 'HlYKxqpacIYajKiEIEgQqApKqsKMRMK10FXRVpoKyIAI+suKCxhgw' +
+ 'DAGuqDWk=');
+ NetBMP2 := 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
+ GameTab(tab_inv);
+ If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
+ Begin
+ GameTab(tab_inv);
+ If InvCount >= 27 Then //if the inventory is full
+ Begin
+ WriteLn('Oops Inventory seems to be full.. Dropping items');
+
+ For I := 0 To 27 Do //make room
+ Begin
+ If DropItem(InvCount - 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
+ {$ifdef Simba}
+ FilterPointsDist(TPA,13.20,75.00,MMCX,MMCY);
+ {$else}
+ FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
+ {$endif}
+ SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items
+
+ Mouse(TPA[0].X - 3, TPA[0].Y + 3, 3,3, True); //walks to it
+ Wait(4321 + random(500));
+ While IsMoving Do //while wallking, some mouse movement
+ If Random(2) = 1 Then
+ SleepAndMoveMouse(400 + Random(800));
+ Wait(2345 + random(500));
+ If Not IsMoving Then
+ Begin
+ ColorToleranceSpeed(2); //finds the fishing net
+ SetColorSpeed2Modifiers(0.07, 0.19);
+ FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 14); //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);
+ 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))
+ else
+ Wait(400 + random(800));
+ Inc(I);
+ End;
+ FFlag(0);
+ Wait(800 + Random(100));
+
+ If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) or
+ FindBitmapToleranceIn(NetBmp2, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
+ Begin
+ WriteLn('Retrieved the net!'); //if found the net in inventory
+ FreeBitmap(NetBmp);
+ FreeBitmap(NetBmp2);
+ End Else
+ Begin
+ WriteLn('Could Not Retrieve Net');
+ FreeBitmap(NetBmp); //if not found net
+ FreeBitmap(NetBmp2);
+ 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
+ FFlag(0);
+ Wait(500+Random(500));
+ 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 WaitUpText('ook', srl_MaxWaitTime) Then
+ 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 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 WaitUpTextMulti(['orta','Ente','nter','tal'],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));
+
+ while (ClickContinue(True, True)) do
+ Wait(500 + Random(500)); //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}


If you need the actual .Patch file let me know. It's too big to add as an attachment.

Coh3n

2010-08-04 16:46:01

From: NCDS

If you need the actual .Patch file let me know. It's too big to add as an attachment.

You can upload it as a .zip and it should work.

There's also diff highlight tabs I think.


Index: EvilBob.scar
===================================================================
--- EvilBob.scar (revision 579)
+++ EvilBob.scar (working copy)
@@ -116,7 +116,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('erva', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['erva', 'ant'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks the servent
@@ -221,8 +221,8 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.13, 0.19);
- FindColorsTolerance(TPA, 11380643, MSX1, MSY1, MSX2, MSY2, 5); //gets fishspot-like colors
+ SetColorSpeed2Modifiers(0.38, 0.44); //11380643
+ FindColorsTolerance(TPA, 11841195, MSX1, MSY1, MSX2, MSY2, 4); //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'

@@ -231,7 +231,7 @@
Begin
MMouse(X, Y, 6, 6); //moves the mouse over it
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ishi', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['ishi', 'ing s', 'hing'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y); //stores the lcoation
Result := Point(X, Y);
@@ -272,9 +272,8 @@
'E0B6p+q5aAKnW/evYhIKgty/sxMgnkGDH7I6hNDvXSf82JeSadLLi' +
'6tFimBvgIh7v1au7tUuObBmQOyPw/Ym8bOGl58fgNP21YDTA=');

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');
// if we dont have a bitmap in the inventory
GameTab(tab_inv);
If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
@@ -327,7 +326,7 @@
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
ColorToleranceSpeed(1);
- If WaitUpText('mall', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['mall'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); //if success
@@ -416,11 +415,10 @@
If Not LoggedIn Then Exit;

ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(1.59, 0.14); //correct mods
+ SetColorSpeed2Modifiers(16.67, 1.62); //correct mods

- RetardedFish := BitmapFromString(8, 4, 'beNrzNYx11Ix20Ej20k/2MkjzMQSyw' +
- 'VyDRBdtIMrwNcz0M5KzvgBEQG62v0mGp56c9TkgsvVc4uC1VNbqbK' +
- 'q7bmGwWY6PARBleekXh1qUhlkCGUBuHgBzXB30');
+ RetardedFish := BitmapFromString(5, 2, 'meJzTdU/TdU/T88wAIn2vrOkz5tXV' +
+ 'tWipyZSWVhn45gEAl/kKXg==');

If FindBitmapToleranceIn(RetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
Mouse(X, Y, 2, 2, True) //clicks the fish so we can cook
@@ -431,7 +429,7 @@
Exit;
End;

- FindColorsTolerance(TPA, 4870474, MSX1, MSY1, MSX2, MSY2, 17); //finds all cooking pot like colors
+ FindColorsTolerance(TPA, 1710617, MSX1, MSY1, MSX2, MSY2, 2); //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

@@ -440,7 +438,7 @@
Begin //loops through and finds it
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('ook', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['hing', 'ook'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Result := True;
@@ -452,9 +450,8 @@
FreeBitmap(RetardedFish);

Wait(6000 + Random(1200)); //wait while the player cooks it
- CookedRetardedFish := BitmapFromString(6, 5, 'beNoruSgRt8ooaYZx8kzjlFkSMcuAS' +
- 'DJpg0nGAtPMhebZi4FsIJJO32Wet8o8f5Wc9QUgAnLlrM8BkXXQbt' +
- 'uQvbJWZ2Vyj8oVnQMim8rddtV7QWwAf1wlRA==');
+ CookedRetardedFish := BitmapFromString(5, 2, 'meJw7litzPE/mZJ7MmQLZ80Wy02fM' +
+ 'q6tr0VKTKS2tuloqBwDT4g0w');
Result := FindBitmapToleranceIn(CookedRetardedFish, X, Y, MIX1, MIY1, MIX2, MIY2, 30);
FreeBitmap(CookedRetardedFish);
If Result Then //when its cooked..
@@ -488,7 +485,7 @@
Begin
MMouse(X, Y, 2, 2);
Wait(SRL_MaxWaitTime + Random(100));
- If WaitUpText('vil', srl_MaxWaitTime) Then
+ If WaitUpTextMulti(['vil', 'ob'], srl_MaxWaitTime) Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 2, 2, True); //clicks on bob
Index: EvilBobold.scar
===================================================================
--- EvilBobold.scar (revision 0)
+++ EvilBobold.scar (revision 0)
@@ -0,0 +1,668 @@
+//-----------------------------------------------------------------//
+//-- 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, 5, 5);
+ if (Length(ATPA) >= 4)and (Length(ATPA) < 12)then //There are 7 dots on the island
+ Result := IsChatBoxTextAnyLine('ScapeRune', clMessage) or (FindTextTpa(clBlack, 0, MCX1, MCY1, MCX2, MCY2, 'ask to come here', NPCChars, Nothing));
+ 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 : Boolean; }
+{ 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 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;
+ Exit;
+ 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 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,NetBMP2 : 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, 6, 'beNpjYHI2VWNgYLI1UAaSQKSnLAEkT' +
+ 'TRkNOTFIj1MFSSFNRXERQV5gYLe1tr2hipA5GGp5WSiJiMmaKEjD9' +
+ 'HlYKxqpacIYajKiEIEgQqApKqsKMRMK10FXRVpoKyIAI+suKCxhgw' +
+ 'DAGuqDWk=');
+ NetBMP2 := 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
+ GameTab(tab_inv);
+ If Not FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Or (InvFull) Then
+ Begin
+ GameTab(tab_inv);
+ If InvCount >= 27 Then //if the inventory is full
+ Begin
+ WriteLn('Oops Inventory seems to be full.. Dropping items');
+
+ For I := 0 To 27 Do //make room
+ Begin
+ If DropItem(InvCount - 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
+ {$ifdef Simba}
+ FilterPointsDist(TPA,13.20,75.00,MMCX,MMCY);
+ {$else}
+ FilterPointsPie(TPA, 0.0, 359.9, 13.20, 75.00, MMCX, MMCY); //filters them so they're in a cirlce
+ {$endif}
+ SortTPAFrom(TPA, TP); //and so it does not pick up just dropped items
+
+ Mouse(TPA[0].X - 3, TPA[0].Y + 3, 3,3, True); //walks to it
+ Wait(4321 + random(500));
+ While IsMoving Do //while wallking, some mouse movement
+ If Random(2) = 1 Then
+ SleepAndMoveMouse(400 + Random(800));
+ Wait(2345 + random(500));
+ If Not IsMoving Then
+ Begin
+ ColorToleranceSpeed(2); //finds the fishing net
+ SetColorSpeed2Modifiers(0.07, 0.19);
+ FindColorsTolerance(TPA, 2899019, MSX1, MSY1, MSX2, MSY2, 14); //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);
+ 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))
+ else
+ Wait(400 + random(800));
+ Inc(I);
+ End;
+ FFlag(0);
+ Wait(800 + Random(100));
+
+ If FindBitmapToleranceIn(NetBmp, X, Y, MIX1, MIY1, MIX2, MIY2, 30) or
+ FindBitmapToleranceIn(NetBmp2, X, Y, MIX1, MIY1, MIX2, MIY2, 30) Then
+ Begin
+ WriteLn('Retrieved the net!'); //if found the net in inventory
+ FreeBitmap(NetBmp);
+ FreeBitmap(NetBmp2);
+ End Else
+ Begin
+ WriteLn('Could Not Retrieve Net');
+ FreeBitmap(NetBmp); //if not found net
+ FreeBitmap(NetBmp2);
+ 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
+ FFlag(0);
+ Wait(500+Random(500));
+ 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 WaitUpText('ook', srl_MaxWaitTime) Then
+ 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 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 WaitUpTextMulti(['orta','Ente','nter','tal'],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));
+
+ while (ClickContinue(True, True)) do
+ Wait(500 + Random(500)); //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}

NCDS

2010-08-04 16:51:47

Updated first post.

Thanks :)

Nava2

2010-08-04 16:55:53

:p EvilBobOld isn't really necessary in the patch :p

Any who, still need a bit more proof.

NCDS

2010-08-04 16:59:26

From: Nava2
:p EvilBobOld isn't really necessary in the patch :p

Any who, still need a bit more proof.


That's just what I renamed the other file :p

I'm looking for accounts to test with as we speak.

Emaziz

2010-08-06 09:26:09

Glad this is being fixed, I somehow always get stuck in there. Will lend you account whenever I get stuck again :)

NCDS

2010-08-06 12:13:22

From: Emaziz
Glad this is being fixed, I somehow always get stuck in there. Will lend you account whenever I get stuck again :)


That would be very greatly appreciated :)

Heavenguard

2010-08-07 00:12:05

Great job NCDS. Much Appreciated ^^.

NCDS

2010-08-07 16:04:11

From: Heavenguard
Great job NCDS. Much Appreciated ^^.


Thank you :)

But, unfortunately i twon't be committed until I can find more "proof" that it work's, which would require me to have account's in the random, that I don't have.

So, please PM me if you have one :)

Heavenguard

2010-08-07 21:29:55

From: NCDS
Thank you :)

But, unfortunately i twon't be committed until I can find more "proof" that it work's, which would require me to have account's in the random, that I don't have.

So, please PM me if you have one :)


Im sure whoever gets one will surely be of use to you =]

NCDS

2010-08-12 19:45:19

/me bump's in hope of finding an account.

Blumblebee

2010-08-13 02:19:00

if the original version is already broken whats the harm with committing a version which, at the worst, is still broken?

Nava2

2010-08-13 09:15:58

Thats what I was thinking..

EvilChicken!

2010-08-13 10:46:23

From: Blumblebee
if the original version is already broken whats the harm with committing a version which, at the worst, is still broken?


You know, I was just thinking the exact same thing when I saw this thread again.
Good thing you bumped it, NCDS.

I'm all for applying/committing this, others seem to think the same.
Nava, you can have the honour of doing it; I'm at my gf's place right now.

Nava2

2010-08-13 12:41:15

Applied and committed.

NCDS

2010-08-13 13:15:13

Thanks guys :)

Looks like the sandwhich lady could be next.

"May not compile, applied NCDS patch." lol thanks for the confidence Nava