SRL Archive - SRL Archives

FlagEx fix..?


NCDS

2009-08-21 11:58:54

Well here's the current FlagEx:

{*******************************************************************************
function FlagEx(Dist: Integer; RoadColorCheck: Boolean): Boolean;
By: Wizzup? / WT-Fakawi / ZephyrsFury modified by N1ke!
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}
function FlagEx(Dist: Integer; RoadColorCheck: Boolean): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 3026478, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
If RoadColorCheck then
RoadColorChecker;
Wait(100);
if (GetColor(6, 6) <> clWhite) then
if (GetSystemTime - M > 5000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
Wait(RandomRange(200, 400));
end;

and unless I'm missing something, I don't see a reason to make it wait 5 seconds before checking to see if you are moving or not. That just adds an un human like wait when your standing next to where you clicked but the flag doesn't go away.

So:

{*******************************************************************************
function FlagEx(Dist: Integer; RoadColorCheck: Boolean): Boolean;
By: Wizzup? / WT-Fakawi / ZephyrsFury modified by N1ke!
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}
function FlagEx(Dist: Integer; RoadColorCheck: Boolean): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 3026478, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
If RoadColorCheck then
RoadColorChecker;
Wait(100);
if (GetColor(6, 6) <> clWhite) then
if (GetSystemTime - M > 1000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
Wait(RandomRange(200, 400));
end;

That just seems a bit more logical to me, as far as AntiBan and speed of script go anyways. It could probably wait for even less than that honestly, but 1 second seems like a nice wait time.

EDT: I only bring this up because I find that the following scenario happens quite frequently:
From: NCDS

You click to walk into the bank, but you click behind a bank booth. The flag appears behind the bank booth but you only walk to the front of it. So, the flag doesn't disappear and currently, FlagEx makes it wait 5+ more seconds before it realizes your not moving anymore. If it is changed to a 1 second wait (or around that) however, it will then find it almost immediately.

Am I wrong :confused:

ian.

2009-08-21 12:01:50

I'm pretty sure it's just because you can click and walk for a few seconds before needing to click again. There are places where you can walk for 10-15 seconds in one click, but there isn't/won't be a script there. (On the way to Barrows.. :p) So 5 seconds is a reasonable time, in my mind. :)

NCDS

2009-08-21 12:04:55

From: ian.
I'm pretty sure it's just because you can click and walk for a few seconds before needing to click again. There are places where you can walk for 10-15 seconds in one click, but there isn't/won't be a script there. (On the way to Barrows.. :p) So 5 seconds is a reasonable time, in my mind. :)


But it's in a loop anyways. From what I can see 5 seconds is the time it wait's before checking again to see if your walking. So what then if your walk only took 1 second, but the flag didnt go away because you clicked behind the wall of something. It would make you wait all that extra time. Were as if you only wait 1 second in between, it would be more responsive.

See what I'm saying?

ian.

2009-08-21 12:12:43

Meh. I suppose. But I don't pay attention much when I walk. And a few seconds won't change much in the script. :) And what if it does happen to be like.. 15 seconds? Someone could open/close a door or something. :) Good find, but I don't think there's much need for it.

NCDS

2009-08-21 12:19:52

From: ian.
Meh. I suppose. But I don't pay attention much when I walk. And a few seconds won't change much in the script. :) And what if it does happen to be like.. 15 seconds? Someone could open/close a door or something. :) Good find, but I don't think there's much need for it.


I really don't think you understand what I'm saying..

All this changes is how fast it loops through the function. Clearly, by making it loop through the function faster, it becomes more responsive and human like.

Scenario:
You click to walk into the bank, but you click behind a bank booth. The flag appears behind the bank booth but you only walk to the front of it. So, the flag doesn't disappear and currently, FlagEx makes it wait 5+ more seconds before it realizes your not moving anymore. If it is changed to a 1 second wait (or around that) however, it will then find it almost immediately.

ian.

2009-08-21 12:37:12

:p I know what you're saying. I just don't see how it'd make TOO much difference. Max of 4 second wait compared to yours, right? :) Or even more, it doesn't matter. Maybe they took a drink of water/ate/something. I'm not really trying to criticize you (sorry if it seems like it/I am.. I'm watching TV/texting/talking.. :p), I'm just saying that it won't make much of a difference. Nice find, nonetheless. ^^

ZephyrsFury

2009-08-21 13:05:24

But we need a compromise between an efficient function and one that doesn't fail when RS lags even just a bit. 5 seconds seems like a good compromise.

NCDS

2009-08-21 13:09:29

Ahh I see now. I wasn't factoring in any lag :/

I often forget about that now since my new PC = lag free basically.


Feel free to lock/delete thread.

ZephyrsFury

2009-08-21 13:53:53

If everyone thinks 5 seconds is too long I'm happy to reduce it. But making it too small will screw up things for people on slower internet or computers.

NCDS

2009-08-21 13:59:45

From: ZephyrsFury
If everyone thinks 5 seconds is too long I'm happy to reduce it. But making it too small will screw up things for people on slower internet or computers.


No, I agree with you :)

5 seconds is a good time. It's 6:03 am for me right now though, I just didn't think about possible lag.

I really only brought it up because I was trying to get max XP per hour on my new script :rolleyes: