Results 1 to 11 of 11

Thread: Ddtm

  1. #1
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Ddtm

    Well i just can't it to work any ideas
    Code:
    program DDTMExample;
      {.include SRL/SRL.scar}
    
    var
      DDTMTolerance : Integer;
    
    function SetDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 840;
      dtmMainPoint.y := 415;
      dtmMainPoint.AreaSize := 1;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6060421;
      dtmMainPoint.Tolerance := DDTMTolerance;
    
      dtmSubPoints[0].x := 840;
      dtmSubPoints[0].y := 415;
      dtmSubPoints[0].AreaSize := 1;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6060421;
      dtmSubPoints[0].Tolerance := DDTMTolerance;
    
      dtmSubPoints[1].x := 847;
      dtmSubPoints[1].y := 415;
      dtmSubPoints[1].AreaSize := 1;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 6257800;
      dtmSubPoints[1].Tolerance := DDTMTolerance;
    
      dtmSubPoints[2].x := 836;
      dtmSubPoints[2].y := 428;
      dtmSubPoints[2].AreaSize := 1;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 6258058;
      dtmSubPoints[2].Tolerance := DDTMTolerance;
    
      dtmSubPoints[3].x := 838;
      dtmSubPoints[3].y := 402;
      dtmSubPoints[3].AreaSize := 1;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 6455437;
      dtmSubPoints[3].Tolerance := DDTMTolerance;
    
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;
    
    
    function WalkOutOfBank: Boolean;
    var
      TheDDTM, x, y : Integer;//The reason "TheDDTM" is declared as an integer is because the function SetDDTM returns an integer.
    begin
      if not LoggedIn then Exit;//Remember to put this at the beginning of all your functions/procedures.
      SetRun(True);//This will turn your run, simple as that.
      DDTMTolerance := 5;//Notice how we set the INITIAL DDTMTolerance to 5.
      TheDDTM := SetDDTM;//Notice how we declare the variable "TheDDTM" as the SetDDTM function.
      repeat//This is going to repeatly try and find the DDTM if it is not found the first time.
        if not DTMRotated(TheDDTM, x, y, MMX1, MMY1, MMX2, MMY2) then//Notice how we use DTMRotated this time.  This is because the MiniMap may not be on the same angle of which you made you DDTM.  This allows it to find the DDTM, now matter which angle the MM is at.
        begin//Notice in the above line (69) we used "if not...". Simply means if it doesn't find the DDTM it will do what's in this begin..end nest.
          Writeln('Didn''t find DDTM, increasing tolerance...');
          IncEx(DDTMTolerance, 5);//IncEx works like Inc, except it will increase by a set integer, rather than increase by only one.  In this case, we increase the tolerance by 5 each time the DDTM is not found.
          FreeDTM(TheDDTM);//ALWAYS remember to free the DDTM! We free it here because it will reload each time the loop repeats, so therefore, we need to free it each time the loop repeats.
          TheDDTM := SetDDTM;//We set it here because it will reset everytime the loop repeats.
        end else//This is to tell it what to do if it finds the DDTM.
        begin
          Writeln('Found Varrock road!');
          Mouse(x, y, 4, 4, True);
          Result := True;//Set the result to true because SCAR clicked the DDTM.
          Break;//Make sure it breaks out of the loop if the DDTM is found, otherwise it will click the DDTM every time it is found until the tolerance is 50.
        end;
      until((DDTMTolerance >= 50) or not LoggedIn);//Notice how it will repeatedly try to find the DDTM until the tolerance is greater or equal to 50, or your account has logged out, or it the DDTM has been found.
      DDTMTolerance := 5;//We do this to reset the DDTM's tolerance, incase we decide to use it again later in the script.
      FreeDTM(TheDDTM);//This frees the DDTM if it is found. ALWAYS remember to free the DDTM!
    end;
    
    begin
      ClearDebug;
      SetupSRL;
      ActivateClient;
      if WalkOutOfBank then//Remember to include your function in you main loop. =P
        Writeln('Walking out of the bank.')
      else
        Writeln('Couldn''t walk out of the bank.');
    end.
    Edit:
    what do i need to do to find this?
    SCAR Code:
    function SetDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 840;
      dtmMainPoint.y := 415;
      dtmMainPoint.AreaSize := 0;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6060421;
      dtmMainPoint.Tolerance := 0;
     
      dtmSubPoints[0].x := 840;
      dtmSubPoints[0].y := 415;
      dtmSubPoints[0].AreaSize := 0;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6060421;
      dtmSubPoints[0].Tolerance := 0;
     
      dtmSubPoints[1].x := 847;
      dtmSubPoints[1].y := 415;
      dtmSubPoints[1].AreaSize := 0;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 6257800;
      dtmSubPoints[1].Tolerance := 0;
     
      dtmSubPoints[2].x := 836;
      dtmSubPoints[2].y := 428;
      dtmSubPoints[2].AreaSize := 0;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 6258058;
      dtmSubPoints[2].Tolerance := 0;
     
      dtmSubPoints[3].x := 838;
      dtmSubPoints[3].y := 402;
      dtmSubPoints[3].AreaSize := 0;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 6455437;
      dtmSubPoints[3].Tolerance := 0;
     
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;
    Last edited by rya; 12-06-2009 at 02:30 PM.
    I see Now, says the blind man

  2. #2
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    You're trying to find a road, right? Don't use static colors for that, use on of the autocolors SRL has. I mean, you're already using a DDTM for the tolerance aspect, so you might as well go whole hog and use an autocolor in it as well.

  3. #3
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    You're trying to find a road, right? Don't use static colors for that, use on of the autocolors SRL has.
    kind of anything to get me from VEB to the magic shop
    I see Now, says the blind man

  4. #4
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    The function

    Code:
    function SetDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 840;
      dtmMainPoint.y := 415;
      dtmMainPoint.AreaSize := 1;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6060421;
      dtmMainPoint.Tolerance := DDTMTolerance;
    
      dtmSubPoints[0].x := 840;
      dtmSubPoints[0].y := 415;
      dtmSubPoints[0].AreaSize := 1;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6060421;
      dtmSubPoints[0].Tolerance := DDTMTolerance;
    
      dtmSubPoints[1].x := 847;
      dtmSubPoints[1].y := 415;
      dtmSubPoints[1].AreaSize := 1;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 6257800;
      dtmSubPoints[1].Tolerance := DDTMTolerance;
    
      dtmSubPoints[2].x := 836;
      dtmSubPoints[2].y := 428;
      dtmSubPoints[2].AreaSize := 1;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 6258058;
      dtmSubPoints[2].Tolerance := DDTMTolerance;
    
      dtmSubPoints[3].x := 838;
      dtmSubPoints[3].y := 402;
      dtmSubPoints[3].AreaSize := 1;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 6455437;
      dtmSubPoints[3].Tolerance := DDTMTolerance;
    
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;
    Can be shortened to

    Code:
    function SetDDTM: Integer;
    var
      RoadCol:Integer;
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM; 
    begin
      RoadCol := FindVarrockRoadColor;
      dtmMainPoint.x := 840;
      dtmMainPoint.y := 415;
      dtmMainPoint.AreaSize := 1;
      dtmMainPoint.Color := RoadCol;
    
      dtmSubPoints[0].x := 840;
      dtmSubPoints[0].y := 415;
      dtmSubPoints[0].AreaSize := 1;
      dtmSubPoints[0].Color := RoadCol;
    
      dtmSubPoints[1].x := 847;
      dtmSubPoints[1].y := 415;
      dtmSubPoints[1].AreaSize := 1;
      dtmSubPoints[1].Color := RoadCol;
    
      dtmSubPoints[2].x := 836;
      dtmSubPoints[2].y := 428;
      dtmSubPoints[2].AreaSize := 1;
      dtmSubPoints[2].Color := RoadCol;
    
      dtmSubPoints[3].x := 838;
      dtmSubPoints[3].y := 402;
      dtmSubPoints[3].AreaSize := 1;
      dtmSubPoints[3].Color := RoadCol;
    
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;
    It will also use SRL's auto colour. Should work better too.
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  5. #5
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by cycrosism View Post
    -snip-
    Um, why did you cut out the tolerance?

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Because he uses FindVarrockRoadColor. That already give a current colour, so no tolerance on top of that is necessary.
    Ce ne sont que des gueux


  7. #7
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So how would i find this?
    SCAR Code:
    function SetDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 840;
      dtmMainPoint.y := 415;
      dtmMainPoint.AreaSize := 0;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 6060421;
      dtmMainPoint.Tolerance := 0;
     
      dtmSubPoints[0].x := 840;
      dtmSubPoints[0].y := 415;
      dtmSubPoints[0].AreaSize := 0;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 6060421;
      dtmSubPoints[0].Tolerance := 0;
     
      dtmSubPoints[1].x := 847;
      dtmSubPoints[1].y := 415;
      dtmSubPoints[1].AreaSize := 0;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 6257800;
      dtmSubPoints[1].Tolerance := 0;
     
      dtmSubPoints[2].x := 836;
      dtmSubPoints[2].y := 428;
      dtmSubPoints[2].AreaSize := 0;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 6258058;
      dtmSubPoints[2].Tolerance := 0;
     
      dtmSubPoints[3].x := 838;
      dtmSubPoints[3].y := 402;
      dtmSubPoints[3].AreaSize := 0;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 6455437;
      dtmSubPoints[3].Tolerance := 0;
     
      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
    end;
    ?
    I see Now, says the blind man

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    finddtm(SetDDTM, ect ect
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    SRL's autocolors don't work so don't use that...

    either

    1. make your own fix for an autocolor.
    2. use static colors with a dynamic tolerance
    3. Use a different style of walking

    also, if you want your ddtm's to work you need to increase areasize, make it 1-3 is usually what i make it depending on how exact the walking before is.

  10. #10
    Join Date
    Jan 2008
    Location
    Houston, Texas, USA
    Posts
    770
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    As Bumblebee said. SRL autocolor doesn't work. Use RadialWalkTolerance. Easier and better.

  11. #11
    Join Date
    Nov 2009
    Location
    Seattle, WA
    Posts
    589
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Just a quick question, I used
    SCAR Code:
    if RadialWalkTolerance(FindVarrockRoadColor, 326, 346, 48, 1, 1, 15) then
    It worked perfectly and MUCH easier then DDTM, just asking, does it work with only RadialWalkTolerance then?
    Update: Im talking about the AutoColors lol.
    Last edited by Heavenguard; 12-06-2009 at 07:03 PM.
    Don't Troll, Don't Fight, Just keep the Respect
    Status : Offline

    Feel free to re-make my scripts ;D
    Community Member

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
  •