function WW_IsMapUp : Boolean; //By mixster. Thanks mixster :)
var tmp : String;
begin
Result := GetMMLevels('hp', tmp) = -1;
end;
procedure WW_CloseMap;
var T : Integer;
begin
if not WW_IsMapUp then Exit;
Mouse(740, 10, 16, 16, True);
T := GetSystemTime + 15000;
while WW_IsMapUp and (GetSystemTime < T) do
Wait(500);
Wait(500);
end;
function WW_OpenWorldmap : Boolean;
var T : Integer;
begin
if WW_IsMapUp then
begin
Result := True;
Exit;
end;
MouseBox(527, 139, 559, 156, 1);
Wait(1500);
T := GetSystemTime + 15000;
while (GetColor(230, 196) = 1118604) and (GetSystemTime < T) do
Wait(200);
Result := GetSystemTime < T;
end;
function WW_GetPos(var X, Y : Integer) : Boolean;
begin
Result := False;
if WW_OpenWorldmap then
begin
if GetColor(712, 475) = 16777215 then
MouseBox(742, 464, 757, 479, 1);
if GetColor(606, 308) <> 5860213 then
MouseBox(666, 469, 698, 491, 1);
Result := FindColor(X, Y, 255, 609, 311, 757, 460);
if not Result then
WW_CloseMap;
end;
end;
//WW_Walk(Point(705, 373)); will walk to GE
function WW_Walk(Loc : TPoint) : Boolean;
var
MapDist, I, X, Y : Integer;
Angle, FAngle : Extended;
WalkPoint, Cur : TPoint;
begin
repeat
if WW_IsMapUp then
begin
if FindColor(X, Y, 9100798, 6, 6, 757, 460) then
begin
Mouse(X, Y, 90, 14, True);
Wait(1500);
end else
WW_CloseMap;
end;
WW_OpenWorldmap;
WW_GetPos(Cur.X, Cur.Y);
WW_CloseMap;
MapDist := Distance(Cur.X, Cur.Y, Loc.X, Loc.Y);
Angle := Degrees(ArcTan2(Cur.Y - Loc.Y, Cur.X - Loc.X));
Angle := Angle + 180;
if Angle > 360 then Angle := Angle - 360;
for I := 1 to MapDist do
begin
FAngle := Angle - rs_GetCompassAngleDegrees;
WalkPoint := RotatePoint(Point(MMCX + 60, MMCY), Radians(FAngle), MMCX, MMCY);
Mouse(WalkPoint.X-2, WalkPoint.Y-2, 4, 4, True);
RunEnergy(30);
while IsMoving do
if (FlagDistance < 20) and (FlagDistance > 0) then Break;
Wait(150);
end;
while IsMoving do
Wait(100);
until(MapDist < 1)
SetAngle(True);
Result := True;
end;
//WW_WalkToLocation('Varrock');
function WW_WalkToLocation(SearchString : String) : Boolean;
var
TargetPos : TPoint;
begin
Result := False;
if WW_OpenWorldmap then
begin
MouseBox(98, 472, 320, 487, 1);
TypeSend(SearchString);
Wait(1000+Random(500));
if not WW_GetPos(TargetPos.X, TargetPos.Y) then Exit;
Result := WW_Walk(TargetPos);
end;
end;
This is the most up to date version
EDIT: Remember to credit if you use!