Results 1 to 2 of 2

Thread: [07scape] Need help learning to walk with DDTM and TPA

  1. #1
    Join Date
    Oct 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default [07scape] Need help learning to walk with DDTM and TPA

    Hello everyone,

    I picked up scripting a few days ago, and in order to practice I want to focus on one aspect of runescape scripting at a time. I picked DTMs to work on first, specifically targetting walking.

    This is a script I made following some of the DDTM tutorials. It starts at a specific bank booth in seers village and is supposed to click on the road, ~10ish units away.

    Simba Code:
    program WalkingTrial;
      {$i SRL\SRL.simba}
      {$I P07Include.Simba}
      {$i ObjectDTM\ObjDTMInclude.simba}

    function FindRoadColor: Integer;
    var
      TPA : TPointArray;
    begin
      if FindColorsTolerance(TPA, 6316135, 637, 114, 645, 119, 10) then
        Result:= GetColor(TPA[0].X, TPA[0].Y);
    end;

    function DDTMWalk(WalkNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
        1: begin
            dtmMainPoint.x := 1220;
            dtmMainPoint.y := 207;
            dtmMainPoint.AreaSize := 0;
            dtmMainPoint.AreaShape := 0;
            dtmMainPoint.Color := FindRoadColor;
            dtmMainPoint.Tolerance := 0;

            dtmSubPoints[0].x := 1220;
            dtmSubPoints[0].y := 207;
            dtmSubPoints[0].AreaSize := 3;
            dtmSubPoints[0].AreaShape := 0;
            dtmSubPoints[0].Color := 6052707;
            dtmSubPoints[0].Tolerance := FindRoadColor;

            dtmSubPoints[1].x := 1219;
            dtmSubPoints[1].y := 200;
            dtmSubPoints[1].AreaSize := 3;
            dtmSubPoints[1].AreaShape := 0;
            dtmSubPoints[1].Color := 15001070;
            dtmSubPoints[1].Tolerance := 5;

            dtmSubPoints[2].x := 1212;
            dtmSubPoints[2].y := 200;
            dtmSubPoints[2].AreaSize := 3;
            dtmSubPoints[2].AreaShape := 0;
            dtmSubPoints[2].Color := 15001070;
            dtmSubPoints[2].Tolerance := 5;

            dtmSubPoints[3].x := 1228;
            dtmSubPoints[3].y := 212;
            dtmSubPoints[3].AreaSize := 3;
            dtmSubPoints[3].AreaShape := 0;
            dtmSubPoints[3].Color := 15001070;
            dtmSubPoints[3].Tolerance := 5;

            TempTDTM.MainPoint := dtmMainPoint;
            TempTDTM.SubPoints := dtmSubPoints;
            Result := AddDTM(TempTDTM);
           end;
       end;
    end;

    Procedure WalkToPoint;
    var
      x, y: Integer;
      aFound: Extended;
    begin
     if FindDTMRotated(DDTMWalk(1), x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/30, aFound) then
      MMouse(x, y, 2, 2);
      ClickMouse2(true);
    end;

    begin
    WalkToPoint;
    end.

    Its nowhere near optimal, but I really just want to learn how to make this work for one specific spot before I move forward.

    The script compiles and executes successfully, but nothing happens when it does. What did I do wrong?

    One thing that I did not understand is how to use 'MMX1, MMY1, MMX2, MMY2'. I know these parameters define an area that the script uses to search for a DTM, but I'm not sure how to use this properly. My procedure for road color simply uses coordinates to find the road color because I start in the same exact spot when I start this script, so I defined a small area where the road will always be, if that makes sense.

    The sub points are all white outlines, so for now I did not want to make a TPA array and instead just added a tolerance of 10.

    This script is for Runescape Classic, but I don't think that should make a difference because, well, colors are colors.

    I would really appreciate any help, if any additional information is needed just let me know


    Edit----
    Simba Code:
    program WalkingTrial;
      {$i SRL\SRL.simba}
      {$I P07Include.Simba}
      {$i ObjectDTM\ObjDTMInclude.simba}
    var
    x, y: Integer;

    function FindRoadColor: Integer;
    var
      TPA : TPointArray;
    begin
      if FindColorsTolerance(TPA, 6316135, 637, 114, 645, 119, 10) then
        Result:= GetColor(TPA[0].X, TPA[0].Y);
    end;

    function DDTMWalk(WalkNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
        1: begin
            dtmMainPoint.x := 1220;
            dtmMainPoint.y := 207;
            dtmMainPoint.AreaSize := 1;
            dtmMainPoint.AreaShape := 0;
            dtmMainPoint.Color := 7105909;
            dtmMainPoint.Tolerance := 0;

            dtmSubPoints[0].x := 1220;
            dtmSubPoints[0].y := 207;
            dtmSubPoints[0].AreaSize := 1;
            dtmSubPoints[0].AreaShape := 0;
            dtmSubPoints[0].Color := 7105909;
            dtmSubPoints[0].Tolerance := 0;

            dtmSubPoints[1].x := 1219;
            dtmSubPoints[1].y := 200;
            dtmSubPoints[1].AreaSize := 1;
            dtmSubPoints[1].AreaShape := 0;
            dtmSubPoints[1].Color := 15132404;
            dtmSubPoints[1].Tolerance := 0;

            dtmSubPoints[2].x := 1212;
            dtmSubPoints[2].y := 200;
            dtmSubPoints[2].AreaSize := 1;
            dtmSubPoints[2].AreaShape := 0;
            dtmSubPoints[2].Color := 15132404;
            dtmSubPoints[2].Tolerance := 0;

            dtmSubPoints[3].x := 1228;
            dtmSubPoints[3].y := 212;
            dtmSubPoints[3].AreaSize := 1;
            dtmSubPoints[3].AreaShape := 0;
            dtmSubPoints[3].Color := 15132404;
            dtmSubPoints[3].Tolerance := 0;

            TempTDTM.MainPoint := dtmMainPoint;
            TempTDTM.SubPoints := dtmSubPoints;
            Result := AddDTM(TempTDTM);
           end;
       end;
    end;

    function Walk: Boolean;
    var
      WalkDTM: integer;
    begin
      WalkDTM := DDTMWalk(1);
      if FindDTM(WalkDTM, X, Y, MMx1,MMy1,MMx2,MMy2) then
      begin
        Mouse(X, Y, 2, 2, True);
      end;
    end;

    begin
    SetupP07Include;
    Walk;
    end.

    I finally got it to work with this function! The DTM I chose is fairly accurate, time to add auto color!
    Last edited by imjustdownloadin; 02-28-2013 at 04:04 AM.

  2. #2
    Join Date
    Oct 2012
    Location
    Italy
    Posts
    145
    Mentioned
    0 Post(s)
    Quoted
    44 Post(s)

    Default

    Quote Originally Posted by imjustdownloadin View Post
    Hello everyone,

    I picked up scripting a few days ago, and in order to practice I want to focus on one aspect of runescape scripting at a time. I picked DTMs to work on first, specifically targetting walking.

    This is a script I made following some of the DDTM tutorials. It starts at a specific bank booth in seers village and is supposed to click on the road, ~10ish units away.

    Simba Code:
    program WalkingTrial;
      {$i SRL\SRL.simba}
      {$I P07Include.Simba}
      {$i ObjectDTM\ObjDTMInclude.simba}

    function FindRoadColor: Integer;
    var
      TPA : TPointArray;
    begin
      if FindColorsTolerance(TPA, 6316135, 637, 114, 645, 119, 10) then
        Result:= GetColor(TPA[0].X, TPA[0].Y);
    end;

    function DDTMWalk(WalkNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
        1: begin
            dtmMainPoint.x := 1220;
            dtmMainPoint.y := 207;
            dtmMainPoint.AreaSize := 0;
            dtmMainPoint.AreaShape := 0;
            dtmMainPoint.Color := FindRoadColor;
            dtmMainPoint.Tolerance := 0;

            dtmSubPoints[0].x := 1220;
            dtmSubPoints[0].y := 207;
            dtmSubPoints[0].AreaSize := 3;
            dtmSubPoints[0].AreaShape := 0;
            dtmSubPoints[0].Color := 6052707;
            dtmSubPoints[0].Tolerance := FindRoadColor;

            dtmSubPoints[1].x := 1219;
            dtmSubPoints[1].y := 200;
            dtmSubPoints[1].AreaSize := 3;
            dtmSubPoints[1].AreaShape := 0;
            dtmSubPoints[1].Color := 15001070;
            dtmSubPoints[1].Tolerance := 5;

            dtmSubPoints[2].x := 1212;
            dtmSubPoints[2].y := 200;
            dtmSubPoints[2].AreaSize := 3;
            dtmSubPoints[2].AreaShape := 0;
            dtmSubPoints[2].Color := 15001070;
            dtmSubPoints[2].Tolerance := 5;

            dtmSubPoints[3].x := 1228;
            dtmSubPoints[3].y := 212;
            dtmSubPoints[3].AreaSize := 3;
            dtmSubPoints[3].AreaShape := 0;
            dtmSubPoints[3].Color := 15001070;
            dtmSubPoints[3].Tolerance := 5;

            TempTDTM.MainPoint := dtmMainPoint;
            TempTDTM.SubPoints := dtmSubPoints;
            Result := AddDTM(TempTDTM);
           end;
       end;
    end;

    Procedure WalkToPoint;
    var
      x, y: Integer;
      aFound: Extended;
    begin
     if FindDTMRotated(DDTMWalk(1), x, y, MMX1, MMY1, MMX2, MMY2, -Pi, Pi, Pi/30, aFound) then
      MMouse(x, y, 2, 2);
      ClickMouse2(true);
    end;

    begin
    WalkToPoint;
    end.

    Its nowhere near optimal, but I really just want to learn how to make this work for one specific spot before I move forward.

    The script compiles and executes successfully, but nothing happens when it does. What did I do wrong?

    One thing that I did not understand is how to use 'MMX1, MMY1, MMX2, MMY2'. I know these parameters define an area that the script uses to search for a DTM, but I'm not sure how to use this properly. My procedure for road color simply uses coordinates to find the road color because I start in the same exact spot when I start this script, so I defined a small area where the road will always be, if that makes sense.

    The sub points are all white outlines, so for now I did not want to make a TPA array and instead just added a tolerance of 10.

    This script is for Runescape Classic, but I don't think that should make a difference because, well, colors are colors.

    I would really appreciate any help, if any additional information is needed just let me know


    Edit----
    Simba Code:
    program WalkingTrial;
      {$i SRL\SRL.simba}
      {$I P07Include.Simba}
      {$i ObjectDTM\ObjDTMInclude.simba}
    var
    x, y: Integer;

    function FindRoadColor: Integer;
    var
      TPA : TPointArray;
    begin
      if FindColorsTolerance(TPA, 6316135, 637, 114, 645, 119, 10) then
        Result:= GetColor(TPA[0].X, TPA[0].Y);
    end;

    function DDTMWalk(WalkNumber: Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: array[0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
        1: begin
            dtmMainPoint.x := 1220;
            dtmMainPoint.y := 207;
            dtmMainPoint.AreaSize := 1;
            dtmMainPoint.AreaShape := 0;
            dtmMainPoint.Color := 7105909;
            dtmMainPoint.Tolerance := 0;

            dtmSubPoints[0].x := 1220;
            dtmSubPoints[0].y := 207;
            dtmSubPoints[0].AreaSize := 1;
            dtmSubPoints[0].AreaShape := 0;
            dtmSubPoints[0].Color := 7105909;
            dtmSubPoints[0].Tolerance := 0;

            dtmSubPoints[1].x := 1219;
            dtmSubPoints[1].y := 200;
            dtmSubPoints[1].AreaSize := 1;
            dtmSubPoints[1].AreaShape := 0;
            dtmSubPoints[1].Color := 15132404;
            dtmSubPoints[1].Tolerance := 0;

            dtmSubPoints[2].x := 1212;
            dtmSubPoints[2].y := 200;
            dtmSubPoints[2].AreaSize := 1;
            dtmSubPoints[2].AreaShape := 0;
            dtmSubPoints[2].Color := 15132404;
            dtmSubPoints[2].Tolerance := 0;

            dtmSubPoints[3].x := 1228;
            dtmSubPoints[3].y := 212;
            dtmSubPoints[3].AreaSize := 1;
            dtmSubPoints[3].AreaShape := 0;
            dtmSubPoints[3].Color := 15132404;
            dtmSubPoints[3].Tolerance := 0;

            TempTDTM.MainPoint := dtmMainPoint;
            TempTDTM.SubPoints := dtmSubPoints;
            Result := AddDTM(TempTDTM);
           end;
       end;
    end;

    function Walk: Boolean;
    var
      WalkDTM: integer;
    begin
      WalkDTM := DDTMWalk(1);
      if FindDTM(WalkDTM, X, Y, MMx1,MMy1,MMx2,MMy2) then
      begin
        Mouse(X, Y, 2, 2, True);
      end;
    end;

    begin
    SetupP07Include;
    Walk;
    end.

    I finally got it to work with this function! The DTM I chose is fairly accurate, time to add auto color!
    Good try.. I was about to try the same thing right now..

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
  •