Markus
2007-05-07 13:18:02
I recently found the file obsolete.csar (full of non working functions) and I decided to fix some them. I didn't fix all of them, but five of them, here is the list of functions I fixed:
Mouseangle by Renax
Rotatepoint by Renax/RsN
Awalk2 by Starblaster100
Angelwalk by Liquid
Angelwalker by Liquid, based on Sythes Awalk. (not the same as the one above).
Here are they, they all need the folowing procedures regarding to Divis compass functions.
Mouseangle by Renax
Rotatepoint by Renax/RsN
Awalk2 by Starblaster100
Anglewalk by Liquid
And the last one, Anglewalker by Liquid (not anglewalk)
Happy scripting!
Mouseangle by Renax
Rotatepoint by Renax/RsN
Awalk2 by Starblaster100
Angelwalk by Liquid
Angelwalker by Liquid, based on Sythes Awalk. (not the same as the one above).
Here are they, they all need the folowing procedures regarding to Divis compass functions.
{*******************************************************************************
function FixDegrees(Angle : integer) : integer;
By: Markus
Description: Fixes the by Divi returned compass angles.
Divi returns N = 0, E = 270, S = 180 and W = 90.
This will make it N = 0, E = 90, S = 180 and W = 270
*******************************************************************************}
function FixDegrees(Angle : integer) : integer;
begin
result := 360 - angle
end;
{*******************************************************************************
function FixDegreesExt(Angle : extended) : extended;
By: Markus
Description: Same as FixDegrees, but extended instead of integer
*******************************************************************************}
function FixDegreesExt(Angle : extended) : extended;
begin
result := 360 - angle
end;
{*******************************************************************************
function FixRadians(angle : extended) : extended;
By: Markus
Description: Same as FixDegrees, but now for radians.
*******************************************************************************}
function FixRadians(angle : extended) : extended;
begin
result := 2 * pi - angle;
end;
Mouseangle by Renax
{*******************************************************************************
procedure MouseAngle(Angle, Distance: Integer);
By: Renax, fixed by Markus
Description: Clicks on a point based on the angle and distance parameters.
*******************************************************************************}
procedure MouseAngle(Angle, Distance: Integer);
begin
Angle := Angle - Fixdegrees(Round(rs_GetCompassAngleDegrees));
x := Round(Distance * Sin(angle * Pi / 180)) + 648;
y := Round(-Distance * Cos(angle * Pi / 180)) + 83;
MouseFindFlag(x, y, 0, 0)
end;
Rotatepoint by Renax/RsN
{*******************************************************************************
function RotatePoint(x, y: Integer): TPoint;
By: Renax/RsN, fixed by Markus
Description: rotates x and y according to the minimspangle, relative north.
*******************************************************************************}
function RotatePoint(x, y: Integer): TPoint;
var
Alpha: Extended;
begin
Alpha := (FixRadians(rs_GetCompassAngleRadians) / Pi) * 180;
Alpha := FixRadians(rs_GetCompassAngleRadians) - (2 * Pi);
x := x - 648;
y := y - 83;
Result.x := Trunc(Cos(Alpha) * x - Sin(Alpha) * y) + 648;
Result.y := Trunc(Sin(Alpha) * x + Cos(Alpha) * y) + 83;
end;
Awalk2 by Starblaster100
{*******************************************************************************
procedure AWalk2(Angle, Radius, Color: Integer);
By: Starblaster100, fixed by Markus
Description: Will walk at a specified angle, at a specified radius until the
given color is found on the minimap screen
*******************************************************************************}
procedure AWalk2(Angle, Radius, Color: Integer);
var
awx, awy, tout, Temp, Radius2, x1, y1: Integer;
TempAngle, CurrentMinimapAngle: Extended;
CompassBool: Boolean;
begin
Radius2 := Radius;
if (Radius = 0) or (Radius2 = 0) or (Radius > 57) or (Radius2 > 57) then
Radius2 := 57;
repeat
Temp := 0;
tout := tout + 1;
TempAngle := Angle;
CurrentMinimapAngle := rs_GetCompassAngleRadians;
if (CurrentMinimapAngle = -1) then
begin
WriteLn('Minimap not Found!');
Exit;
end;
CurrentMinimapAngle := 360 - CurrentMinimapAngle * (180 / Pi);
TempAngle := TempAngle - CurrentMinimapAngle;
X1 := Round(Radius2 * Sin(TempAngle * Pi / 180)) + 648;
Y1 := Round(-Radius2 * Cos(TempAngle * Pi / 180)) + 84;
Mouse(x1 - 2, y1 - 2, 4, 4, True);
Wait(500);
if (FlagPresent = False) then
begin
repeat
Mouse(x1 - 2, y1 - 2, 4, 4, True);
Wait(500);
tout := tout + 1;
until (FlagPresent) or (FindColor(awx, awy, color, 569, 8, 723, 160)) or
(Tout > 20);
if (tout > 20) then
begin
WriteLn('AWalk2 by Starblaster100/Fix by Markus - Could not Click!');
Logout;
end;
end;
repeat
Wait(250);
Temp := Temp + 1;
until not (FlagPresent) or (Temp > 29)
if (Color = 0) then
Exit;
awx := 648;
awy := 84;
until (FindColor(awx, awy, color, 569, 8, 723, 160)) or (Tout > 20);
end;
Anglewalk by Liquid
{*******************************************************************************
procedure AngleWalk(Angle, Distance, Randomx, Randomy: Integer);
By: Liquid, fixed by Markus
Description: Makes a circle with the radius of Distance and clicks at
specified Angle, angle is in degree's
*******************************************************************************}
procedure AngleWalk(Angle, Distance, Randomx, Randomy: Integer);
var
x, y, Degree: Extended;
begin
Randomx := Random(Randomx);
Randomy := Random(Randomy);
Degree := FixD(FixD(Angle + 90) - Round(FixRadians(rs_GetCompassAngleRadians) * 56));
x := Distance * Cos(Degree * Pi / 180);
y := Distance * Sin(Degree * Pi / 180);
Mouse(Round(x + 648), Round(y + 83), Randomx, Randomy, True);
end;
And the last one, Anglewalker by Liquid (not anglewalk)
{*******************************************************************************
procedure AngleWalker(gAngle: Extended; gDistance: Integer);
By: based on Sythes AWalk/Liquid, fixed by Markus
Description: Walks the Map regardless of compass focus.
*******************************************************************************}
procedure AngleWalker(gAngle: Extended; gDistance: Integer);
var
gX, gY: Integer;
gMinimapAngle: Extended;
gCompass: Boolean;
begin
gMinimapAngle := rs_GetCompassAngleRadians;
if gMinimapAngle <> -1 then
begin
WriteLn('Map Angle: ' + FloatToStr(gMinimapAngle));
gMinimapAngle := 360 - gMinimapAngle * (180 / Pi);
end
else
begin
WriteLn('Minimap not visible, please restart script.');
TerminateScript;
end;
WriteLn('Map Angle: ' + FloatToStr(gMinimapAngle));
gAngle := gAngle - gMinimapAngle;
gX := Round(gDistance * Sin(gAngle * Pi / 180)) + 648;
gY := Round(-gDistance * Cos(gAngle * Pi / 180)) + 84;
MouseFindFlag(gX, gY, 1, 1);
end;
Happy scripting!