Results 1 to 4 of 4

Thread: Not repeating when it should

  1. #1
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default Not repeating when it should

    This is the procedure that should repeat but its not. (Will post other functions)
    It goes to the first dot and picks up the item, then click the second dot on the MM and then the script ends. Not sure why. Probably something obvious.

    Simba Code:
    procedure blah;
    var
     count: integer;
    begin
    repeat
    if (FindDot) then
            begin
              while (IsMoving) do
              begin
                Wait(1000+Random(250));

              end;
           end;

          count := InvCount
          if Not(IsMoving) then
            if (FindItem) and (WaitInvCount(count +1, 5000, ExactCT)) then
                Writeln('Got it');
          until (not FindDot) or (InvCount = 7) or (not FindItem);

    end;

    Simba Code:
    function FindDot: Boolean;
    var
      P: TPointArray;
      ATPA: array of TPointArray;
    begin

      P := getminimapdots('red');

     
      ATPA := SplitTPAEx(P, 5, 5);
      SortATPAFromFirstPoint(ATPA, Point(MMCX,MMCY));
      DeBugATPABounds(ATPA);
      for i := 0 to Low(ATPA) do
      begin
      if (GetArrayLength(ATPA) < 0) then
        Exit;
        MiddleTPAEx(ATPA[i], x, y);
        HumanMMouse(x,y, 2, 2);
        ClickMouse2(True);
        {if DeBug then Writeln('Found dots, flag present');
          if (IsMoving) then
            repeat
              if DeBug then Writeln('Still Moving');
                Wait(500 +Random(750));
            until(WaitNotMoving(true) or not FlagPresent);
            if DeBug then Writeln('Not moving, should be on dot');}

        Result := True;
        Exit;
      end;
    end;    

    function FindItem: Boolean;
    var
      CTS: Integer;
      TPA: TPointArray;
      ATPA: array of TPointArray;

    begin
      if (not (LoggedIn)) then
        Exit;

      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);  //.25 .33
      SetColorSpeed2Modifiers(0.06 ,0.39);

      FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9254494, MSX1, MSY1, MSX2, MSY2, 20);

      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      RAaSTPA(TPA, 5);
      ATPA := SplitTPAEx(TPA, 15, 15);
      SortATPAFromFirstPoint(ATPA, Point(MSCX,MSCY)); //just changed from MSY1 to MSCY maybe the problem??
      DeBugATPABounds(ATPA);
      for i := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        HumanMMouse(x, y, 2, 2);
        if WaitUpTextMulti(['Pick', 'Item'], 400) then
        if DeBug then Writeln('Found Item');
        ClickMouse2(True);
        Result := True;
        Exit;
        end;
    end;
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  2. #2
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    It could just be not finding dots or items during FindDot or FindItem. When you use or, it means if ANY of them are, it stops repeating.

  3. #3
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default

    Makes sense. Will change that and see if that fixes the problem.
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Try this:

    Simba Code:
    procedure Blah;
    begin
      repeat
      if (FindItem) and (WaitInvCount(InvCount + 1, 5000, ExactCT)) then
        Writeln('Got it');
      if (FindDot) then
        while (IsMoving) do
          Wait(500 + Random(250));
      if not(IsMoving) then
        if (FindItem) and (WaitInvCount(InvCount + 1, 5000, ExactCT)) then
          Writeln('Got it');
      until (((not FindDot) and (not FindItem)) or (InvCount = 7));
    end;
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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
  •