http://villavu.com/forum/showthread.php?t=46915
SCAR Code:
{*******************************************************************************
function WaitFunc(Func: Function: Boolean; WaitPerLoop, MaxTime: Integer): Boolean;
By: Rasta Magician, small edit by EvilChicken!
Description: Waits for function Func to be true. WaitPerLoop is how often you
want to call "Func" function.
Example: "WaitFunc(@BankScreen, 10 + Random(15), 750);" will check if BankScreen
is open every 10-25th millisecond, for a maximum of 750 milliseconds.
Notice the '@'.
*******************************************************************************}
function WaitFunc(Func: Function: Boolean; WaitPerLoop, MaxTime: Integer): Boolean;
var
T: Integer;
begin
T := GetSystemTime + MaxTime;
while (GetSystemTime < T) do
begin
//to implement this idea...
if (Func() = WaitTrue) then
//if (Func()) then
begin
Result := True;
Exit;
end;
Wait(WaitPerLoop);
end;
end;
I like the idea, it'll most likely be implemented, only differently.
~RM