SRL Archive - SRL Archives

RadialTPAWalk - guess by who...


n3ss3s

2008-01-23 12:57:09

MinPix - how many pixels a square of the color must contain

SR, ER - StartRadial, EndRadial

MinD, MaxD - min distance, max distance

Color - the color to walk "at".

This function is compass angle independent, you don't need to do anything to the angles yourself or worry about the angle shifting…


Function RadialTPAWalk(Color: Integer; MinPix, SR, ER, MinD, MaxD: Integer): Boolean;
Var
TPAA: Array of TPointArray;
X, Y, Z, I, S, E: Integer;
TPA: TPointArray;
Begin
FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, 0);
FilterPointsPie(TPA, 0, 359, MinD, MaxD, MMCX, MMCY);
TPAA := TPAToATPA(TPA, Round(Sqrt(MinPix)));
S := SR + Round(Rs_GetCompassAngleDegrees);
E := ER + Round(Rs_GetCompassAngleDegrees);
If S > 360 Then S := S - 315;
If E > 360 Then E := E - 315;
Writeln(IntToStr(S));
Writeln(IntToStr(E));
For I := 0 To High(TPAA) Do
Begin
MiddleTPAEx(TPAA[i], X, Y);
Z := Round(Degrees(ArcTan2(MMCY - Y, MMCX - X))) - 90;
If Z < 0 Then
Z := Z + 360;
If Z > SR Then
If Z < ER Then
Begin
MouseFindFlag(X, Y, 1, 1);
Flag;
Result := True;
Exit;
End;
End;
End;

nielsie95

2008-01-23 17:09:34

Why do you filter the degrees yourself? Don't trust FilterPointsPie with it? :p


FindColorsSpiralTolerance(MMCX, MMCY, TPA, Color, MMX1, MMY1, MMX2, MMY2, 0);

finds the points center-out.. the opposite of RadialWalk.

Also, RadialWalk scans a distance from start to endradial.. This doesn't scan any particular direction?

I suggest using RadialWalkEx:

function RadialTPAWalk(Color: Integer; MinPix, SD, ED, MaxR: Integer): Boolean;
var
i, d, x, y: Integer;
tpa: TPointArray;
atpa: TPointArrayArray;
begin
Result := False;
d := Round(Rs_GetCompassAngleDegrees);
if (d < 0) then Exit;
if (not RadialWalkEx(tpa, MMCX, MMCY, Color, 0, SD + d, ED + d, MaxR)) then Exit;
atpa := TPAtoATPA(tpa, Round(sqrt(MinPix)));
for i := 0 to High(atpa) do
if (Length(atpa[i]) > MinPix) then
begin
MiddleTPAEx(atpa[i], x, y);
if MFNF(x, y, 1, 1) then
begin
Result := True;
FFlag(10);
Break;
end;
end;
end;

King of Knives

2008-01-23 17:13:43

For crying out loud, just copyright the word "TPA"!

Everytime I see a topic in "SRL New Functions" or "Public Test Corner" with the word "TPA" in it, I go in and see it's you!! Jesus!!

-Knives

n3ss3s

2008-01-24 08:15:38

Why do you filter the degrees yourself? Don't trust FilterPointsPie with it?


I've tried it and didn't work ;)

Also, the Spiral is for habit, and it makes no difference - this function does work just as designed.

BobboHobbo

2008-01-24 08:34:08

From: King of Knives
For crying out loud, just copyright the word "TPA"!

Everytime I see a topic in "SRL New Functions" or "Public Test Corner" with the word "TPA" in it, I go in and see it's you!! Jesus!!

-Knives


Hahaha very true :)

Negaal

2008-01-24 08:40:43

He will not stop before he gets to DEV…
Looks nice to me since I can't understand it^^

What filterpoints Pie does?

And where could I get list of all TPA/misc functions of scar…like exit, abs, TPAtoGasp etc…

I mean those what arent displayed in scar help file?

n3ss3s

2008-01-24 09:33:03

Gap, not Gasp! :p

Gap is like a… hole :)


And where could I get list of all TPA/misc functions of scar…like exit, abs, TPAtoGasp etc…


They are in WizzyPlugin, (talking of the TPA stuff) -

.includes\SRL\SRL\Misc\WizzyPlugin.scar

or www.srl-forums.com/srl-repos/ -> Place inside plugins folder -> WizzyPlugin.drp since WizzyPlugin.scar doesn't show them all.

Filter points pie "takes a slice of a pie"+(describes the circle)+"with set angles and radius"


He will not stop before he gets to DEV…


And not after ;)


EDIT: By the way, if you do want long steps, make it For I := High(TPAA) DownTo 0 Do :)