SRL Archive - OSR Help

Skipping a box


Troll

2011-01-09 13:53:59

Ok so im trying to skip a box when fishing as i want cage fishing and not net fishing. Ive have tryed to make a box and skip it, but it does not work :(

Function FindFishingSpotTPA:Boolean;
Var
MyTPA : TPointArray;
PointT : TPoint;
x,y,i,trys : Integer;
NotBox : TBox;

Begin
If Not LoggedIn Then Exit;
NotBox := IntToBox(0,0,0,0) //Just to reset it
Repeat
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.34,1.18);
FindColorsSpiralTolerance(x,y,MyTPA,11576479, MSx1, MSy1, MSx2, MSy2, 4);
Inc(Trys);
Wait(RandomRange(5,95));
Until (Length(MyTPA) > 0) Or (Trys >= 12)
If Trys >= 12 Then
Begin
writeln('Not found colour exiting :(');
Result := False
Exit;
End;
For i := 0 to High(MyTPA)Do
Begin
PointT := MyTPA[i]
If Not PointInBox(PointT,NotBox) Then//X/Y in NotBOX which is a tbox
MMouse (PointT.x, PointT.y, RandomRange(-5,5), RandomRange(-5,5));
If WaitUptext('age',4500) then
Begin
SetColorToleranceSpeed(1);
GetMousePos(x, y);
Result := True
If Random(30) = 5 Then
Begin
Mouse(x, y, 0, 0, False);
WaitOption('ag',4500);
End Else Mouse(x,y,0,0,True);
Exit;
End Else Begin
If IsUpText('et') Then
Begin
NotBox := IntToBox(x-15,y-15,x+15,y+15)
writeln('We have found a net fishing spot now skiping box ');
End;
End;
Wait(RandomRange(250,999));
End;
End;

Thanks :)

NCDS

2011-01-09 14:00:50

It would be beneficial to take a more dynamic approach to this.

I would suggest searching for all fish spot color on the screen, and split them into an ATPA according to the width and height of the spots. Then, you can simply loop through the different arrays and mouse over each middleTPA until you have the one you want.

Quick, simple, and effective. :)

p.s. you can still assign 'NotBoxes' to the 'wrong' arrays if you would like, though they would clearly need to change every time you move..

Troll

2011-01-09 14:12:59

From: NCDS
It would be beneficial to take a more dynamic approach to this.

I would suggest searching for all fish spot color on the screen, and split them into an ATPA according to the width and height of the spots. Then, you can simply loop through the different arrays and mouse over each middleTPA until you have the one you want.

Quick, simple, and effective. :)

p.s. you can still assign 'NotBoxes' to the 'wrong' arrays if you would like, though they would clearly need to change every time you move..


Umm could you please show me how to turn it in to a ATPA and loop them please and explain/link me to a tut :)

Thanks for helping :garfield:

NCDS

2011-01-09 14:23:23

From: Troll Man
Umm could you please show me how to turn it in to a ATPA and loop them please and explain/link me to a tut :)

Thanks for helping :garfield:



function FindFishSpot: Boolean;
var
atpa: T2DPointArray;
tpa: TPointArray;
p: TPoint;
i, x, y: Integer;
begin
FindColorTolerance(tpa, FishColor, ..); //Find the color points on screen
if Length(tpa) < 5 then // Just to make sure we actually found some points
Writeln('Failed to find points');

atpa := TPAtoATPAEx(tpa, Width, Height); //Splits tpa into an atpa according to size specified by width and height.

for i := 0 to High(atpa) do
begin
p := MiddleTPA(atpa[i]); //Set 'p' equal to the middle point in the array
MMouse(p.x, p.y, 3, 3);
if WaitUpText('age', 500) then
begin
GetMousePos(x, y);
Mouse(x, y, 3, 3, True); //However you want to click it
end;
end;
end;
This would be the basic way of doing it I guess. This is a very simple outline, but should hopefully give you a good idea of how to do it. :)

Troll

2011-01-09 14:25:33

Ahh i see :)

Ok thanks that is great i see where to be going now, little bit of time andthey would be better then a skipbox thanks again