Results 1 to 6 of 6

Thread: Walking to Exact Position

  1. #1
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Smile Walking to Exact Position

    Hi,
    I use SPS_Walk for walking, it is almost accurate but does not get you to the exact tile. So I added a procedure which will click on the Main Screen to get to the exact tile. I was wondering if the clicking on the Main Screen for walking is safe enough or will it get banned. Here is my code:
    Simba Code:
    Procedure walkToExactTile(originalPos: TPoint);
    var
      currentPos: TPoint;
      east, west, north, south: Array of Integer;
      dx, dy : Integer;
    begin
      east := [20, 10]; //first integer: distance from MSCX, second: Random
      west := [20, 10];
      north := [10, 10];
      south := [40, 10];

      SPS_Setup(RUNESCAPE_SURFACE, ['4_12']); //Could be any location

      if SPS_WalkToPos(originalPos) then
        writeln('SPS walk successful.')
      else
        begin
             writeln('SPS walk failed');
             exit;
        end;
      wait(1000);

      currentPos := SPS_GetMyPos;
      if currentpos=originalPos then
        exit;

      dx := currentPos.x-originalPos.x;
      dy := currentPos.y-originalPos.y;

      if dx<0 then
        begin
          writeln('Move east 1 tile');
          Mouse(MSCX+east[0]+random(east[1]), MSCY, 0, 5, mouse_Right);
          ChooseOption('alk here');
        end
      else if dx>0 then
        begin
          writeln('Move west 1 tile');
          Mouse(MSCX-(west[0]+random(west[1])), MSCY, 0, 5, mouse_Right);
          ChooseOption('alk here');
        end;
      wait(3000);

      if dy>0 then
        begin
          writeln('Move north 1 tile');
          Mouse(MSCX, MSCY-(north[0]+random(north[1])), 5, 0, mouse_Right);
          ChooseOption('alk here');
        end
      else if dy<0 then
        begin
          writeln('Move south 1 tile');
          Mouse(MSCX, MSCY+(south[0]+random(south[1])), 5, 0, mouse_Right);
          ChooseOption('alk here');
        end;
    end;
    Last edited by johnbrown8976; 04-20-2012 at 12:58 AM.

  2. #2
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    That's good, I might have to use that, if you'd let me.

    As long as the mouse is randomized, it won't be a problem.

  3. #3
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    That's good, I might have to use that, if you'd let me.

    As long as the mouse is randomized, it won't be a problem.
    Yup, feel free to use it. It works better on flat surfaces, works most of the time, sometimes failed in my experiments. But, I am still not able to make it move diagonal, I have to go one step at a time. If you get to try the script, and make it move diagonal, I would appreciate it.

  4. #4
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    In this case, it seems like it'd be fine, aside from it assuming you're withing one tile of the destination.

  5. #5
    Join Date
    Mar 2012
    Location
    Grambling, LA
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by nickrules View Post
    In this case, it seems like it'd be fine, aside from it assuming you're withing one tile of the destination.
    In all my trials, about 100, I was one tile (left, right, top, bottom or diagonal) away from the destination tile. I could use a while loop to move the character until it reaches the destination, if it is more than a tile away from the destination.

    I cannot move the character More Than One Tile At Once because the distance between more than one tiles is never constant: Slight slope or curves in the Main Screen Map will cause huge difference in distance.

  6. #6
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Helps my scripts a lot, where I need to be within a few tiles of said position, or finding the items fails.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •