Results 1 to 8 of 8

Thread: Find DTM until true not working?

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

    Default Find DTM until true not working?

    In my script, a IronMiner, I make it mine rocks, the procedure is this:

    Simba Code:
    Procedure FindRock;
    var
      tmpCTS, l, r,X,Y:Integer;
      IronTPA:TPointArray;
      SmokeTPA:TPointArray;
    begin
      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.17, 0.17);
      If FindColorsTolerance(SmokeTPA, 7110803, 11, 27, 522, 360, 4) then
        begin
        AntiSmoke;
    end;
    begin
      MouseSpeed:=17;
      tmpCTS := GetToleranceSpeed;
      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.18,0.45);
      if FindColorsTolerance(IronTPA, 2569557, 11, 27, 522, 360, 3) then
        begin
        SetColorToleranceSpeed(tmpCTS);
        SetToleranceSpeed2Modifiers(0.02, 0.02);
        L := High(IronTPA)
        wait(randomrange(60, 200));
        mmouse(IronTPA[r].x, IronTPA[r].y, 2, 2);
        wait(randomrange(150, 300));
        clickmouse2(mouse_left);
        wait(randomrange(2500, 3500));
        begin
        repeat
        FindRock;
        until  (FindDTM(IronOre, x, y, 685, 444, 738, 489)=true);
          end;
        end;
      end;
      DropIt;
    end;

    And instead of just making that repeat 28 times like I might have when i was a n00b or trying to find a color in the last slot like when I was a n00b I added this:

    Simba Code:
    begin
        repeat
        FindRock;
        until  (FindDTM(IronOre, x, y, 685, 444, 738, 489)=true);
          end;
        end;
      end;
      DropIt;
    end;

    In a attempt to make it drop the ore when ever it finds the ironore dtm in the last slot. But the script is not going to the dropit procedure it just keeps trying to mine iron rocks! did i put "DropIt;" in the wrong place?

  2. #2
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    you have like a thousand ends in your mainloop there that you don't need?

    But perhaps your script is not finding the DTM, try adding some tolerance to each of your point on your DTM? or use a central point with some tolerance and then the rest along the black outline of the ore

  3. #3
    Join Date
    Dec 2012
    Posts
    191
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There is something that does exactly what you want which is:

    function ExistsItemDTM(dtm: Integer; var x, y: Integer): Boolean;
    (Checks if the dtm is in the inventory. Returns the item’s coordinates.)
    Or simply, without going through that trouble, use :

    procedure DropItem(i: Integer);
    Drops item at given position (1-28)
    NOTE: Quotes taken from : http://docs.villavu.com/srl-5/inventory.html#

    Also, that syntax is really messy, you're calling FindRock within itself. Delete those ends on the main loop, put them before the mainloop begin..
    Last edited by Slashed; 12-15-2012 at 01:30 AM.

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

    Default

    Using it for a pserver so most SRL shortcuts are out of the queston, ill try editing the DTM

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

    Default

    EDIT: NVM did not find the problem still does not work with a different DTM
    Last edited by rj; 12-15-2012 at 01:36 AM.

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

    Default

    fixed.

  7. #7
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    What was the issue in the end?

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

    Default

    Quote Originally Posted by P1ng View Post
    What was the issue in the end?
    Not sure, I just made it check for the DTM at the start of the clickrock procedure

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
  •