SRL Archive - SRL Archives

Procedure MakeCompassDegree;


Sumilion

2006-09-06 13:15:23

Well… time to get more advanced in the MakeCompass :) I made small, extremely small modifications to this procedure that appears to be written in chinese :tongue: . All it does extra besides changing the minimap to N, W, Z, E is that you can determine what degree you want it to change to. If you compare this one to the original you will only see changes in the first part :) As i said, the rest is in Chinese. I can see this being used in a sort of anti-ban, just see it as
MakeCompassDegree(Random(360));

and it will come up with a much more humanized position for the minimap… enough blable, let's get to the procedure :
{*******************************************************************************
procedure MakeCompassDegree(degree : integer);
degree: The direction in degrees
By: Lorax, edited by Sumilion
Description: Aligns RS to specified direction
*******************************************************************************}
procedure MakeCompassDegree(degree : integer);
var
rsAngle: Extended;
begin
if (not LoggedIn) then Exit;
degree := 360 - degree;
rsAngle := DetectRS2MinimapCompassAngle;
if (rsAngle = -1) then
begin
WriteLn('Could not find angle');
Exit;
end;
rsAngle := Abs(-rsAngle div Pi * 180);
if (rsAngle >= degree - 5) and
(rsAngle <= degree + 5) then
Exit;
if AngleDistance(degree, rsAngle) then
begin
KeyDown(VK_RIGHT);
repeat
Wait(15);
rsAngle := Abs(-DetectRS2MinimapCompassAngle div Pi * 180);
until (rsAngle >= degree - 5) and (rsAngle <= degree + 5);
KeyUp(VK_RIGHT);
end else
begin
KeyDown(VK_LEFT);
repeat
Wait(15);
rsAngle := Abs(-DetectRS2MinimapCompassAngle div Pi * 180);
until (rsAngle >= degree - 5) and (rsAngle <= degree + 5);
KeyUp(VK_LEFT);
end;
end;

Yakman

2006-09-06 14:37:26

good work, this really could be another addition to the antiban

you could add a modification which uses marktime( and timefrommark to make it something like "makecompassevery("

Sumilion

2006-09-06 16:18:40

Yup, i could do that, but im thinking ill just let the user do that.

Flyboy

2006-09-24 12:41:26

When using repeat/until consider adding a failsafe. If you used this on a super laggy computer you might get unpredictable results…

[COLOR=#000000][B]if[/B][/COLOR] AngleDistance(degree, rsAngle) [COLOR=#000000][B]then[/B][/COLOR]
[COLOR=#000000][B]begin
MarkTime(FailSafe);
[/B][/COLOR] KeyDown(VK_RIGHT);
[COLOR=#000000][B]repeat[/B][/COLOR]
Wait([COLOR=#000080]15[/COLOR]);
rsAngle := Abs(-DetectRS2MinimapCompassAngle [COLOR=#000000][B]div[/B][/COLOR] Pi * [COLOR=#000080]180[/COLOR]);
[COLOR=#000000][B]until[/B][/COLOR] ((rsAngle >= degree - [COLOR=#000080]5[/COLOR]) [COLOR=#000000][B]and[/B][/COLOR] (rsAngle <= degree + [COLOR=#000080]5[/COLOR])) or (TimeFromMark(FailSafe) > 45000);
KeyUp(VK_RIGHT);

Sumilion

2006-09-30 16:59:41

Lol, i never even touched that part, its already like that in the official SRL, well, maybe not anymore since there is a new MakeCompass, but it was in the old one, that's for sure :)