SRL Archive - SRL Archives

MakeCompass - affected by the update.


Naum

2009-09-17 19:58:26

The Runecape compass now has an option of when clicked on, will instantly 'perfect' north.

The edit, posted below, uses that. If the input is 'n' then the script will Random(3): 1,0 - click on the compass, 2 - right click and select option. Otherwise if it is '0' then the script will 'keydown and keyup' it to the position :).

The edit also had the KeyUp and KeyDown, stuffs shortened using Integer();. Also some of the waits were removed:

Function MakeCompass(Direction: Variant): Boolean;
Var
StartAngle, Angle, DirectionDeg, i: Extended;
Left: Boolean;
Mark: Integer;
Begin
StartAngle := (rs_GetCompassAngleDegrees);
if (StartAngle < 0) or (not LoggedIn) then Exit;
case VarType(Direction) of
3, 5: DirectionDeg := FixD(Direction + 0.0);
256: try
DirectionDeg := FixD(StrToFloat(Direction));
except
case LowerCase(Direction) of
'n': Begin
Result := (MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0;
If Result Then Exit;
If Random(3) = 2 Then
Begin
MouseBox(528, 11, 555, 38, 2);
Result := WaitOption('orth', 1200);
End Else
MouseBox(528, 11, 555, 38, 1);

Result := True;
Exit;
End;
'w': DirectionDeg := 270;
's': DirectionDeg := 180;
'e': DirectionDeg := 90;
'random', 'rand': DirectionDeg := RandomRange(0, 360);
end;
end;
end;
Result := (MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0;
If Result Then Exit;
Left := (Round((360 - StartAngle) + DirectionDeg) mod 360 <= Round((StartAngle + 360) - DirectionDeg) mod 360);
KeyDown((Integer(Not Left)*2) + 37);
MarkTime(Mark);
repeat
Wait(1);
Angle:= rs_GetCompassAngleDegrees;
if ((TimeFromMark(Mark) > 6000) and (i < 1.0)) or
((TimeFromMark(Mark) > 10000) and (i < 2.0)) or
((TimeFromMark(Mark) > 14000) and (i < 3.0)) then
begin
i := i + 1.0;
end;
until ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i))
or (TimeFromMark(Mark) > 14000)
or (Angle < 0);
KeyUp((Integer(Not Left)*2) + 37);
Result := ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i));
End;


EDIT: Unrelated, but - Please note that GetSkillLevel/Info DOES NOT work, I'm currently trying to work on that.

Gu3st...

2009-09-17 20:00:23

Couldn't you just do
'n': begin Result := True; MouseBox(528, 11, 555, 38, 1); Exit; end;
and get rid of North : Boolean?

marpis

2009-09-17 20:03:53

wow this is really awesome, makes radialwalking so much easier :)
edit: it also sets angle low… they shouldn't have made it instant, it looks very stupid when you click it :-/
it'd be way cooler if it would just turn the camera fast, and take like 0.5 sec so it'd go smoothly

Naum

2009-09-17 20:07:54

From: Zyt3x
Couldn't you just do
'n': begin Result := True; MouseBox(528, 11, 555, 38, 1); Exit; end;
and get rid of North : Boolean?


Umm, could do, however I would have to replicate 2 lines:

Result := (MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0;
If Result Then Exit;

And add that to the case. But nevertheless, it is a good idea (kinda overlooked that :p, Thanks). Updated first post :).

It's 4 lines longer though, for the sakes of randomness :/

Gu3st...

2009-09-17 20:23:13

Good job :)
this should be committed

Main

2009-09-18 23:26:42

TBH, does real players use them?

ZephyrsFury

2009-09-19 16:12:08

Doesn't this set cam angle to lowest for you too?

BobboHobbo

2009-09-19 16:18:35

From: ZephyrsFury
Doesn't this set cam angle to lowest for you too?


I dont think it sets the lowest but it does set it inbetween the lowest and highest angle.