SRL Archive - OSR Help

Fishing


Bad Boy JH

2010-01-22 05:24:44

Anyone got suggestions for an isfishing function

We need to check if the player is still fishing…
this is for karamja docks, fishing with lobster pot or harpoon…

suggestions so far… (from me and jimmy mac)

- Check for the spot being where it was before…with a backup invo checker, to see if any fish after a while…

- check for the colour of the harpoon or cage in a small box around the player…

Sugestions from you

- none so far

Also is the "findfishingspot" in fishing.scar working, if so, what do i need to do to get it working…

Blumblebee

2010-01-22 12:28:09

I posted one on a thread for you that works flawlessly, you don't need to use it but the concept behind it is what your looking for.

Bad Boy JH

2010-01-23 02:33:16

right, I decided to try out the second idea…and boy did it work…at least it did for me…can I get anyone willing to check this out…and see if when they are fishing, it tells them they are.. and if not tells them they arent'…

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

function isfishing:boolean;
var i, colorc:integer;
begin
result:=false
for i:=0 to 18 do
begin
wait(333)
colorc := colorc + CountColorTolerance(800338, MSCX-15, MSCY-15, MSCX+15, MSCY+15, 5)
end;
if(colorc > 35) then;
result:=true;
end;

begin
if isfishing then
writeln('fishing')
else
writeln('not fishing');
end.

Test it out when you are fishing, and when you aren't and make sure you get results, don't come back saying "oh it said I wasn't fishing when I was!"

give me results of all the tests, how many times you tried when fishing, and how many succeded and failed, and same for when you weren't fishing…

EDIT: it takes 6 seconds to run, after it compiles….so don't be impatient…also….this seems like a good length to call an antiban after? ie run the test for isfishing, then if it returns true then run anti ban kinda like

while isfishing do;
antiban;

should I add a function for if it returns <5 or 10 (lowest value on my tests when not fishing was 21) to check for randoms? or should i just call that when I do the antiban? but when it returns less than 35, it will look for a fishing spot, fail and we have issues, i recon a <10 or so check for antiban….

Kyle Undefined

2010-01-23 03:01:16

I ran it with just the SCAR screen showing and it said I was fishing…
^pic http://i45.tinypic.com/6fb8jo.png

I then added a loop and it still said I was fishing…
^ pic http://i45.tinypic.com/2l8e04j.png

Hope this helps.

~Camo

Bad Boy JH

2010-01-23 03:14:00

hmmm try this…tell me what it says…



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

function isfishing:boolean;
var i, colorc:integer;
begin
result:=false
for i:=0 to 18 do
begin
wait(333)
colorc := colorc + CountColorTolerance(800338, MSCX-15, MSCY-15, MSCX+15, MSCY+15, 5)
end;
if(colorc > 35) then
result:=true;
writeln(inttostr(colorc))
end;

begin
if isfishing then
writeln('fishing')
else
writeln('not fishing');
end.

It should tell me if its for some reason ignoring the
If color > 35 then;
line and still doing setting result as true…which would be irritating as ****!

Edit, I removed the colorcounttolerance section, and set the colorc to 20, it returned true…fixes anyone?

Edit two, taking away semi-colon after "then" in the colorc > 35 line

Dynamite

2010-01-23 08:57:43

This is what I use for my ProIvy, but should work same for you :)


function GetAnimation: Integer;
var
I : Integer;
begin
I := SmartGetFieldObject(0, 'at.N');
Result := SmartGetFieldInt(I, 'W');
SmartFreeObject(I);
end;

Function IsFishing : boolean;
var
GetAnimationTime : integer;
begin
Writeln('IsFishing');
Result := true;
repeat
AntiRandoms;
Antiban;
until (GetAnimation > 0);
repeat
if not (GetAnimation > 0) then
begin
Wait(200 + Random(400));
Inc(GetAnimationTime);
end;
until (GetAnimationTime > 10)
begin
if ClickContinue(false, false) then
Inc(Stats_CustomVars[5]); //SRL STATS
FindNewFishingpot;
end;
end;

Bad Boy JH

2010-01-23 19:12:30

just figured out its week point, If the spot to the east (which is off the dock) is selected by findfishspot, then unfortunatly… the countcolortolerance result is lower, as it picks up the dock, whist on it…to enough of a degree, that when fishing that spot there is MUCH lower result… to fix this, I rotated the camera 180, so its the last spot, if i understand how it worked (considering it chose that spot repeatedly, i assume that it checked left to right, now that spot is on the right, and not getting picked….)

also this *should* (not tested yet) allow me to set the value (35 in above code) higher, as now we don't have to worry about a rear facing player giving lower counts…

jimmy_mac

2010-01-23 19:59:08

you dont need to rotate. you can just use FindFishSpotTPA, the use this:
function RemoveDistTPointArray(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray; 
Description:
Removes the points that are inside or outside the distance Dist
from the point (x, y) from the TPointArray ThePoints.

or use the code I gave you as it works (below), which would allow you to fish at the spot on the beach. rotating is detectable if u do it every time u go to the dock.

procedure CountCageColors; //Ths procedure takes 6 seconds.
var
i : Integer;
CageCount : TIntegerArray;
begin
SetArrayLength(CageCount, 18);
for i := 0 to 17 do
begin
CageCount[i] := CountColorTolerance(1000036, MSCX - 20, MSCY - 20, MSCX + 20, MSCY + 20, 10);
if CageCount[i] >= 5 then
begin
Writeln('Still Fishing');
exit;
end;
wait(300);
end;
Writeln('Not Fishing');
end;

Mr. Doctor

2010-01-23 20:01:32

IsMoving. Or Tbox + PixelShift.

jimmy_mac

2010-01-23 20:39:17

IsMoving doesn't seem to pick up when you are cage fishing (just tested).

Bad Boy JH

2010-01-23 21:23:30

Jimmy, are you able to make the movement with the player facing south instead of north, it *should* only be a matter of adding/subtracting 180 from all the directions of radial walks and such…

That way we won't have the detectibility of turning the camera around every time…

Bad Boy JH

2010-01-26 00:46:35


Function FindFishingSpot:boolean;
var
x, y, i:integer;
TPA:TPointArray;
begin
result:=false;
if not(FindfishspotsTPA(TPA)) then
exit;
SortTPAFrom(TPA, Point(MSCX, MSCY));
for i:=0 to high(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 5, 5)
if isuptext('age') then
begin
getmousepos(x, y)
if players[currentplayer].strings[1]=lowercase('lobster') then
Mouse(x, y, 0, 0, true) else
begin
Mouse(x, y, 0, 0, false)
ChooseOption('harpoon')
end;
result:=true
exit;
end;
end;
end;
anyone find a problem in that code

btw [currentplayer].strings[1] is the type of fish they are fishing, only lobster, swordfish or tuna…

Kyle Undefined

2010-01-26 09:43:10

It will return True not matter what…Try this:

Function FindFishingSpot:boolean;
var
x, y, i : Integer;
TPA : TPointArray;
begin
if(not(FindfishspotsTPA(TPA)))then Exit;
SortTPAFrom(TPA, Point(MSCX, MSCY));
for i := 0 to high(TPA) do
begin
MMouse(TPA[i].x, TPA[i].y, 5, 5);
if isuptext('age') then
begin
getmousepos(x, y);
if(Players[CurrentPlayer].Strings[1] = Lowercase('lobster'))then
Mouse(x, y, 0, 0, True);
Result := // Check the last line in the chat box to see if it says your player is fishing
Exit
else
begin
Mouse(x, y, 0, 0, False);
Result := ChooseOption('harpoon');
Exit;
end;
end;
end;
end;

~Camo

Bad Boy JH

2010-01-26 19:25:23

oops someone forgot a begin and end….XD

Kyle Undefined

2010-01-26 23:00:09

Haha, yeah xD oh well lol.

~Camo

jimmy_mac

2010-01-27 07:12:39

From: Camo Developer
It will return True not matter what…


Dissagree. check out the line near the top
Result:=False;
if not FindFishSpotsTPA(TPA) then
exit;
That would work fine.

Sir R. M8gic1an

2010-01-27 10:37:21

Updated Fishing.scar so that now the TPA you receive from FindFishingSpotsTPA will be sorted from closest to (MMCX, MMCY) as had been intend in the first place.

~RM

Bad Boy JH

2010-01-27 19:09:55

that is excellent, does this mean that FindFishSpot, will find the closest spots first?

Smarter Child

2010-01-27 20:59:20

From: Bad Boy JH
that is excellent, does this mean that FindFishSpot, will find the closest spots first?


Yeah. Now that it starts search from the middle of the mainscreen.

Bad Boy JH

2010-01-28 03:26:08

Great, so AFTER I Fix, a fairly major issue in our script (I think its mine now, haven't seen Jimmy…), you decide to make the overall SRL function do exactly what I was Spending my time trying to get it to do….bugger…well at least it taught me enough to help me make that findcoins function work…lol….*sigh* effort for nothing…at least the function is fixed now…

Sir R. M8gic1an

2010-01-28 03:29:02

From: Smarter Child
Yeah. Now that it starts search from the middle of the mainscreen.


Not really, What it does is sort the ATPA from the center, which then gets transformed into a TPA which is the result.

From: Bad Boy JH
Great, so AFTER I Fix, a fairly major issue in our script (I think its mine now, haven't seen Jimmy…), you decide to make the overall SRL function do exactly what I was Spending my time trying to get it to do….bugger…well at least it taught me enough to help me make that findcoins function work…lol….*sigh* effort for nothing…at least the function is fixed now…


Heh sorry, this thread made me notice there was a fault in the function..

~RM

Bad Boy JH

2010-01-28 07:17:23

You misunderstand me, I wasn't complaining seriously, though I figure that I may not be known well enough for my smart arse attitude here yet, where I can tend to complain about anything, just as a joke, If i was pissed of, I would be giving you about 5 and 3 quarter ears full (ear fulls? hmm what is the plural here) I figure, if it improves SRL, I am fine with it… The last word usually communicates what I mean, "at least the function is fixed now" hint of irritation, but Still happy its fixed…

Sir R. M8gic1an

2010-01-28 08:24:23

From: Bad Boy JH
You misunderstand me, I wasn't complaining seriously, though I figure that I may not be known well enough for my smart arse attitude here yet, where I can tend to complain about anything, just as a joke, If i was pissed of, I would be giving you about 5 and 3 quarter ears full (ear fulls? hmm what is the plural here) I figure, if it improves SRL, I am fine with it… The last word usually communicates what I mean, "at least the function is fixed now" hint of irritation, but Still happy its fixed…


I never took it as a complaint, I am jsut genuinely sorry that you had to go through all that work when it should've been me doing it in the first place as I was the original function writer ;)

~RM

Bad Boy JH

2010-01-29 00:55:57

well..alls well that ends well…Still learnt alot of knowlage, that I have put to use…