Results 1 to 10 of 10

Thread: Is it possible to do this?

  1. #1
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Is it possible to do this?

    Code:
    until((failtwo>50) or findbitmaptoleranceIn(ore, x, y, MIX1, MIY1, MIX2, MIY2, 10, False));
    Is it possible to repeat until either fail two is greater than 50 OR until 'ore' can no longer be found?

    If not any alternatives to what I'm trying to achieve would be greatly appreciated!

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Seems fine to me.. if failtwo > 50, the loop will break OR if the bitmap is found, the loop will break.

    I'd probably use a timer.. MarkTime(T)... Do Loop while (TimeFromMark(T) < 20000).. thats 20 seconds..

    Though I think failtwo > 50 is a large condition. Are you really going to try 50 times before giving up?
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Yeah it's possible I believe.
    What's wrong wit the code you have?

    Also you can use a break (which ends a loop too).
    Like inside the loop (after the repeat, before the until) put If FailTwo>50 then Break
    or the findbitmap.
    Know though that after that script will do whatever it is told to do next after the loop, so you may need a failsafe.

  4. #4
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Code:
    if (FindBitmapToleranceIn(ore, x, y, MIX1, MIY1, MIX2, MIY2, 10)) then
      begin
      repeat
      failtwo:=(failtwo+1)
      wait(350+random(200));
            Case (random(200)) of
              1..2: mmouse(x-64, y-146, 90, 40);
              2..3: mmouse(x+116, y+15, 30, 60);
              4..5: mmouse(x+326, y-353, 90, 90);
              6..7: mouse(531, 96, 5, 5, true);
              8..9: mouse(531, 63, 5, 5, true);
            end;
        writeln('Failed:' +toStr (failtwo));
      until((failtwo>50) or findbitmaptoleranceIn(ore, x, y, MIX1, MIY1, MIX2, MIY2, 10, False));
      end;
    [Error] (438:92): Invalid number of parameters at line 437

    This is the error - line 438 is 'until' statement.

    Thanks for the help though, ill use a break until i get it sorted (Still don't understand how to make it stop if it cannot find the ore using 'findbitmaptoleranceIn' though)

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Not sure what/if you need that false in FindBitmapToleranceIn? Look up it's parameters.

  6. #6
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    The parameters are: function FindBitmapToleranceIn(bitmap: integer; var x, y,: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;

    I thought that booleans returned either true or false, so is it possible to loop until it returns false?

  7. #7
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    The function itself is a boolean!
    So just findbitmaptoleranceIn(ore, x, y, MIX1, MIY1, MIX2, MIY2, 10) is enough!

  8. #8
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Yes I know lol, but i only want it to end if it returns false (it cannot find the ore) - is this possible?

  9. #9
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Simba Code:
    until( (failtwo>50) or  (NOT (findbitmaptoleranceIn(ore, x, y, MIX1, MIY1, MIX2, MIY2, 10, False))));
    Like that.
    With a NOT!

  10. #10
    Join Date
    Oct 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    It works!

    Thanks heaps for the help!!!

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
  •