Results 1 to 12 of 12

Thread: Need some DDTM help..

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default Need some DDTM help..

    Hello,

    I'm attempting to make a procedure that will walk from Draynor bank to the Willow trees, and it's not working so well.

    Actually, since it's there, the walking from the Willows to the bank doesn't work either.

    I've tried playing with the tolerances and Area sizes, but nothing seemed to help.

    All it does is login, writes the Water/Rock colors in the debug box, then logs out, saying it "Couldn't walk to Willows.".

    I compared mine to Dark Arcana's and they're very similar, except his has failsafes. So I really don't know what's wrong.

    SCAR Code:
    program DraynorWillows;
      {.include SRL\SRL.scar}
     
    var
      x, y : Integer;
     
    const
      RunOn = True;//Set False to turn run off.
     
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Pin := '';
      Players[0].Integers[0] := 270;//How many logs to cut?
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
    end;
     
    function S_LoadWalks(WalkNumber : Integer): Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
      1: begin
           dtmMainPoint.x := 835;
           dtmMainPoint.y := 335;
           dtmMainPoint.AreaSize := 5;
           dtmMainPoint.AreaShape := 0;
           dtmMainPoint.Color := FindWaterColor;//2715252
           dtmMainPoint.Tolerance := 5;

           dtmSubPoints[0].x := 835;
           dtmSubPoints[0].y := 335;
           dtmSubPoints[0].AreaSize := 5;
           dtmSubPoints[0].AreaShape := 0;
           dtmSubPoints[0].Color := FindWaterColor;//2848632
           dtmSubPoints[0].Tolerance := 5;

           dtmSubPoints[1].x := 827;
           dtmSubPoints[1].y := 329;
           dtmSubPoints[1].AreaSize := 5;
           dtmSubPoints[1].AreaShape := 0;
           dtmSubPoints[1].Color := FindWaterColor;//2713716
           dtmSubPoints[1].Tolerance := 5;

           dtmSubPoints[2].x := 828;
           dtmSubPoints[2].y := 346;
           dtmSubPoints[2].AreaSize := 5;
           dtmSubPoints[2].AreaShape := 0;
           dtmSubPoints[2].Color := FindWaterColor;//2581102
           dtmSubPoints[2].Tolerance := 5;

           dtmSubPoints[3].x := 838;
           dtmSubPoints[3].y := 332;
           dtmSubPoints[3].AreaSize := 5;
           dtmSubPoints[3].AreaShape := 0;
           dtmSubPoints[3].Color := FindWaterColor;//2847096
           dtmSubPoints[3].Tolerance := 5;

           TempTDTM.MainPoint := dtmMainPoint;
           TempTDTM.SubPoints := dtmSubPoints;
           Result := AddDTM(TempTDTM);
         end;
      2: begin
           dtmMainPoint.x := 849;
           dtmMainPoint.y := 296;
           dtmMainPoint.AreaSize := 5;
           dtmMainPoint.AreaShape := 0;
           dtmMainPoint.Color := 3815998;
           dtmMainPoint.Tolerance := 10;

           dtmSubPoints[0].x := 849;
           dtmSubPoints[0].y := 296;
           dtmSubPoints[0].AreaSize := 5;
           dtmSubPoints[0].AreaShape := 0;
           dtmSubPoints[0].Color := 3815998;
           dtmSubPoints[0].Tolerance := 10;

           dtmSubPoints[1].x := 853;
           dtmSubPoints[1].y := 300;
           dtmSubPoints[1].AreaSize := 5;
           dtmSubPoints[1].AreaShape := 0;
           dtmSubPoints[1].Color := 3815998;
           dtmSubPoints[1].Tolerance := 10;

           dtmSubPoints[2].x := 845;
           dtmSubPoints[2].y := 289;
           dtmSubPoints[2].AreaSize := 5;
           dtmSubPoints[2].AreaShape := 0;
           dtmSubPoints[2].Color := 3815998;
           dtmSubPoints[2].Tolerance := 10;

           dtmSubPoints[3].x := 849;
           dtmSubPoints[3].y := 300;
           dtmSubPoints[3].AreaSize := 5;
           dtmSubPoints[3].AreaShape := 0;
           dtmSubPoints[3].Color := 3815998;
           dtmSubPoints[3].Tolerance := 10;

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

    procedure W_WalkToWillows;
    var
      W_ToWillows : Integer;
    begin
      if not LoggedIn then Exit;
      W_ToWillows := S_LoadWalks(1)
      if DTMRotated(W_ToWillows, x, y, MMX1, MMY1, MMX2, MMY2)then
      begin
        Mouse(x + 30, y, 4, 4, True);
        Writeln('Walking to trees.');
        FFlag(5);
      end else
      begin
        Writeln('Couldn''t walk to Willows.');
        Logout;
        Exit;
      end;
      FreeDTM(S_LoadWalks(1));
    end;

    function W_WalkToBank: Boolean;
    var
      W_ToBank : Integer;
    begin
      if not LoggedIn then Exit;
      W_ToBank := S_LoadWalks(2);
      if DTMRotated(W_ToBank, x, y, MMX1, MMY1, MMX2, MMY2)then
      begin
        Mouse(x, y, 4, 4, True);
        Writeln('Inventory full, walking to bank.');
        FFlag(1);
        Result := True;
      end else
      begin
        Writeln('Couldn''t walk to bank.');
        Logout;
        Exit;
      end;
      FreeDTM(S_LoadWalks(2));
    end;

    procedure F_Setup;
    begin
      ClearDebug;
      //SMARTSetupEx(152, False, True, False);
      //Wait(5000);
      //SetTargetDC(SmartGetDC);
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      SetAngle(True);
      if RunOn then SetRun(True);
    end;

    begin
      F_Setup;
      W_WalkToWillows;
      //W_WalkToBank;
    end.

    Thanks.
    Last edited by Coh3n; 06-15-2009 at 12:20 AM.

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try adding tolerance?

    And you can't use one color.. you need to use AutoColor functions to get the colors for the points.

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    Try adding tolerance?

    And you can't use one color.. you need to use AutoColor functions to get the colors for the points.
    Um I'll try adding tolerances, and could you explain the AutoColor functions more please?

  4. #4
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try using a plain dtm or radialwalk. I'll post an example in a few minutes. in this post

    Example:
    SCAR Code:
    program New;
    {.include SRL\SRL.Scar}

    Procedure WalkToWillows;
    begin
      MakeCompass('n')
      if RadialWalk(FindWaterColor, 189, 230, 65, 4, 4) then
      begin
        FFLag(0);
      end;
    end;

    begin
      SetUpSrl;
      SetRun(True);
      WalkToWillows;
    end.

    For a list of the auto color functions already made, check Autocolor.scar.
    Or you make your own, if you know TPointArrays. Or you can use AutoColorAid(ACA), which is a scripting tool that can make autocolor functions with a certain amount of colors you choose.
    Last edited by Smarter Child; 06-14-2009 at 05:14 AM.

  5. #5
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    or u could try a bank dtm with offsets

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Smarter Child View Post
    Try using a plain dtm or radialwalk. I'll post an example in a few minutes. in this post

    Example:
    SCAR Code:
    program New;
    {.include SRL\SRL.Scar}

    Procedure WalkToWillows;
    begin
      MakeCompass('n')
      if RadialWalk(FindWaterColor, 189, 230, 65, 4, 4) then
      begin
        FFLag(0);
      end;
    end;

    begin
      SetUpSrl;
      SetRun(True);
      WalkToWillows;
    end.

    For a list of the auto color functions already made, check Autocolor.scar.
    Or you make your own, if you know TPointArrays. Or you can use AutoColorAid(ACA), which is a scripting tool that can make autocolor functions with a certain amount of colors you choose.
    Wow can it really be that simple? Lol.

    Quote Originally Posted by pur3b100d View Post
    or u could try a bank dtm with offsets
    Sorry, I don't know what you mean.

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Wow can it really be that simple? Lol.
    Yes, but learning a ddtm is very a bad thing. Remember a ddtm is different from a dtm in the fact that you can make the colors autocolors and the tolerance can be dynamic

    Quote Originally Posted by Coh3n View Post
    Sorry, I don't know what you mean.
    He meant you can make a dtm of the bank dots and make the script click with offsets ex. Mouse(x-10, y+25, 5, 5, True); or something of that sort.
    “Ignorance, the root and the stem of every evil.”

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    Yes, but learning a ddtm is very a bad thing. Remember a ddtm is different from a dtm in the fact that you can make the colors autocolors and the tolerance can be dynamic
    Why's it a bad thing? And, I was trying to do a DDTM because in Nava's "Why I vote no." thread (or something like that) he says DDTM is probably the best ways of walking, other than reflection. But, if these other ways are simpler, and work just as well, I should try them I guess.

    Quote Originally Posted by Blumblebee View Post
    He meant you can make a dtm of the bank dots and make the script click with offsets ex. Mouse(x-10, y+25, 5, 5, True); or something of that sort.
    Okay I see.. kind of. When you say "bank dots" do you mean like the yellow banker NPCs?

  9. #9
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Do you realise that FindDTM requires the DTM to be on the exact same angle as when you made it. The minimap rotates slightly and your DTM won't be found most of the time. Try using DTMRotated which attempts the find the DTM and then rotates the points slightly each time.

    SCAR Code:
    {*******************************************************************************
    function DTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
    By: Yakman
    Description: First looks for a DTM without rotation, then increases the amount
    of rotation around 0 gradually until it finds the DTM. A bit like the
    ProgressiveTol Bitmap Engines.
    *******************************************************************************}

  10. #10
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by ZephyrsFury View Post
    Do you realise that FindDTM requires the DTM to be on the exact same angle as when you made it. The minimap rotates slightly and your DTM won't be found most of the time. Try using DTMRotated which attempts the find the DTM and then rotates the points slightly each time.
    Um no, I didn't realize that. XD Lol, thanks, and I will try DTMRotated.

    EDIT: RotateDTM didn't work, but I should probably try some of the other suggestions first before saying it doesn't work completely.
    Last edited by Coh3n; 06-14-2009 at 12:06 PM.

  11. #11
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Um no, I didn't realize that. XD Lol, thanks, and I will try DTMRotated.

    EDIT: RotateDTM didn't work, but I should probably try some of the other suggestions first before saying it doesn't work completely.
    It is more than likely because you didn't use DTMRotated etc. But AutoColoirs are relatively easy to use and make, I can show you sometime this week of need be.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    It is more than likely because you didn't use DTMRotated etc. But AutoColoirs are relatively easy to use and make, I can show you sometime this week of need be.
    Lol probably not a bad idea. Just let me know when you want a break from studying.

    ^ I updated the script.
    Last edited by Coh3n; 06-15-2009 at 12:19 AM.

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
  •