People say that "Until(False)" is bad when you are repeating a main loop.
I was wondering about the whole "Until(KeyIsDown)" or whatever one? What is it, so like it repeats until I press "F1" for example.
People say that "Until(False)" is bad when you are repeating a main loop.
I was wondering about the whole "Until(KeyIsDown)" or whatever one? What is it, so like it repeats until I press "F1" for example.
Jus' Lurkin'
Example:
Closest i could get sorrySCAR Code:Repeat
writeLn('jjj');
Until(IsKeyDown('s'));.
SCAR Code:Repeat
WriteLn('Thanks MasterKill');
Until(IsFKeyDown(1))
Thanks![]()
Jus' Lurkin'
Just to expand, until(false) is only bad when you don't have anything else to stop the script. Some people choose to do until(false) then have after every NextPlayer(false) a check to make sure there are still active players, such as:
So that goes through all the players checking if they are active and if one of them is, then it breaks the while loop, making the check afterwards false, thus not running it. However, if none of the players are active, then i will keep going until it is equal to or bigger than the number of players, then it will mean that there are no more players to check, and as i will then be equal to or bigger than the total players, it will mean that the check is returned true and the script is terminated with a Writeln to inform the user. Of course, it is quite long, so it will normally be put into a procedure like CusNextPlayFalse or something like thatSCAR Code:NextPlayer(false);
i := 0;
while i < GetArrayLength(Players) do
if Players[i].Active = True then
Break
else
i := 1 + 1;
if i >= GetArrayLength(Players) then
begin
Writeln('No more active players, terminating script');
TerminateScript;
end;![]()
By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.
IsFKeyDown is not very stable ATM, sometimes it finds a key is down when it really is not... so be sure not to use in a script you want a 24+ hour proggy for![]()
Send SMS messages using Simba
Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!



Why is it not stable? It only finds a key down if you recently pressed the key before running the function, then it doesn't recognize that it's down until you actually press it. So you'd have to do something like this:At least that's how it works for IsKeyDown...SCAR Code:program New;
begin
IsFKeyDown(2);
while not IsFKeyDown(2) do
wait(100);
end.
There are currently 1 users browsing this thread. (0 members and 1 guests)