Every-time

From FreeSpace Wiki
Jump to: navigation, search
every-time
    Every-time (Conditional operator)
    This is a version of "when" that will always evaluate its arguments. It's useful in situations where you need to
    repeatedly check things that may become true more than once. Since this sexp will execute every time it's evaluated,
    you may need to use it as an argument to "when" if you want to impose restrictions on how it's called.

    Takes 2 or more arguments...
    1: Boolean expression that must be true for actions to take place.
    Rest: Actions to take when boolean expression is true.

Comments

Every-time and every-time-argument should be used extremely rarely, if ever, and only with careful and cautious planning. Since these sexps will be evaluated in every single frame, they add a measurably larger performance overhead than a regular when or when-argument sexp. Worse, since framerate can vary greatly between computers and even between playthroughs, improper use of these sexps can lead to wildly unpredictable (and even incorrect) results, as was famously demonstrated in the first few versions of The Procyon Insurgency. As described in the help texts, these sexps should only be used for volatile conditions that may become true more than once.