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:
EDIT: Unrelated, but - Please note that GetSkillLevel/Info DOES NOT work, I'm currently trying to work on that.
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.