SRL Archive - Help

IsFishing Function?


Sawyer

2013-01-29 09:46:46

I am currently making a fishing colony monkfish fisher, but I can't get it to stop finding new fishing spots after it's fishing. I've tried using AveragePixelShift, and it doesn't work. What code should I use for checking if it hasn't gained xp in a certain amount of time to find a new spot?

Sjoe

2013-01-29 09:51:07

What about the Total/Fishing XP Counter?

Sawyer

2013-01-29 09:58:08

I think that'd be easier than looking in the inventory.. i'll try that.

Would this code work?

Function IsFishing: Boolean;
var
Isfishingxp, Startxp, i:Integer;
begin
Startxp := (GetXPBar(1)+1);
wait(randomrange(10000, 20000));
IsFishingxp := GetXPBar(1);
if (Isfishingxp > Startxp) then
result := True;
if not (Isfishingxp > Startxp) then
result := False;
end;

Dynamite

2013-01-29 10:11:13

What about following the point/colour where you clicked and when it disappears then the fishing spot isn't there.

-Boom

Sawyer

2013-01-29 10:19:46

I put some code onto my first reply.. would that work? idk. I'm not the most expierienced scripter.

Sjoe

2013-01-29 10:27:20

From: Dynamite
What about following the point/colour where you clicked and when it disappears then the fishing spot isn't there.

-Boom


Yeah thought bout too, might be an hassle if the camera shifts, could do it in a box?


From: Sawyer
I put some code onto my first reply.. would that work? idk. I'm not the most expierienced scripter.


I'm not that experienced too , but I think it would work though. (assuming you're using a repeat until not Isfishing)

But U can change

if (Isfishingxp > Startxp) then
result := True;
if not (Isfishingxp > Startxp) then
result := False;
to something shorter

if (Isfishingxp > Startxp) then
result := True;
else
result := False;
No need to make a new if then statement, when u can use else

Flight

2013-01-29 10:59:46

From: Sawyer
I think that'd be easier than looking in the inventory.. i'll try that.

Would this code work?

Function IsFishing: Boolean;
var
Isfishingxp, Startxp, i:Integer;
begin
Startxp := (GetXPBar(1)+1);
wait(randomrange(10000, 20000));
IsFishingxp := GetXPBar(1);
if (Isfishingxp > Startxp) then
result := True;
if not (Isfishingxp > Startxp) then
result := False;
end;


Using that code, here's how I'd go about this:

Function IsFishing: Boolean;
var
XPA,T: Integer;
begin
Result := False;
if not LoggedIn then
Exit;

XPA := GetXPBar(1);
MarkTime(T);

Repeat
if not LoggedIn then
Exit;
FindNormalRandoms;

if (GetXPBar(1) <> XPA) then
break;
Until(TimeFromMark(T) > 7000) //7 seconds without gaining XP

Result := (GetXPBar(1) <> XPA);
end;

Also, if this function is constantly begin called then you'll want to put more inside of this function's loop, like InvFull checks or anti-bans, ect…

Sjoe

2013-01-29 11:03:34

From: Flight
<>


What does <> mean?

Flight

2013-01-29 11:06:04

From: Sjoekeloe
What does <> mean?


Greater than or less than, basically "if (integerA does not equal integerB) then". In Java I believe it's the same as "!=".

Sjoe

2013-01-29 11:08:09

From: Flight
Greater than or less than, basically "if (integerA does not equal integerB) then". In Java I believe it's the same as "!=".


alright useful to know, I read it as 'different'
thanks!

Sawyer

2013-01-29 11:28:33

Thanks guys. I'm kinda new to scripting, so I'm learning a lot.

Flight

2013-01-29 11:40:41

Not a problem at all. Don't be afraid to ask for any help, that's why we're here. :)