Raskolnikov
2008-11-07 00:03:25
I'm here to talk about failsafes, which make your script more efficient.
Here is the golden rule for failsafes. When using an until(false), you must always, always, always, have a failsafe. When doing multiplayer it is usually:
Now, where else do you need failsafes?
What if we log out of inactivity before the condition is met? If we didn't have our failsafe, we could have a stalled script on our hands.
Here's another example by using TimeFromMark:
Please post comments!
Cut em2 it
Here is the golden rule for failsafes. When using an until(false), you must always, always, always, have a failsafe. When doing multiplayer it is usually:
repeat
if not LoggedIn then Break; //here is the golden failsafe here, if we aren't logged in, we break out of endless loop.
//do whatever
until(false);Now, where else do you need failsafes?
procedure FailsafeTest;
begin
repeat
if not LoggedIn then Exit;
until(ConditionIsMet);
end;What if we log out of inactivity before the condition is met? If we didn't have our failsafe, we could have a stalled script on our hands.
Here's another example by using TimeFromMark:
MarkTime(Timer); //We must declare timer as an integer
repeat
DoWhatever;
until(TimeFromMark(Timer) >= 10000); //We are saying we will do "DoWhatever" until the timer is greater than or equal to 10 seconds.Please post comments!
Cut em2 it