Results 1 to 8 of 8

Thread: WaitColor and WaitFindColor Fixed

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

    Default WaitColor and WaitFindColor Fixed

    Yesterday, I made some functions and they all ready existed and RM showed me them.
    I tested them out and they didnt work =/
    I edited them and now they work so here they are.

    SCAR Code:
    {*******************************************************************************
    Function WaitColor(x, y, Color, Tol, MaxTime: integer): Boolean;
    By: Rasta Magician fixed by TRiLeZ
    Description: Waits for a color at (x, y) with tolerance Tol, returns true if found
    *******************************************************************************}

    Function WaitColor(x, y, Color, Tol, MaxTime: integer): Boolean;
    var  
      Time: integer;
    begin  
      Result := False;  
      Time := GetSystemTime + MaxTime;  
      repeat
      if SimilarColors(GetColor(x, y), Color, Tol) then    
      begin      
        Result := True;      
        Exit;    
      end else
      Wait(1);
      until (Time < GetSystemTime);
    end;

    {*******************************************************************************
    Function WaitFindColor(var x, y: integer; Color, Tol, x1, y1, x2, y2, MaxTime: integer): Boolean;
    By: Rasta Magician fixed by TRiLeZ
    Description: Waits for a color at (x1, y1, x2, y2) with tolerance Tol, returns true if found, coords returned to (x, y)
    *******************************************************************************}

    Function WaitFindColor(var x, y: integer; Color, x1, y1, x2, y2, Tol, MaxTime: integer): Boolean;
    var  
      Time: integer;
    begin  
      Result := False;  
      Time := GetSystemTime + MaxTime;  
      repeat
      if FindColorTolerance(x, y, Color, x1, y1, x2, y2, Tol) then    
      begin      
        Result := true;      
        exit;    
      end else
      Wait(1);
      until (GetSystemTime < Time);
    end;

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

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

    Default

    Quote Originally Posted by EvilChicken! View Post
    Thanks for pointing this out, TRiLeZ. I'll fix this briefly.
    I already fixed it...

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

    Default

    I think he meant he would commit it briefly.

  5. #5
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Fix the bug in SRL.

    Which by the way is done now.
    Thanks again.

  6. #6
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    errr... the only change is While do -> repeat until?

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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

    Default

    Quote Originally Posted by Rasta Magician View Post
    errr... the only change is While do -> repeat until?

    ~RM
    And some wait time so it dosnt freeze up.

  8. #8
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

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
  •