SRL Archive - SRL Archives

[Ultimate] Fishing Spot Finder


Special Ed

2007-10-04 22:34:26

Well, I've developed a little bit on it since the scripting competition, but I need your help to make it the ultimate Fishing Spot Finder. I've gotten it to be great and now I need your help to make the Ultimate Fishing Spot Finder. From my experience it is 100% accurate and very reliable although not many people other than myself have gotten to test it yet, so you may see some problems that I don't.

If you have any suggestions on how to make it more efficient please tell me! I also need stress and situation testers, I need people who could dedicate a few minutes to run this 100 + times to see how many times it missed and what its average Work Time was. As for the situation testers I need you to try to bring up strange or different situations you'd encounter while running this procedure and see if it can still find the Fishing Spot or what happens to its Work Time in certain situations.

This is one of many progress reports that I've had this thing run.

WorkTime [FindFish]: 0
WorkTime [FindFish]: 16
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 16
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 16
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 16
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 15
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
WorkTime [FindFish]: 0
Average Time: 2

This is an actual progress report that I've gotten multiples of times, this particular report was made standing in the square next to a fishing spot, although I've gotten many progress report standing away from it with people fishing on the spots with an average of 20 - 30ms. If you don't believe it or even if you do give it a try!

program New;
{.include SRL/SRL.scar}
var
FishingArea: TBox;
Fx, Fy, AvgTime, i: Integer;

function FindFish(var Fx, Fy: Integer; Area: Integer; SkipBox: Boolean): Boolean;
var
FPx, FPy, FPCount, FPColor, CCN, WorkTime, Top, Bottom, Right, Left, a: Integer;
i: Byte;
ClosestSpot, NewColor, TempColor: Boolean;
Sear: TBox;
FS: array of TPoint;
FSx, FSy: array of Integer;
label Start;
begin
if(not(LoggedIn))then Exit;
MarkTime(WorkTime);
ColorToleranceSpeed(0);
FPColor:= 14858393;
Start:
for i:= 1 to Area do
begin
Sear.x1:= MSCX - Ceil(i * 51.3);
Sear.y1:= MSCY - Ceil(i * 33.5);
Sear.x2:= MSCX + Ceil(i * 51.3);
Sear.y2:= MSCY + Ceil(i * 33.5);
if(SkipBox)then
TempColor:= FindColorSkipBoxTolerance(FPx, FPy, 14858393, Sear.x1, Sear.y1, Sear.x2, Sear.y2, 33, FishingArea);
if(not(SkipBox))then
TempColor:= FindColorSpiralTolerance(FPx, FPy, 14858393, Sear.x1, Sear.y1, Sear.x2, Sear.y2, 33);
if(TempColor)then
begin
FishingArea.x1:= (FPx - 15);
FishingArea.y1:= (FPy - 15);
FishingArea.x2:= (FPx + 15);
FishingArea.y2:= (FPy + 15);
FindColorsTolerance(FS, FPColor, FishingArea.x1, FishingArea.y1, FishingArea.x2, FishingArea.y2, 33);
FPCount:= GetArrayLength(FS) - 1;
if(FPCount < 2)then
begin
Wait(200 + Random(50));
ClosestSpot:= False;
NewColor:= True;
Break;
end;
if(FPCount > 100)then
begin
if(CCN > 9)then
begin
Result:= False;
Exit;
end;
NewColor:= True;
Wait(200 + Random(50));
CCN:= CCN + 1;
Break;
end;
CCN:= 0;
if((FPCount > 1)and(FPCount < 100))then
begin
ClosestSpot:= True;
NewColor:= False;
Break;
end;
end;
end;
if(ClosestSpot)then
begin
SetArrayLength(FSx, Length(FS));
SetArrayLength(FSy, Length(FS));
for a:= 0 to Length(FS) - 1 do
begin
FSx[a]:= FS[a].x;
FSy[a]:= FS[a].y;
end;
BubbleSort(FSx);
BubbleSort(FSy);
Left:= FSx[0];
Right:= FSx[Length(FS) - 1];
Top:= FSy[0];
Bottom:= FSy[Length(FS) - 1];
Fx:= (Left + Right) div 2;
Fy:= (Top + Bottom) div 2;
FishingArea.x1:= Left - 6;
FishingArea.y1:= Top - 6;
FishingArea.x2:= Right + 6;
FishingArea.y2:= Bottom + 6;
Result:= True;
end else Result:= False;
if(NewColor)then goto Start;
ColorToleranceSpeed(1);
Writeln('WorkTime [FindFish]: ' + inttostr(TimeFromMark(WorkTime)));
AvgTime:= AvgTime + (TimeFromMark(WorkTime));
end;

begin
SetupSRL;
Wait(1000);
repeat
FindFish(Fx, Fy, 10, False);
Wait(500);
Inc(i);
until(i = 100);
Writeln('Average Time: ' + inttostr(AvgTime div 100));
end.

Please! Any ideas or suggestions post them! Anything that could increase performance is worth saying because I want to see if it is even possible to get the WorkTime below what it is even now!

EDIT: For those of you who may be thinking to themselves "This guy must have an amazing computer or something" your not entirely correct although I do take some pride in my computer because I can keep it running as new. Below are my computer statistics…

Manufacturer: MSI [Coincidental?]
Processor: AMD Athlon™ 64 Processor 3700+, MMX, 3DNow, ~2.2GHz
Memory: 1024MB RAM
Hard Drive: 80 GB
Video Card: NVIDIA GeForce 6600
Monitor: Plug and Play Monitor
Sound Card: Realtek AC97 Audio
Speakers/Headphones:
Keyboard: USB Root Hub
Mouse: USB Root Hub
Mouse Surface:
Operating System:
Windows XP Professional (5.1, Build 2600) Service Pack 2 (2600.xpsp_sp2_gdr.050301-1519)

P.S. Honestly I'm not trying to brag but I though it was kinda funny, I just realized I was listening to music "Dragonforce" while this was running, so I'm almost positive we can get the average down to 1ms!

Santa_Clause

2007-10-04 23:35:25

Nice!

begin
SetupSRL;
Wait(1000);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
FindFish(Fx, Fy, 10, False);
Wait(500);
Writeln('Average Time: ' + inttostr(AvgTime div 50));
end.

Is the same as:

begin
SetupSRL;
Wait(1000);
for i := 1 to 50 do
begin
FindFish(Fx, Fy, 10, False);
Wait(500);
end;
end.

pwnaz0r

2007-10-04 23:49:57

Good Job Special. As soon as mining competition finishes up, hopefully we will have on for mining.

EDIT: DragonForce rules :D

Santa_Clause

2007-10-05 00:37:44

From: pwnaz0r
Good Job Special. As soon as mining competition finishes up, hopefully we will have on for fishing.

EDIT: DragonForce rules :D


Haha..I'm really bored :)

danrox2004

2007-10-05 03:02:44

I had a really good way to find the fishing spot that I was going to use for the last competition, if i can find it I will post it here.

EDIT: I think this is it:
function findFish(timeout: integer): tPoint;
var
i, j: integer;
Points: tPointArray;
x, y: integer;
time: integer;
begin
markTime(Time);
for i := 0 to 40 do
begin
wait(10);
if((i mod 5) = 0) then
findNormalRandoms;
findColorsSpiralTolerance(MSCX, MSCY, Points, 15052923, MSX1, MSY1, MSX2, MSY2, i);
removePointsByDistance(Points, 10);
wait(10);
for j := 0 to getArrayLength(Points) - 1 do
begin
if(TimeFromMark(Time) > TimeOut) then
begin
Exit;
end;
if(not (findColoredAreaTolerance(x, y, 15052923, Points[j].x - 5, Points[j].y - 5, Points[j].x + 5, Points[j].y + 5, 5, 20))) then
begin
MMouse(Points[j].x, Points[j].y, 0, 0);
Wait(100 + random(100));
if(isUpText('et')) then
begin
Result := Points[j];
fx := result.x;
fy := result.y;
Exit;
end;
end;
end;
end;
end;

Special Ed

2007-10-05 16:06:27

Ok thanks, and if anyone can test and post results that would be a big help as well.

EDIT: Oh, ok I see what you did, but that is a lot of looping. Also it seems like a good method I may try to figure out something with this. Thanks :D Also, what is "RemovePointsByDistance" I've got nothing on it and I can't seem to find it in SRL. If you developed it could you please post it for me?

EDIT2: If anyone can help me develop or if they have something that can get the coordinates of the center of the square on which your character stands that would be phenomenal because I believe it changes sometimes, and recently I've noticed when there are two fishing spot near each other and your standing next to the bottom one, it sometimes gets the top one.

Version 2 [?]

function Equalize(var Top, Bottom, Left, Right: Integer): Boolean;
var
EqMod, W, H: Byte;
begin
W:= Right - Left;
H:= Bottom - Top;
if(H <> W)then
begin
if((W < 10)or(H < 10)or(W > 38)or(H > 32))then Result:= False;
if(W < H)then
begin
EqMod:= (H - W) div 2;
if(EqMod > 9)then Result:= False;
Left:= Left - EqMod;
Right:= Right + EqMod;
Result:= True;
end else
begin
EqMod:= (W - H) div 2;
if(EqMod > 9)then Result:= False;
Top:= Top - EqMod;
Bottom:= Bottom + EqMod;
Result:= True;
end;
end else Result:= True;
end;

function FindFish(var Fx, Fy: Integer; Area: Integer; SkipBox: Boolean): Boolean;
var
FPx, FPy, WorkTime, Top, Bottom, Right, Left: Integer;
i, a, CCN, FPCount: Byte;
ClosestSpot, NewColor: Boolean;
Sear, FishingArea: TBox;
FS: array of TPoint;
FSx, FSy: array of Integer;
label Start;
begin
if(not(LoggedIn))then Exit;
MarkTime(WorkTime);
ColorToleranceSpeed(0);
Start:
for i:= 1 to Area do
begin
Sear.x1:= MSCX - Ceil(i * 51.3);
Sear.y1:= MSCY - Ceil(i * 33.5);
Sear.x2:= MSCX + Ceil(i * 51.3);
Sear.y2:= MSCY + Ceil(i * 33.5);
if(FindColorSpiralTolerance(FPx, FPy, 14858393, Sear.x1, Sear.y1, Sear.x2, Sear.y2, 33))then
begin
FishingArea.x1:= (FPx - 12);
FishingArea.y1:= (FPy - 12);
FishingArea.x2:= (FPx + 12);
FishingArea.y2:= (FPy + 12);
FindColorsTolerance(FS, 14858393, FishingArea.x1, FishingArea.y1, FishingArea.x2, FishingArea.y2, 33);
FPCount:= GetArrayLength(FS) - 1;
if(FPCount < 2)then
begin
Wait(200 + Random(50));
ClosestSpot:= False;
NewColor:= True;
Break;
end;
if(FPCount > 69)then
begin
if(CCN > 9)then
begin
Result:= False;
Exit;
end;
NewColor:= True;
Wait(200 + Random(50));
Inc(CCN);
Break;
end;
CCN:= 0;
if((FPCount > 1)and(FPCount < 70))then
begin
ClosestSpot:= True;
NewColor:= False;
Break;
end;
end;
end;
if(ClosestSpot)then
begin
SetArrayLength(FSx, Length(FS));
SetArrayLength(FSy, Length(FS));
for a:= 0 to Length(FS) - 1 do
begin
FSx[a]:= FS[a].x;
FSy[a]:= FS[a].y;
end;
BubbleSort(FSx);
BubbleSort(FSy);
Left:= FSx[0];
Right:= FSx[Length(FS) - 1];
Top:= FSy[0];
Bottom:= FSy[Length(FS) - 1];
if(not(Equalize(Top, Bottom, Left, Right)))then goto Start;
Fx:= (Left + Right) div 2;
Fy:= (Top + Bottom) div 2;
Result:= True;
end else Result:= False;
if(NewColor)then goto Start;
ColorToleranceSpeed(1);
Writeln('[FindFish] WorkTime: ' + inttostr(TimeFromMark(WorkTime)));
end;

This is better at finding the middle of the FishingSpot although I did a change of colors I'm testing at the moment. You don't need to use "Equalize" although it will the the "Center" of the fishing spot rather than just the fishing spot, only slows it down by 4 - 12ms though.