Page 6 of 7 FirstFirst ... 4567 LastLast
Results 126 to 150 of 171

Thread: [NEED TESTING!] SPS-OSR (2007Scape)

  1. #126
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Haxz View Post
    I have thought of making something like this, but didn't have the idea of using just vertical and horizontal wall. This would be a very useful procedure! I like the idea and the DTMs can be easily changed to a wall angle that I wanted. Would try to use this procedure in my fighter to bank.

    Btw, hows the ObjDTM fix doing so far?
    Not so well. I had a few ObjDTMs detected for a few days (detected on separately 15+ spawned SMARTS) and then the next day none of them were detected. Let's hope 'ol euphemism has better news because I'm running out of patience.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  2. #127
    Join Date
    Apr 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmm

  3. #128
    Join Date
    Nov 2011
    Posts
    335
    Mentioned
    0 Post(s)
    Quoted
    68 Post(s)

    Default

    just made a path. In towns it seems to missclick west like 10-5 pixels, this happens with more than half of the clicks it makes on MM. It gets lost too pretty easily...

  4. #129
    Join Date
    Nov 2011
    Posts
    335
    Mentioned
    0 Post(s)
    Quoted
    68 Post(s)

    Default

    just made a path. In towns it seems to missclick west like 10-5 pixels, this happens with more than half of the clicks it makes on MM. It gets lost too pretty easily...

    E: when there are more than 5 ppl on the map, it wont start moving at all.

  5. #130
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Hey guys. So previously I tried over and over to use Wizzup?'s old 'GetWallAngle' to work correctly in order to force our MiniMap into a perfect(ish) north for accurate SPS detection. Unfortunately the function is outdated and I simply could not fix it. So as an alternative I made a quick 10-minute procedure that will attempt to set your compass to perfect north. It simply rotates your compass (in the same way of the normal 'MakeCompass') while searching for both a straight horizontal wall and a straight vertical wall (10-12 in length). If either are found it's assumed the the compass has been aligned to perfect(ish) north.

    It's dirty way of aligning the map but it's worked great for me so far and has improved my SPS accuracy by a huge amount.

    I simply call this procedure right before walking a path in SPS, and I'd recommend any users doing the same. So...any thoughts or suggestions?

    Edit:
    Oh yes, obviously this will only work in an area with walls visible on the minimap.

    Edit2:
    Fixed a silly typo as well as improved the DTMs.
    Love this here

    It sometimes tries to force the map at West though

    Creds to DannyRS for this wonderful sig!

  6. #131
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    Love this here

    It sometimes tries to force the map at West though
    Ok, so through further progressing I advanced the function to use a much more practical method. I hope you'll like what I did here as I'm quite pleased with the ingenuity.

    Before we had two static DTMs; one of a vertical wall and one of a horizontal wall, both about 12 in length. Like I said this was a sloppy way of doing it.

    So, what I've done is created two new functions to aid the 'ForceMapNorth' function. The first of which will find the longest wall on your minimap, no matter what angle you're at. It search both horizontal and vertical. The second function generates an absolute DTM of a straight-line wall. You feed this function what wall type you want (1 for vertical, 2 for horizontal) and the length of the wall and it will generate a perfect wall DTM for you. Later these two function work together to auto-generate a perfect DTM of the longest wall (both vertical and horizontal) on your MM and these two DTMs are fed into the ForceMapNorth function. Now, in this new version of the function I chose to generate DTMs of only 70% of the longest wall but of course this could be changed back to 100% of the longest wall, if one chooses.

    Also, in this new version of ForceMapNorth there's a more accurate way of rotating the map and it will not rotate as far as before. Also if the DTM is not found in the first direction it rotates it should try again in the opposite direction, starting from North. If the DTM is not found in either direction it will revert your compass back to the default North position.

    Simba Code:
    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength(WallType: Integer): Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.
      -WallType: 1 for vertical walls, 2 for horizontal walls
    *******************************************************************************}

    function GetLongestWallLength(WallType: Integer): Integer;
    var
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      if (WallType = 1) then
        SplitTPAExWrap(TPA, 2, 5, ATPA)
      else
        SplitTPAExWrap(TPA, 5, 2, ATPA);

      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      if (WallType = 1) then
        Result := (B.Y2-B.Y1)
      else
        Result := (B.X2-B.X1);
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L1,L2: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L1 := GetLongestWallLength(1);
      L2 := GetLongestWallLength(2);
      if (L1 > 50) then
        L1 := 50;
      if (L2 > 50) then
        L2 := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L1*0.85));  //Create a DTM 85% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L2*0.85));  //Create a DTM 85% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      MarkTime(T);
      Repeat
        TypeByte((Ord(not Left) * 2) + 37);  //No holding down, actually press the arrow key
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;
    Last edited by Flight; 05-06-2013 at 04:36 AM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  7. #132
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ok, so through further progressing I advanced the function to use a much more practical method. I hope you'll like what I did here as I'm quite pleased with the ingenuity.

    Before we had two static DTMs; one of a vertical wall and one of a horizontal wall, both about 12 in length. Like I said this was a sloppy way of doing it.

    So, what I've done is created two new functions to aid the 'ForceMapNorth' function. The first of which will find the longest wall on your minimap, no matter what angle you're at. It search both horizontal and vertical. The second function generates an absolute DTM of a straight-line wall. You feed this function what wall type you want (1 for vertical, 2 for horizontal) and the length of the wall and it will generate a perfect wall DTM for you. Later these two function work together to auto-generate a perfect DTM of the longest wall (both vertical and horizontal) on your MM and these two DTMs are fed into the ForceMapNorth function. Now, in this new version of the function I chose to generate DTMs of only 70% of the longest wall but of course this could be changed back to 100% of the longest wall, if one chooses.

    Also, in this new version of ForceMapNorth there's a more accurate way of rotating the map and it will not rotate as far as before. Also if the DTM is not found in the first direction it rotates it should try again in the opposite direction, starting from North. If the DTM is not found in either direction it will revert your compass back to the default North position.

    Simba Code:
    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength: Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.  This
      number is based off both vertical and horizontal walls.
    *******************************************************************************}

    function GetLongestWallLength: Integer;
    var
      B: TBox;
      L1,L2: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

    {Find all vertical walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 2, 5, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.Y2-B.Y1);

    {Rinse}
      TPA := [];
      ATPA := [];
      B := IntToBox(0, 0, 0, 0);

    {Find all horizontal walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 5, 2, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.X2-B.X1);

      if (L1 > L2) then
        Result := L1
      else
        Result := L2;
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L := GetLongestWallLength;
      if (L > 50) then
        L := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L*0.7));  //Create a DTM 70% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L*0.7));  //Create a DTM 70% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      KeyDown((Ord(not Left) * 2) + 37);
      MarkTime(T);
      Repeat
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      if Left then
        KeyUp(VK_Left)
      else
        KeyUp(VK_Right);

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;
    I want to kiss you right now!

    My flaxpicker is afk-able now No more hiccups with SPS Walking
    Last edited by Sjoe; 05-06-2013 at 02:03 AM.

    Creds to DannyRS for this wonderful sig!

  8. #133
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ok, so through further progressing I advanced the function to use a much more practical method. I hope you'll like what I did here as I'm quite pleased with the ingenuity.

    Before we had two static DTMs; one of a vertical wall and one of a horizontal wall, both about 12 in length. Like I said this was a sloppy way of doing it.

    So, what I've done is created two new functions to aid the 'ForceMapNorth' function. The first of which will find the longest wall on your minimap, no matter what angle you're at. It search both horizontal and vertical. The second function generates an absolute DTM of a straight-line wall. You feed this function what wall type you want (1 for vertical, 2 for horizontal) and the length of the wall and it will generate a perfect wall DTM for you. Later these two function work together to auto-generate a perfect DTM of the longest wall (both vertical and horizontal) on your MM and these two DTMs are fed into the ForceMapNorth function. Now, in this new version of the function I chose to generate DTMs of only 70% of the longest wall but of course this could be changed back to 100% of the longest wall, if one chooses.

    Also, in this new version of ForceMapNorth there's a more accurate way of rotating the map and it will not rotate as far as before. Also if the DTM is not found in the first direction it rotates it should try again in the opposite direction, starting from North. If the DTM is not found in either direction it will revert your compass back to the default North position.

    Simba Code:
    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength: Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.  This
      number is based off both vertical and horizontal walls.
    *******************************************************************************}

    function GetLongestWallLength: Integer;
    var
      B: TBox;
      L1,L2: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

    {Find all vertical walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 2, 5, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.Y2-B.Y1);

    {Rinse}
      TPA := [];
      ATPA := [];
      B := IntToBox(0, 0, 0, 0);

    {Find all horizontal walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 5, 2, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.X2-B.X1);

      if (L1 > L2) then
        Result := L1
      else
        Result := L2;
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L := GetLongestWallLength;
      if (L > 50) then
        L := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L*0.7));  //Create a DTM 70% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L*0.7));  //Create a DTM 70% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      KeyDown((Ord(not Left) * 2) + 37);
      MarkTime(T);
      Repeat
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      if Left then
        KeyUp(VK_Left)
      else
        KeyUp(VK_Right);

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;
    This is genius

    If possible, can you post an example walking procedure with these functions?

  9. #134
    Join Date
    Dec 2007
    Posts
    174
    Mentioned
    0 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ok, so through further progressing I advanced the function to use a much more practical method. I hope you'll like what I did here as I'm quite pleased with the ingenuity.

    Before we had two static DTMs; one of a vertical wall and one of a horizontal wall, both about 12 in length. Like I said this was a sloppy way of doing it.

    So, what I've done is created two new functions to aid the 'ForceMapNorth' function. The first of which will find the longest wall on your minimap, no matter what angle you're at. It search both horizontal and vertical. The second function generates an absolute DTM of a straight-line wall. You feed this function what wall type you want (1 for vertical, 2 for horizontal) and the length of the wall and it will generate a perfect wall DTM for you. Later these two function work together to auto-generate a perfect DTM of the longest wall (both vertical and horizontal) on your MM and these two DTMs are fed into the ForceMapNorth function. Now, in this new version of the function I chose to generate DTMs of only 70% of the longest wall but of course this could be changed back to 100% of the longest wall, if one chooses.

    Also, in this new version of ForceMapNorth there's a more accurate way of rotating the map and it will not rotate as far as before. Also if the DTM is not found in the first direction it rotates it should try again in the opposite direction, starting from North. If the DTM is not found in either direction it will revert your compass back to the default North position.

    Simba Code:
    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength: Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.  This
      number is based off both vertical and horizontal walls.
    *******************************************************************************}

    function GetLongestWallLength: Integer;
    var
      B: TBox;
      L1,L2: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

    {Find all vertical walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 2, 5, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.Y2-B.Y1);

    {Rinse}
      TPA := [];
      ATPA := [];
      B := IntToBox(0, 0, 0, 0);

    {Find all horizontal walls and sort by size}
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      SplitTPAExWrap(TPA, 5, 2, ATPA);
      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      L1 := (B.X2-B.X1);

      if (L1 > L2) then
        Result := L1
      else
        Result := L2;
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L := GetLongestWallLength;
      if (L > 50) then
        L := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L*0.7));  //Create a DTM 70% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L*0.7));  //Create a DTM 70% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      KeyDown((Ord(not Left) * 2) + 37);
      MarkTime(T);
      Repeat
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      if Left then
        KeyUp(VK_Left)
      else
        KeyUp(VK_Right);

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;
    awesome!! can i test this in my script?

  10. #135
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Haxz View Post
    This is genius

    If possible, can you post an example walking procedure with these functions?
    Yeah here's an example script that should walk you from the AlKharid bank to the fire altar, then back to the bank. Unfortunately my current SMART client has radical MM colors and SPS cannot determine my location so I couldn't test this.

    Simba Code:
    {$DEFINE SMART8}
    {$i SRL-OSR/SRL.Simba}
    {$i SPS/SPS-OSR.simba}


    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name        := '';
        Pass        := '';
        Nick        := '';
        Pin         := '';
        LampSkill   := Skill_Herblore;
        WorldInfo   := [];
        Member      := True;
        Active      := True;
      end;
    end;

    Function InvertPath(Points: TPointArray): TPointArray;
    Var
      i, j: integer;
    begin
      SetLength(Result, Length(Points));
      j := 0;
      for i := High(Points) downto 0 do
      begin
        Result[j] := Points[i];
        Inc(j);
      end;
    end;

    Function IsMoving_F: Boolean;
    begin
      Result := PixelShift(IntToBox(MMCX-30, MMCY-30, MMCX+30, MMCY+30), 200) > 200;
    end;

    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength(WallType: Integer): Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.
      -WallType: 1 for vertical walls, 2 for horizontal walls
    *******************************************************************************}

    function GetLongestWallLength(WallType: Integer): Integer;
    var
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      if (WallType = 1) then
        SplitTPAExWrap(TPA, 2, 5, ATPA)
      else
        SplitTPAExWrap(TPA, 5, 2, ATPA);

      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      if (WallType = 1) then
        Result := (B.Y2-B.Y1)
      else
        Result := (B.X2-B.X1);
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L1,L2: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L1 := GetLongestWallLength(1);
      L2 := GetLongestWallLength(2);
      if (L1 > 50) then
        L1 := 50;
      if (L2 > 50) then
        L2 := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L1*0.85));  //Create a DTM 85% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L2*0.85));  //Create a DTM 85% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      MarkTime(T);
      Repeat
        TypeByte((Ord(not Left) * 2) + 37);  //No holding down, actually press the arrow key
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;

    function WalkPath_F(Path: TPointArray): boolean;
    var
      I, H, T, D, Fails: integer;
      P, MM, MMF: TPoint;
    begin
      ColorToleranceSpeed(1);
      H := High(Path);
      T := GetSystemTime + 11000 + Random(2000);
      Fails := 0;

      ForceMapNorth;
      RunEnergy(70);
      while (not Result) and (GetSystemTime < T) and (Fails < 5) do
      begin
        FindNormalRandoms;
        if (not LoggedIn()) then
          Exit;

        P := SPS_GetMyPos();

        for I := H downto 0 do
        begin
          MM := RotatePoint(Point(MMCX + Path[I].X - P.X, MMCY + Path[I].Y - P.Y), 0-(Radians((Round(rs_GetCompassAngleDegrees + DF) mod 360))), MMCX, MMCY);

          if MM = MMF then
            Inc(Fails);

          D := Distance(MM.X, MM.Y, MMCX, MMCY);

          if (D < 10) then
            break
          else
            if (D < 70) then
            begin
              Mouse(MM.X, MM.Y, 0, 0, mouse_left);
              WaitFunc(@IsMoving_F, 10, 2500);
              MMF := MM;
              FFlag(30);

              T := getSystemTime + 11000 + Random(2000);
                Break;
            end;
        end;
        if (I = H) then
          While IsMoving_F do
            Wait(1);
        Result := (I = H);
      end;
    end;

    Var
      Path_BankToAltar: TPointArray;

    begin
      DeclarePlayers;
      SetupSRL;
      SRL_CombatRandoms := False;

      SPS_Setup(runescape_surface, ['alkharidpath']);
      //SPS_AnyAngle := True;  //No need

      Path_BankToAltar := [Point(75,414), Point(93,408), Point(111,378), Point(120,348),
                            Point(126,312), Point(130,264), Point(159,228), Point(183,195),
                            Point(201,162), Point(208,126), Point(225,93), Point(240,72)];

      WalkPath_F(Path_BankToAltar);
      WalkPath_F(InvertPath(Path_BankToAltar));
    end.

    And here's the SPS image (you'll need to stick this in with the other 07 SPS maps):



    Oh and by the way, I made a slight modification to both 'GetLongestWallLength' as well as ForceMapNorth. Now, we grab the longest wall lengths separately for each wall type rather than the longest wall is made into both a vertical and horizontal wall, instead now the two DTMs will be relevant to their own length. Also in the ForceMapNorth function it no long holds down the arrow key but instead presses it. This is less human-like, yes, but it should give us more accuracy in finding the wall DTMs. I've updated the post above with these two modified functions.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  11. #136
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Yeah here's an example script that should walk you from the AlKharid bank to the fire altar, then back to the bank. Unfortunately my current SMART client has radical MM colors and SPS cannot determine my location so I couldn't test this.
    ForceMapNorth; is still a bit buggy for me it rotates the map a lot of times.

    Creds to DannyRS for this wonderful sig!

  12. #137
    Join Date
    Apr 2013
    Posts
    19
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    How do I download the SPS Simba file as a ZIP so I can put it in the folder.......?

  13. #138
    Join Date
    Jan 2012
    Location
    Texas
    Posts
    241
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Yeah here's an example script that should walk you from the AlKharid bank to the fire altar, then back to the bank. Unfortunately my current SMART client has radical MM colors and SPS cannot determine my location so I couldn't test this.

    Simba Code:
    {$DEFINE SMART8}
    {$i SRL-OSR/SRL.Simba}
    {$i SPS/SPS-OSR.simba}


    Procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name        := '';
        Pass        := '';
        Nick        := '';
        Pin         := '';
        LampSkill   := Skill_Herblore;
        WorldInfo   := [];
        Member      := True;
        Active      := True;
      end;
    end;

    Function InvertPath(Points: TPointArray): TPointArray;
    Var
      i, j: integer;
    begin
      SetLength(Result, Length(Points));
      j := 0;
      for i := High(Points) downto 0 do
      begin
        Result[j] := Points[i];
        Inc(j);
      end;
    end;

    Function IsMoving_F: Boolean;
    begin
      Result := PixelShift(IntToBox(MMCX-30, MMCY-30, MMCX+30, MMCY+30), 200) > 200;
    end;

    {*******************************************************************************
    Function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    By: Flight
    Description: Creates a DTM of a perfectly straight wall.
      -WallType  : 1 for vertical, 2 for horizontal
      -WallLength: Length of the DTM to be generated
    *******************************************************************************}

    function GenerateWallDTM(WallType, WallLength: Integer): Integer;
    var
      i: Integer;
      TempTDTM: TDTM;
      mPnt: TDTMPointDef;
      sPnts: array of TDTMPointDef;
    begin
      SetArrayLength(sPnts, (WallLength-1));
      mPnt.x := 0;
      mPnt.y := 0;
      mPnt.AreaSize := 0;
      mPnt.AreaShape := 0;
      mPnt.Color := 16119287;
      mPnt.Tolerance := 40;

      for i:=0 to High(sPnts) do
      begin
        case WallType of
          1:
            begin
              sPnts[i].x := 0;
              sPnts[i].y := i+1;
            end;
          2:
            begin
              sPnts[i].x := i+1;
              sPnts[i].y := 0;
            end;
        end;
        sPnts[i].AreaSize := 0;
        sPnts[i].AreaShape := 0;
        sPnts[i].Color := 16119287;
        sPnts[i].Tolerance := 40;
      end;

      TempTDTM.MainPoint := mPnt;
      TempTDTM.SubPoints := sPnts;
      Result := AddDTM(TempTDTM);
    end;

    {*******************************************************************************
    Function GetLongestWallLength(WallType: Integer): Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.
      -WallType: 1 for vertical walls, 2 for horizontal walls
    *******************************************************************************}

    function GetLongestWallLength(WallType: Integer): Integer;
    var
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      if (WallType = 1) then
        SplitTPAExWrap(TPA, 2, 5, ATPA)
      else
        SplitTPAExWrap(TPA, 5, 2, ATPA);

      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      if (WallType = 1) then
        Result := (B.Y2-B.Y1)
      else
        Result := (B.X2-B.X1);
    end;

    {*******************************************************************************
    Function ForceMapNorth: Boolean;
    By: Flight
    Description: Using auto-generated wall DTMs, this function will attempt to
      rotate the compass to near-perfect north.  Should it fail it will revert
      back to default north.
    *******************************************************************************}

    Function ForceMapNorth: Boolean;
    var
      Left: Boolean;
      StartAngle: Extended;
      X,Y,DTM_VertWall,
      DTM_HorWall,T,F,L1,L2: Integer;
    label
      Start,FuncEnd;
    begin
      Result := False;
      L1 := GetLongestWallLength(1);
      L2 := GetLongestWallLength(2);
      if (L1 > 50) then
        L1 := 50;
      if (L2 > 50) then
        L2 := 50;

      DTM_VertWall := GenerateWallDTM(1, Round(L1*0.85));  //Create a DTM 85% of the length of the longest vertical wall
      DTM_HorWall  := GenerateWallDTM(2, Round(L2*0.85));  //Create a DTM 85% of the length of the longest horizontal wall

      if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
      begin
        Result := True;
        GoTo FuncEnd;
      end;

      StartAngle := (rs_GetCompassAngleDegrees);
      Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);

      Start:
      if (F > 0) then
        MakeCompass('N');

      MarkTime(T);
      Repeat
        TypeByte((Ord(not Left) * 2) + 37);  //No holding down, actually press the arrow key
        if (FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2) or
            FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2)) then
              break;
      Until(TimeFromMark(T) >= 1000)

      FuncEnd:
      if ((not FindDTM(DTM_VertWall, X, Y, MMx1, MMy1, MMx2, MMy2)) and
          (not FindDTM(DTM_HorWall, X, Y, MMx1, MMy1, MMx2, MMy2))) then
      begin
        Inc(F);
        StartAngle := (rs_GetCompassAngleDegrees);
        Left := (Round((360 - StartAngle)) mod 360 <= Round((StartAngle + 360)) mod 360);
        if (F < 2) then
          GoTo Start;
      end else if ((X > 1) and (Y > 1)) then
        Result := True;

      if not Result then
        MakeCompass('N');
      FreeDTM(DTM_VertWall);
      FreeDTM(DTM_HorWall);
    end;

    function WalkPath_F(Path: TPointArray): boolean;
    var
      I, H, T, D, Fails: integer;
      P, MM, MMF: TPoint;
    begin
      ColorToleranceSpeed(1);
      H := High(Path);
      T := GetSystemTime + 11000 + Random(2000);
      Fails := 0;

      ForceMapNorth;
      RunEnergy(70);
      while (not Result) and (GetSystemTime < T) and (Fails < 5) do
      begin
        FindNormalRandoms;
        if (not LoggedIn()) then
          Exit;

        P := SPS_GetMyPos();

        for I := H downto 0 do
        begin
          MM := RotatePoint(Point(MMCX + Path[I].X - P.X, MMCY + Path[I].Y - P.Y), 0-(Radians((Round(rs_GetCompassAngleDegrees + DF) mod 360))), MMCX, MMCY);

          if MM = MMF then
            Inc(Fails);

          D := Distance(MM.X, MM.Y, MMCX, MMCY);

          if (D < 10) then
            break
          else
            if (D < 70) then
            begin
              Mouse(MM.X, MM.Y, 0, 0, mouse_left);
              WaitFunc(@IsMoving_F, 10, 2500);
              MMF := MM;
              FFlag(30);

              T := getSystemTime + 11000 + Random(2000);
                Break;
            end;
        end;
        if (I = H) then
          While IsMoving_F do
            Wait(1);
        Result := (I = H);
      end;
    end;

    Var
      Path_BankToAltar: TPointArray;

    begin
      DeclarePlayers;
      SetupSRL;
      SRL_CombatRandoms := False;

      SPS_Setup(runescape_surface, ['alkharidpath']);
      //SPS_AnyAngle := True;  //No need

      Path_BankToAltar := [Point(75,414), Point(93,408), Point(111,378), Point(120,348),
                            Point(126,312), Point(130,264), Point(159,228), Point(183,195),
                            Point(201,162), Point(208,126), Point(225,93), Point(240,72)];

      WalkPath_F(Path_BankToAltar);
      WalkPath_F(InvertPath(Path_BankToAltar));
    end.

    And here's the SPS image (you'll need to stick this in with the other 07 SPS maps):



    Oh and by the way, I made a slight modification to both 'GetLongestWallLength' as well as ForceMapNorth. Now, we grab the longest wall lengths separately for each wall type rather than the longest wall is made into both a vertical and horizontal wall, instead now the two DTMs will be relevant to their own length. Also in the ForceMapNorth function it no long holds down the arrow key but instead presses it. This is less human-like, yes, but it should give us more accuracy in finding the wall DTMs. I've updated the post above with these two modified functions.
    I can't seem to get it to work over in Port Phasmatys around the bank.
    Coming together is a beginning.
    Keeping together is progress.
    Working together is success.

  14. #139
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    i always get: SPS returns -1, -1

    any tips?

  15. #140
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    ForceMapNorth; is still a bit buggy for me it rotates the map a lot of times.
    Quote Originally Posted by Spiker View Post
    I can't seem to get it to work over in Port Phasmatys around the bank.
    Ok you guys, replace your 'GetLongestWallLength' with this one:

    Simba Code:
    {*******************************************************************************
    Function GetLongestWallLength(WallType: Integer): Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.
      -WallType: 1 for vertical walls, 2 for horizontal walls
    *******************************************************************************}

    function GetLongestWallLength(WallType: Integer): Integer;
    var
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      RAaSTPA(TPA, 1);
      if (WallType = 1) then
        SplitTPAExWrap(TPA, 2, 3, ATPA)
      else
        SplitTPAExWrap(TPA, 3, 2, ATPA);

      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      if (WallType = 1) then
        Result := (B.Y2-B.Y1)
      else
        Result := (B.X2-B.X1);
    end;

    Quote Originally Posted by hoodz View Post
    i always get: SPS returns -1, -1

    any tips?
    Yeah, you're better off making custom SPS maps. The '07 maps that come with that unofficial OSR-SPS are really low quality compared to the real RS minimap. If you're really determined to use SPS then I'd suggest you take a look at this RSPS map-editor. It's a cache version of the RS map from sometime in 2006 so it contains most of the current 07 map. You'll have to load areas region by region and take snapshots of the minimap printed then peice them together but it's faster than using the minimap in OSR and it's very high quality compared to the SPS maps.
    Last edited by Flight; 05-12-2013 at 12:33 PM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  16. #141
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ok you guys, replace your 'GetLongestWallLength' with this one:

    Simba Code:
    {*******************************************************************************
    Function GetLongestWallLength(WallType: Integer): Integer;
    By: Flight
    Description: Determines the longest wall on your MM at any compass angle.
      -WallType: 1 for vertical walls, 2 for horizontal walls
    *******************************************************************************}

    function GetLongestWallLength(WallType: Integer): Integer;
    var
      B: TBox;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 16119287, MMX1, MMY1, MMX2, MMY2, 40);
      if (Length(TPA)<1) then
        Exit;

      RAaSTPA(TPA, 1);
      if (WallType = 1) then
        SplitTPAExWrap(TPA, 2, 3, ATPA)
      else
        SplitTPAExWrap(TPA, 3, 2, ATPA);

      SortATPASize(ATPA, True);
      B := GetTPABounds(ATPA[0]);
      if (WallType = 1) then
        Result := (B.Y2-B.Y1)
      else
        Result := (B.X2-B.X1);
    end;



    Yeah, you're better off making custom SPS maps. The '07 maps that come with that unofficial OSR-SPS are really low quality compared to the real RS minimap. If you're really determined to use SPS then I'd suggest you take a look at this RSPS map-editor. It's a cache version of the RS map from sometime in 2006 so it contains most of the current 07 map. You'll have to load areas region by region and take snapshots of the minimap printed then peice them together but it's faster than using the minimap in OSR and it's very high quality compared to the SPS maps.
    Thanks im going to try that! Are there also other ways to walk? ddtm walking dont seem to work because its a green/brown colour only area.

  17. #142
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    Thanks im going to try that! Are there also other ways to walk? ddtm walking dont seem to work because its a green/brown colour only area.
    In OSR it's very difficult to walk, mainly due to the violent color changes after every region change. But actually there's 3 weapons used against color bots for the minimap alone. First is the angle will change degrees at random times, whether your map region changes or not. The second is, as I stated before, the extreme changes in MM colors. And the last anti-bot measure for the MM is the zoom; you'll notice that the MM will actually zoom in/out a small amount at random times as well.

    Between these 3 it's an absolute pain to make a minimap-walker both accurate and stable. There's a few ways to walk in OSR but none really classify as both accurate and stable. You can use (D)DTMs, RadialWalking (this in combination with AutoColoring I heard works well), ObjectDTMs (made for the current RS but you can modify them to work for OSR; still not 100% stable though) and SPS (highly suggest using custom maps). It's frustrating I know; I couldn't get my Naturez script to run for more than 30 minutes before SPS start walking to odd places, and that's using 2 separate high-quality area maps.

    It's a reason why I've been spending time trying to understand reflection & getting it to work in SMART.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  18. #143
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    In OSR it's very difficult to walk, mainly due to the violent color changes after every region change. But actually there's 3 weapons used against color bots for the minimap alone. First is the angle will change degrees at random times, whether your map region changes or not. The second is, as I stated before, the extreme changes in MM colors. And the last anti-bot measure for the MM is the zoom; you'll notice that the MM will actually zoom in/out a small amount at random times as well.

    Between these 3 it's an absolute pain to make a minimap-walker both accurate and stable. There's a few ways to walk in OSR but none really classify as both accurate and stable. You can use (D)DTMs, RadialWalking (this in combination with AutoColoring I heard works well), ObjectDTMs (made for the current RS but you can modify them to work for OSR; still not 100% stable though) and SPS (highly suggest using custom maps). It's frustrating I know; I couldn't get my Naturez script to run for more than 30 minutes before SPS start walking to odd places, and that's using 2 separate high-quality area maps.

    It's a reason why I've been spending time trying to understand reflection & getting it to work in SMART.
    Mmmh i see.. But if you get reflection to work in smart that would be amazing! It doesnt need all the features like other bots but only walking and maybe random events.

    Thanks for the fast responses and good luck on figuring out how reflection works and how to get it working with the smart client!

  19. #144
    Join Date
    May 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i have problem i dont got the binaryl file to get it work where i can find thing like that keep getting Exception in Script: Plugin(sps32) has not been found my simba + srl osr working fine but where to find binary to make sps osr work!

  20. #145
    Join Date
    Jan 2012
    Posts
    468
    Mentioned
    3 Post(s)
    Quoted
    200 Post(s)

    Default

    SPS Still does not work as it supposed to! It runs and clicks non Stop even though it hasn't reached the coords!

  21. #146
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Rules of Joe View Post
    SPS Still does not work as it supposed to! It runs and clicks non Stop even though it hasn't reached the coords!
    That probably means it didn't find the flag

  22. #147
    Join Date
    Jan 2012
    Posts
    468
    Mentioned
    3 Post(s)
    Quoted
    200 Post(s)

    Default

    Oh it found the flag it just kept clicking none stop until all the cords are done! It doesnt wait until it reaches the flag is what im trying to say!

  23. #148
    Join Date
    Jul 2012
    Posts
    113
    Mentioned
    7 Post(s)
    Quoted
    34 Post(s)

    Default

    I haven't been active here for a couple months, if anyone would like to add this to a new github page to continue development, I'll update the OP.

    Also, @Flight, I was actually thinking about making a procedure that attempted to do perfect north based on walls. Depending on how it is used, would definitely increase stability.
    .---. ``````````` .---. .
    \___ `,-. ,-. ,-. \___ ยท|- ,-. ,-
    ``` \ |-'`,-| | | ``` \ | `,-| |
    `---' `-' `-^ ' ' `---' `' `-^ '

  24. #149
    Join Date
    Jan 2012
    Posts
    468
    Mentioned
    3 Post(s)
    Quoted
    200 Post(s)

    Default

    Would Love to see what you have come up with Star!! and not only make attempt to do a perfect north based wall but make sure it waits long enough until it reaches the FFlag before it clicks the other point!

    @Flight, It would work so much better if the FFlag(30), would work! It doesnt wait long enough and causes the script to click random points no matter where its at!

  25. #150
    Join Date
    Jun 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Exception in Script: Unable to find file 'SPS/sps-osr.simba' used from 'C:\Simba\Scripts\ineedbot's AIO Chopper[2.1].simba'


    I keep getting this error but the SPS file is where the script file is. I've installed everything correctly and I still can't make it work.

Page 6 of 7 FirstFirst ... 4567 LastLast

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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