Results 1 to 5 of 5

Thread: DDTM Troubles

  1. #1
    Join Date
    Feb 2009
    Posts
    1,447
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default DDTM Troubles

    Im trying to walk to a DDTM on the minimap but SCAR cant find the DDTM.
    I have made a script that walks fine using DDTMs but its not working for me now.

    Here is the DDTM:
    SCAR Code:
    function SetDDTM: Integer;
    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      dtmMainPoint.x := 712;
      dtmMainPoint.y := 157;
      dtmMainPoint.AreaSize := 0;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := FindTreeColor;
      dtmMainPoint.Tolerance := 0;

      dtmSubPoints[0].x := 712;
      dtmSubPoints[0].y := 157;
      dtmSubPoints[0].AreaSize := 0;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := FindTreeColor;
      dtmSubPoints[0].Tolerance := 0;

      dtmSubPoints[1].x := 725;
      dtmSubPoints[1].y := 156;
      dtmSubPoints[1].AreaSize := 0;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := FindTreeColor;
      dtmSubPoints[1].Tolerance := 0;

      dtmSubPoints[2].x := 695;
      dtmSubPoints[2].y := 166;
      dtmSubPoints[2].AreaSize := 0;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := FindTreeColor;
      dtmSubPoints[2].Tolerance := 0;

      dtmSubPoints[3].x := 720;
      dtmSubPoints[3].y := 161;
      dtmSubPoints[3].AreaSize := 0;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := FindTreeColor;
      dtmSubPoints[3].Tolerance := 0;

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

    My FindTreeColor function works fine but if you wana see it here it is:
    SCAR Code:
    function FindTreeColor: Integer;
    var
      TPA : TPointArray;
      I, H, Col : Integer;
    begin
      FindColorsTolerance(TPA, 18205, MMX1, MMY1, MMX2, MMY2, 20);
      H := RandomRange(0,5);
      for I := H to H do
      begin
        Col := GetColor(TPA[i].X, TPA[i].Y);
        Result:= Col;
        Writeln('Tree Color:'+IntToStr(Col));
      end;
    end;

    Here is my procedure for finding the DDTM:
    SCAR Code:
    if DTMRotated(SetDDTM,x,y,MMX1,MMY1,MMX2,MMY2) then
      begin
        Mouse(x,y,0,0,true);
        Writeln('Found');
        Flag;
        Wait(500+Random(250));
      end;

    Im using (D)DTM Editor by Nielsie95
    It should be finding some trees under Fally above the cow pen.

    Anything that Im doing wrong?

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

    Default

    increase the area size.
    “Ignorance, the root and the stem of every evil.”

  3. #3
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    In findtreecolor why do you use for i := h to h? Tht basically goes through it once and h is not even used. So eliminate the h variable and the for to do loop and it does the same thing.

  4. #4
    Join Date
    Feb 2009
    Posts
    1,447
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    increase the area size.
    I have increased the area size of all the points I just forgot to show the script with the area size greater. I have tried up to 10 area size but it still dosnt work.

  5. #5
    Join Date
    Feb 2009
    Posts
    1,447
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    FindTreeColor was my problem. I though I was using one of the first colors in the TPA. I deleted the h var and loop like Da 0wner said. I though it should have worked because RadialWalking with a TPA function similar to that worked :/
    Thanks Da 0wner Rep+

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
  •