SRL Archive - SRL Archives

RadialWalkTolerance


Coh3n

2009-11-25 16:23:38

function RadialWalkTolerance(Color, sRadial, eRadial, r, modX, modY, Tol: Integer): Boolean;


Well after a few hours of trying to figure out why RadialWalk wasn't working like I wanted to, it came to my attention that RadialWalk doesn't use a tolerance. So, I came up with this, and now it works 100% better, for me at least.


{*******************************************************************************
function RadialWalkTolerance(Color, sRadial, eRadial, r, modX, modY, Tol: Integer): Boolean;
By: Coh3n
Description: Same as RadialWalk, but with a tolerance.
*******************************************************************************}
function RadialWalkTolerance(Color, sRadial, eRadial, r, modX, modY, Tol: Integer): Boolean;
var
TPA: TPointArray;
i, h: Integer;
begin
Result := False;

if RadialWalkEx(TPA, MMCX, MMCY, Color, Tol, sRadial, eRadial, r) then
begin
h := High(TPA);
for i := 0 to h do
if MFNF(TPA[i].x, TPA[i].y, modX, modY) then
begin
FFlag(10);
Result := True;
Exit;
end;
end;
end;

Let me know what you think,

Coh3n

marpis

2009-11-25 16:58:31

I've used this alot :)
If I already had my commiting rights, it would have been in SRL for a while.
But why MFF?

Nava2

2009-11-25 17:24:08

MFNF makes more sense :)

Coh3n

2009-11-25 20:21:01

My understanding of the difference between MFNF and MFF may not be right. I used MFF because that way it will still do the next RadialWalk (if you've chosen to do more than one), even if the flag from the previous one is still there.

For example, if SCAR clicks somewhere that's not reachable by the character, sometimes the flag will day there until you make another click. I hope that makes sense.

Nava2

2009-11-25 21:29:07

From: Coh3n
My understanding of the difference between MFNF and MFF may not be right. I used MFF because that way it will still do the next RadialWalk (if you've chosen to do more than one), even if the flag from the previous one is still there.

For example, if SCAR clicks somewhere that's not reachable by the character, sometimes the flag will day there until you make another click. I hope that makes sense.


I will have to look at it again, you may very well be correct.

Coh3n

2009-11-25 21:30:29

From: Nava2
I will have to look at it again, you may very well be correct.


:smile: That was just my thinking, and made more sense after Markus mentioned it.

marpis

2009-11-26 11:34:44

I thought MFNF clicks despite flag being present o_O
I might be wrong though. Too lazy to check it out.

Coh3n

2009-11-26 11:50:26

From: marpis
I thought MFNF clicks despite flag being present o_O
I might be wrong though. Too lazy to check it out.

You are right, I had them mixed up. :duh:

{*******************************************************************************
function MFF(X, Y, Xmod, Ymod: Integer): Boolean;
By: EvilChicken!
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}
function MFF(X, Y, Xmod, Ymod: Integer): Boolean;
begin
Result := MouseFlagEx(X, Y, 3, 3, Xmod, Ymod, -1, True, False);
end;

{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: EvilChicken!
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}
function MFNF(X, Y, Xmod, Ymod: Integer): Boolean;
begin
Result := MouseFlagEx(X, Y, 3, 3, Xmod, Ymod, -1, False, False);
end;

FEAR

2009-11-30 16:03:33

Thanks a lot Coh3n!!! :D

marpis

2009-11-30 16:06:55

Committed.

Coh3n

2009-11-30 21:41:10

From: marpis
Committed.

Cool, my first committed function! Thanks marpis. :smile: