is it possible to interrupt a wait procedure? like if you have wait(10000);
what actions can you do to automatically stop this from reaching 10000?
is it possible to interrupt a wait procedure? like if you have wait(10000);
what actions can you do to automatically stop this from reaching 10000?
You can use a while do loop:
Simba Code:while not(whatever) do
wait(1000);
That will wait indefinitely until whatever is true. Obviously you should put in failsafes and whatnot to make sure you don't get stuck in an infinite loop.
You can use repeat until loops as well to do the same thing:
Simba Code:repeat
wait(1000);
until(whatever);
Just remember that failsafes are necessary when using loops like these.
No, you'll have to use loops like the above. I would recommend the while loop.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
It depends on what procedure you are doing. So what are you doing?
I'd recommend making a function then use WaitFunc, I personally think its more efficient.
even if you do jam it in a loop it still is actively counting to the number specified...
i dont think there is a way...
i tried
Simba Code:program new;
var
x:integer;
begin
ClearDebug
while x=0 do
begin
if iskeydown(16) then
break;
wait(10000);
if iskeydown(16) then
break;
end;
writeln('ggf')
end.
even by jamming a break loop trigger before and after the wait(); still nothing...
there should be a stopwait func...
Simba Code:var
SomeCondition: Boolean;
Function WaitSomething(TimeToWait: Integer): Boolean;
var
T: integer;
begin
Result:= False;
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (SomeCondition) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;
The above will wait until SomeCondition is set to true.. if False, it will keep repeating some procedure/function until it times out OR until somecondition which can make it break out.
The problem would be setting somecondition. See you have to set it before running the function.. OR set it during the function in the while loop.
I am Ggzz..
Hackintosher
Thats why I said it depends on what you are doing. WaitFunc is probably the best function I know as of now. It checks for the function every X time until the final time is reached. So
if waitfunc(@16keyisdown, 100, 10000) then
Exit;
It wait until the function is true, then break out of the wait.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
There are currently 1 users browsing this thread. (0 members and 1 guests)