SRL Archive - OSR Help

Fishing Procedure


Bad Boy JH

2010-05-31 09:25:51

I am trying to get a function which finds me a fishing spot in which I can cage fish, and then start cage fishing (lobsters, karamja), it uses reflection.
Unfortunatly, It can't Find any spots, and I don't know why, anyone else know why?


Function Fish:Boolean;
var
TPoint:TPoint;
i: integer;
TheSpots:TNPCArray;
begin
TheSpots := SortNPCs(GetNPCS);
For I := 0 to High(TheSpots) do
begin
if InStrArr('Cage', TheSpots[i].Actions, False) then
begin
TPoint := TileToMS(TheSpots[i].Tile, Random(10));
MMouse(TPoint.x, TPoint.x, 5, 5);
GetMousePos(TPoint.x, TPoint.y);
if WaitUpText('Cage', 350) then
begin
Mouse(TPoint.x, TPoint.y, 0, 0, True)
Result := True;
Break;
end else
begin
Mouse(TPoint.x, TPoint.y, 0, 0, False);
if WaitOption('Cage', 350) then
begin
Result := True;
Break;
end;
end;
end;
end;
end;

Sir R. M8gic1an

2010-05-31 09:46:39

Is a fishing spot an NPC… ?

~RM

Bad Boy JH

2010-05-31 09:51:17

Yes, Try Running a basic…
TNPCArray := GetNPCS;
DumpNPCS(TNPCArray);
It prints out Fishing spots there also, I also read it on here…somewhere…

bbri06

2010-05-31 15:18:14

This is working for me


Function Fish:Boolean;
var
TPoint:TPoint;
i: integer;
TheSpots:TNPCArray;
begin
TheSpots := SortNPCs(GetNPCS);
For I := 0 to High(TheSpots) do
begin
if(TileOnMS(TheSpots[i].Tile, 0))then
if InStrArr('Cage', TheSpots[i].Actions, False) then
begin
TPoint := TileToMS(TheSpots[i].Tile, TheSpots[i].Height);
MMouse(TPoint.x, TPoint.x, 3, 3);
GetMousePos(TPoint.x, TPoint.y);
if WaitUpText('Cage', 350) then
begin
Mouse(TPoint.x, TPoint.y, 0, 0, True)
Result := True;
Break;
end else
begin
Mouse(TPoint.x, TPoint.y, 0, 0, False);
if WaitOption('Cage', 350) then
begin
Result := True;
Break;
end;
end;
end;
end;
end;

Also, when you do

if WaitUpText('Cage', 350) then
begin
Mouse(TPoint.x, TPoint.y, 0, 0, True)
Result := True;
Break;
end else
begin
Mouse(TPoint.x, TPoint.y, 0, 0, False);
if WaitOption('Cage', 350) then
begin
Result := True;
Break;
end;
end;

It seems a little pointless to have the

end else
begin
Mouse(TPoint.x, TPoint.y, 0, 0, False);
if WaitOption('Cage', 350) then
begin
Result := True;
Break;
end;
end;

Because if it does not find the UpText, then it's going to try and right click there anyways.

Edit: Nevermind, it's extremely inconsistent for some reason and when testing it will think that the fishing spots are on the sand or something. Verry odd. It's almost as if TileToMS is broken.

Edit2: Got it! Try using this function


Function Fish:Boolean;
var
NPCS: TNPCArray;
i, z: integer;
P: TPoint;
begin
NPCS := GetNPCS;
if(length(NPCS) > 0)then
for i := 0 to High(NPCS) do
if(NPCS[i].Name = 'Fishing spot') and (TileOnMS(NPCS[i].Tile, NPCS[i].Height)) and (NPCS[i].Actions[0] = 'Cage')then
begin
P := TileToMS(NPCS[i].Tile, NPCS[i].Height);
MMouse(P.x, P.y, 4, 4);
Wait(150 + random(50));
GetMousePos(x, y);
if(IsUpText('Cage'))then
begin
Writeln('Clicking fishing spot');
Z := Random(10);
if(Z < 6)then
begin
Mouse(x, y, 0, 0, False);
Wait(150 + random(50));
Result := (R_ChooseOption('Cage'))
Exit;
end else
begin
Mouse(x, y, 0, 0, true);
Result := True;
Exit;
end;
end;
end;
Result := False;
end;

Bad Boy JH

2010-06-01 02:27:12

Works, Thanks, I'll Just get rid of the comments, and add some antiban, and I will be able to run it. Thank you for your help, It seems sad that I have to rely on others so often when I am a member…

bbri06

2010-06-01 02:32:54

Meh, nothing really sad about it. I came back a couple months ago and didn't remember a thing lol, and I already had most of that function worked out from my Edgeville fisher. I just had to change it a little for Cage fishing. Tell me if you need any more help with fishing stuff, I can probably help you out.