SRL Archive - Research & Development Lounge

Radial Aid!


Naum

2009-01-15 11:48:05

Had some fun with trig, I made this simple RadialWalking App for someone. So I thought I'd release it.

What It Does

Fill In the Const as necessary
Press Play!
Type in the color, or Color for auto pick (note if you filled in the const - this will not appear)
Press 'q' for Radial1 by hovering your mouse the place in the minimap. And the same for Radial2.

Enjoy!

program Radial_Aid;

Const ColorOfRoad = ''; //enter roadcolor e.g findroadcolor.
// Else leave for automatic pick
Var
X, y, fx, fy, ColorP : Integer;
Radius, Radial2, Radial1 : Variant;
Color : String;
C0l : Variant;

Function Distance(x1, y1, x2, y2: Integer): Integer; // By PPLSUQBAWLZ edit BenLand100

Begin
Result := Round(Sqrt(Sqr(x1 - x2) + Sqr(y1 - y2))); //Pythag ;)
end;

Function FindRadial(x, y, Radius : Integer): Integer;
Var xr, yr, R : Integer;

Begin
For R := 1 to 360 do
Begin
xr := (Round(Radius*Sin(R * Pi / (360/2)))+ 627);
yr := (Round(-Radius*Cos(R * Pi / (360/2)))+ 85); //could have been

If Distance(x, y, xr, yr)<= 1 Then //* -r instead :)
Begin
Result := R;
Exit;
end;
end;
WriteLn('Couldn''t get radial');
end;

Procedure DoiT;
Label Nop;

Begin
If ColorOfRoad <> '' Then GoTo Nop Else
Begin
Color := ReadLn('Color Of Path - Type ''Color'' to pick color');

If Color = 'Color' Then
Begin
ActivateClient;
Wait(999);
PickColor(ColorP, x, y);
end;
end;
Nop :
ActivateClient;
Repeat
Wait(30);
Disguise('For Radial1 - press q');
Until(IsKeyDown('q'));

Begin
GetMousePos(x, y);
Radius := Distance(627, 85, x, y);
Radial1 := FindRadial(x, y, Radius);
Wait(270);
Repeat
Wait(30);
Disguise('For Radial2 - press q');
Until(IsKeyDown('q'));
GetMousePos(fx, fy);
Radius := Distance(627, 85, fx, fy);
Radial2 := FindRadial(fx, fy, Radius);
If ColorOfRoad <> '' Then
c0l := ColorOfRoad
Else
c0l := ColorP;

WriteLn('RadialWalk('+C0l+', '+Radial1+', '+Radial2+', '+Radius+', 0, 0);');
WriteLn('RadialRoadWalk('+C0l+', '+Radial1+', '+Radial2+', '+Radius+', 0, 0);');
end;

Disguise('Done!');
GetApplication.BringToFront;
end;

Begin
DoiT;
end.

If This is popular (Yakman's owns mine :p). Then I might be able to build on it.

Credits: Fakawi based on his path recorder
BenLand100 thx for the distance finder :)


EDIT : Released to public!

Cazax

2009-01-15 12:13:42

Your FindRadial seems very similar to Yakman's one, and why don't you just use Distance from SCAR?

Naum

2009-01-15 14:41:17

Distance in SCAR - Math Errors!

NCDS

2009-01-15 15:06:00

You are a Machine Nauman.
A damn Machine.