SRL Archive - SRL Archives

Function ImpRadialWalk; radial walk with any compass angle


elementalelf

2007-09-12 04:21:06

really quite basic, just make your radials using the radial walking aid thingy, however make sure your compass is pointing directly north, put the values in as if its facing north, and it will radial walk regardless of what compass angle its facing

now you can make an entire script without having to use makecompass() once.

function ImpRadialWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius:
Integer; Xmod, Ymod: Integer): Boolean;
var
mx, my, CAngle: Integer;
begin
CAngle:=FindCompassAngle;
if (StartRadial = EndRadial) then
begin
WriteLn('WARNING: Using LinearRalk, StarRadial, and EndRadial are the same');
if LinearRoadWalk(TheColor, StartRadial, Radius, XMod, YMod) then
Result := True;
end else
if (radialwalkex(mx, my, 648, 83, thecolor, 10, startradial+CAngle, endradial+CAngle, radius)) then
begin
MouseFindNoFlag(mx, my, Xmod, Ymod);
Result := True;
FFlag(10);
end;
end;
begin
end.

Santa_Clause

2007-09-12 04:33:50

1337! Can't help on any suggestions for this though, I'm not good with walking.

R0b0t1

2007-09-12 18:06:17

Cool.

But there is a faster thing called


rs_GetCompassAngleDegrees;
rs_GetCompassAngleRadians;

Hard coded, so its faster.

Infantry001

2007-09-12 22:52:53

I believe that broke a while ago.

elementalelf

2007-09-13 00:17:15

im not sure what the general consensus is… good idea or bad idea?

SKy Scripter

2007-09-13 00:50:44

hah. i use mine all the time :)




function DetectCompassDegrees : Extended;
var
P : TPointArray;
I, Mx, My, Midx, Midy, L : Integer;
begin
Midx := 561;
Midy := 20;
FindColorsTolerance(P, 1911089, 539, 0, 581, 38, 0);
L := Length(P);
if (l = 0) then exit;
for i := 0 to L-1 do
begin
Mx := Mx + P[i].x;
My := My + P[i].y;
end;
Mx := Mx / L;
My := My / L;
Result := FixD(FixD(Degrees(ArcTan2(my - midy, mx - midx))) + 90);
end;


function CompassRadialWalk(var x, y : Integer; Color, StartRadial, EndRadial, SRadius, ERadius: Integer): Boolean;
var
i, xx, yy : Integer;
Compass_Degrees : Extended;
Add : Boolean;
begin
if (not(LoggedIn)) then exit;
Compass_Degrees := DetectCompassDegrees;
if (SRadius < ERadius) then
Add := True;
if (StartRadial < EndRadial) then
begin
repeat
for i := StartRadial to EndRadial do
begin
if (not(LoggedIn)) then exit;
xx := Round(SRadius * Sin(Radians(FixD(Compass_Degrees + i))) + MMCX);
yy := Round(-SRadius * Cos(Radians(FixD(Compass_Degrees + i))) + MMCY);
if (FindColor(x, y, Color, xx, yy, xx + 1, yy + 1)) then
begin
Result := True;
Exit;
end;
end;
SRadius := SRadius - 4;
if (Add) then
SRadius := SRadius + 8;
until (InRange(SRadius, ERadius - 4, ERadius + 4));
end;
if (StartRadial > EndRadial) then
begin
repeat
for i := StartRadial downto EndRadial do
begin
if (not(LoggedIn)) then exit;
xx := Round(SRadius * Sin(Radians(FixD(Compass_Degrees + i))) + MMCX);
yy := Round(-SRadius * Cos(Radians(FixD(Compass_Degrees + i))) + MMCY);
if (FindColor(x, y, Color, xx, yy, xx + 1, yy + 1)) then
begin
Result := True;
Exit;
end;
end;
SRadius := SRadius - 4;
if (Add) then
SRadius := SRadius + 8;
until (InRange(SRadius, ERadius - 4, ERadius + 4));
end
end;

elementalelf

2007-09-13 01:13:11

that looks remarkably similar to my OLD OLD walking procedure.

i used triangles instead of circles though.

Infantry001

2007-09-13 10:25:59

Interesting, it is quite basic, but it will work. I wonder why no one ever tohught of this before?'

Good job! Im going to try it out :D

elementalelf

2007-09-13 17:49:10

i myself was actually wondering why nobody had thought of it before, its only combining 2 functions to make 1 less detectable function…
like windmouse and mmouse

R0b0t1

2007-09-13 18:07:51

I just had an Idea for compass angleage.

Just make a DDTM of the N, and then look for a DTM rotated. It returns the degrees I'm pretty sure.

elementalelf

2007-09-13 21:43:27

findcompassangle does that….