Results 1 to 3 of 3

Thread: while do help

  1. #1
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default while do help

    EDIT:FIXED

    Im making a "simple" power miner for someone. I keep comming across this error. In the while do loop I set up, im making it wait until the inventory count changes, but it only performs the procedures in the loop and then breaks out, EVERY SINGLE TIME! Even if the inventory count hasnt changed. I cant seem to find out what the problem is and its really fustrating. I will now post the while do procedure, and if you were curious about my fighting function, I posted that also.

    SCAR Code:
    function FindTheFight: boolean;
    begin
     if (FindFight) then
     begin
       result := true;
       RunAwayDirection('N');
       RunBack;
     end else
       result := false;
    end;


    procedure Mwait;
    var
     Maxmm, sic, esc, gx, gy: integer;
    begin
      GetMousePos(gx, gy);
      MarkTime(maxmm);
      sic := InventoryCount;
      esc := sic;
      while (sic = esc) do
      begin
        esc := InventoryCount;
        case random(10) + 1 of
          2: MouseBox(msx1, msy1, msx2, msy2, 3);
          8: MouseBox(mix1, miy1, mix2, msy2, 3);
        end;
        if not(FindPick) or (GasColors(gx, gy)) or (FindNormalRandoms) or
          (FindTheFight) or (TimeFromMark(Maxmm) >= 20000) then
            break;
      end;
      Wait(300 + Random(500));
    end;

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    what I do for my scripts right now, i don't know a lot of scripting, so what i do is have it repeat until(inchat 'your inventory is too full to hold any more ores') or whatever it says. thats probably not the best way to do it, but your just making a simple power miner so that should do I'd think. just hope nobody says that in chat lol.

  3. #3
    Join Date
    Dec 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The problem must be here, because the loop is breaking each time through.
    SCAR Code:
    if not(FindPick) or (GasColors(gx, gy)) or (FindNormalRandoms) or
      (FindTheFight) or (TimeFromMark(Maxmm) >= 20000) then
        break;
    What I would do is change the code to
    SCAR Code:
    if not(FindPick)then
    begin
      Writeln('Broke because FindPick returned false');
      break;
    end else if(GasColors(gx, gy))then
    begin
      Writeln('Broke because GasColors returned true');
      break;
    end else if(FindNormalRandoms)then
    begin
      Writeln('Broke because FindNormalRandoms returned true');
      break;
    end else if(FindTheFight)then
    begin
      Writeln('Broke because FindTheFight returned true');
      break;
    end else if(TimeFromMark(Maxmm) >= 20000)then
    begin
      Writeln('Broke because TimeFromMark(Maxmm) is greater than 20000');
      break;
    end;
    Now you just run the script, and can read where the error is.

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
  •