Gu3st...
2010-01-24 06:56:16
UPDATED 14th of May 2011!
Example on use:
The position (86, 62) is where the GE is on the mini-map in the map interface.

Here is an outdated sample video showing the script while walking:
http://www.youtube.com/watch?v=-lyzYBmrwF8
Start logged in
{$DEFINE Test_worldwalker_v2} // Remove this line if you plan on including it.
{$IFDEF Test_worldwalker_v2}
{$i SRL/SRL.scar}
{$ENDIF}
function IsWorldMapUp : Boolean;
var
tmp : String;
begin
Result := GetMMLevels('hp', tmp) = -1;
end;
procedure CloseWorldMap;
var
T : Integer;
begin
if not IsWorldMapUp then Exit;
Mouse(746, 15, 4, 4, True); // Click the close map button
T := GetSystemTime + 15000;
while (IsWorldMapUp) and (GetSystemTime < T) do
Wait(200+Random(500));
end;
function OpenWorldMap : Boolean;
var
T : Integer;
begin
Result := IsWorldMapUp;
if Result or (not LoggedIn) then Exit;
MouseBox(526, 124, 559, 157, mouse_Left); // Click the world map icon
Wait(3000);
T := GetSystemTime + 15000;
// GetColor = wait for loading worldmap is complete
while (GetColor(230, 196) = 1118604) and (GetSystemTime < T) do
Wait(500+Random(1500));
Result := GetSystemTime < T;
end;
function IsWorldMapMinimapUp : Boolean;
begin
Result := InRange(CountColor(clBlack, 609, 311, 757, 460), 6000, 10000);
end;
function OpenWorldMapMinimap : Boolean;
begin
Result := IsWorldMapMinimapUp;
if Result then Exit;
MouseBox(667, 470, 697, 490, mouse_Left);
Result := IsWorldMapMinimapUp;
end;
function SetWorldMapScale(Percent : Integer) : Boolean;
var
Percents : TIntegerArray;
curPercent, tarPercent : Integer;
begin
Result := False;
if not IsWorldMapUp then Exit;
Percents := [200, 100, 75, 50, 37];
case CountColor(clWhite, 704, 470, 740, 489) of
66: CurPercent := 0;
62: CurPercent := 1;
49: CurPercent := 2;
52: CurPercent := 3;
47: CurPercent := 4;
else
Exit;
end;
if not InIntArrayEx(Percents, tarPercent, Percent) then Exit;
while tarPercent <> curPercent do
begin
if tarPercent < curPercent then
begin
Dec(curPercent);
MouseBox(743, 465, 756, 478, mouse_Left)
end else
begin
Inc(curPercent);
MouseBox(743, 481, 756, 494, mouse_Left);
end;
Wait(100+Random(150));
end;
Result := True;
end;
function GetWorldMapPos(CloseTheWorldMap : Boolean) : TPoint;
var
X, Y : Integer;
begin
Result := Point(-1, -1);
if OpenWorldMap then
if OpenWorldMapMinimap then
if SetWorldMapScale(200) then
if FindColorTolerance(X, Y, 255, 609, 311, 757, 460, 5) then
begin
Result.X := X - 608; // Turn them into coordinates relative to the worlmap's minimap
Result.Y := Y - 310;
end;
if CloseTheWorldMap then CloseWorldMap;
end;
function WalkWorldMapPointFrom(sP, eP : TPoint; SafeMode : Boolean) : Boolean;
var
MapDistance, I : Integer;
RealAngle, Angle : Extended;
WalkPoint : TPoint;
begin
WriteLn('WalkWorldMapPointFrom: Walking from ' + ToStr(sP) + ' to ' + ToStr(eP));
Result := False;
if (not LoggedIn) and (not IsWorldMapUp) then Exit;
if IsWorldMapUp then CloseWorldMap;
if sP.X = -1 then
begin
Result := False;
Exit;
end;
if (sP.X = eP.X) and (sP.Y = eP.Y) then
begin
Result := True;
Exit;
end;
MapDistance := maxInt; //Just setting it to something > 1 so the while..do loop will not fail
while MapDistance > 1 do
begin
WriteLn('WalkWorldMapPointFrom: Walking from ' + ToStr(sP) + ' to ' + ToStr(eP));
MapDistance := Round(Distance(sP.X, sP.Y, eP.X, eP.Y) * 1.0);
RealAngle := Degrees(ArcTan2(sP.Y - eP.Y, sP.X - eP.X)) + 180.0;
while RealAngle > 360.0 do RealAngle := RealAngle - 360.0;
for I := 0 to MapDistance do
begin
Angle := RealAngle - rs_GetCompassAngleDegrees;
WalkPoint := RotatePoint(Point(MMCX + 50, MMCY), Radians(Angle), MMCX, MMCY);
Mouse(WalkPoint.X-2, WalkPoint.Y-2, 4, 4, True);
RunEnergy(30);
while IsMoving do
if InRange(FlagDistance,2, 20) then
Break
else
Wait(100);
end;
while IsMoving do
Wait(1000);
if SafeMode then
sP := GetWorldMapPos(True)
else
Break;
if sP.X = -1 then
begin
Result := False;
Exit;
end;
if (sP.X = eP.X) and (sP.Y = eP.Y) then
begin
Result := True;
Exit;
end;
end;
Result := True;
end;
function WalkWorldMapPoint(TargetPoint : TPoint; SafeMode : Boolean) : Boolean;
var
CurrentLocation : TPoint;
begin
Result := False;
if (not LoggedIn) and (not IsWorldMapUp) then Exit;
CurrentLocation := GetWorldMapPos(True);
Result := WalkWorldMapPointFrom(CurrentLocation, TargetPoint, SafeMode);
end;
function WalkWorldMapString(SearchString : String; SafeMode : Boolean) : Boolean;
var
CurrentLocation, TargetLocation : TPoint;
begin
Result := False;
if (not LoggedIn) and (not IsWorldMapUp) then Exit;
if OpenWorldMap then
if OpenWorldMapMinimap then
if SetWorldMapScale(200) then
begin
CurrentLocation := GetWorldMapPos(False);
if CurrentLocation.X = -1 then
begin
end;
MouseBox(98, 472, 320, 487, mouse_Left);
TypeSend(SearchString);
Wait(1000+Random(500));
TargetLocation := GetWorldMapPos(True);
Result := WalkWorldMapPointFrom(CurrentLocation, TargetLocation, SafeMode);
end;
end;
function WalkWorldMapPath(TargetPoints : TPointArray) : Boolean;
var
H, I : Integer;
begin
Result := False;
H := High(TargetPoints);
for I := 0 to H do
if not WalkWorldMapPoint(TargetPoints[I], False) then Break;
Result := True;
end;
function WalkWorldMapWeb(TargetConstant : Integer) : Boolean;
begin
// Not yet made.
Result := False;
end;
{$IFDEF Test_worldwalker_v2}
begin
SetupSRL;
//WriteLn(GetWorldMapPos(False));
WalkWorldMapString('arket', True);
WalkWorldMapString('d Exc', True);
WriteLn(GetWorldMapPos(True));
end.
{$ENDIF}Example on use:
WalkWorldMapString('d Exc', True);This will walk to the GE.The position (86, 62) is where the GE is on the mini-map in the map interface.

Here is an outdated sample video showing the script while walking:
http://www.youtube.com/watch?v=-lyzYBmrwF8
Start logged in