SRL Archive - SRL Bugs

rs_GetCompassAngleRadians


BobboHobbo

2012-04-28 21:34:05

I noticed that MakeCompass wasnt working, therefore i looked into it and found that the N letter on the Compass has been changed to 0 colour ! unless it changes now?

Well heres my fix.

Function rs_GetCompassAngleRadians: Extended;
var
TPA: TPointArray;
T, M: TPoint;
B: TBox;
begin
B := IntToBox(529, 9, 557, 39);
with B do
FindColorsSpiralTolerance(T.x, T.y, TPA, 0, x1, y1, x2, y2, 0);
if Length(TPA) < 1 then
Exit;
M := MiddleBox(B);
T := MiddleTPA(TPA);
Result := ArcTan2(-(T.Y - M.Y), T.X - M.X+0.5) + Radians(90);
Result := fixRad(Result - Pi);
end;

Abu

2012-05-01 11:49:28

Can you use ClickNorth?

Also, I am using MakeCompass in my script and it is working fine for me… However it does rotate multiple times sometimes to get to the right angle if that's what you mean.

But… if it is just the north angle which doesn't work then I guess it will need updating, in which case, good job ;)

Coh3n

2012-05-07 18:52:23

Committed, thanks Bobbo.

bg5

2012-05-07 23:12:31

Color is back to 65536 now.

Total

2012-05-08 02:57:54

Yeah this messed up my agility script. I put the color to 65536 and it works.

Justin

2012-05-08 05:16:05

Verified changed back to 65536

Narcle

2012-05-08 05:52:13

Fixed pushed, added a small tolerance to adjust for 0 or 65536 in case they start making it random between those too.

Home

2012-05-08 05:52:40

Function rs_GetCompassAngleRadians: Extended;
var
TPA: TPointArray;
T, M: TPoint;
B: TBox;
begin
B := IntToBox(529, 9, 557, 39);
with B do
FindColorsSpiralTolerance(T.x, T.y, TPA, 0, x1, y1, x2, y2, 1);
Writeln(Length(TPA));
if Length(TPA) < 1 then
Exit;
M := MiddleBox(B);
T := MiddleTPA(TPA);
Result := ArcTan2(-(T.Y - M.Y), T.X - M.X+0.5) + Radians(90);
Result := fixRad(Result - Pi);
end;


Just change the tolerance to 1.

Edit. Ninjaed.

~Home

Justin

2012-05-08 06:05:10

From: Home
Function rs_GetCompassAngleRadians: Extended;
var
TPA: TPointArray;
T, M: TPoint;
B: TBox;
begin
B := IntToBox(529, 9, 557, 39);
with B do
FindColorsSpiralTolerance(T.x, T.y, TPA, 0, x1, y1, x2, y2, 1);
Writeln(Length(TPA));
if Length(TPA) < 1 then
Exit;
M := MiddleBox(B);
T := MiddleTPA(TPA);
Result := ArcTan2(-(T.Y - M.Y), T.X - M.X+0.5) + Radians(90);
Result := fixRad(Result - Pi);
end;


Just change the tolerance to 1.

Edit. Ninjaed.

~Home


Glad that it is all sorted.

Thanks for the push Narcle