This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.

Difference between revisions of "If"

Jump to navigation Jump to search
55 bytes added ,  10:09, 13 December 2009
m
imported>Thalassicus
imported>Thalassicus
Line 80: Line 80:
=== Oblivion evaluates entire If statement ===
=== Oblivion evaluates entire If statement ===


Oblivion evaluates all the conditions for an IF statement. For example, when you combine expressions with "&&", if the first expression is false, later expressions will still be evaluated, even though they are irrelevant (false && anything = always false, true || anything = always true).
Oblivion evaluates all the conditions for an IF statement. For example, when you combine expressions with "&&", if the first expression is false, later expressions will still be evaluated, even though they are irrelevant (false && anything = always false, true || anything = always true). This results in more code being processed than necessary, and more lag.


This can also result in unexpected errors, such as below:
This can also result in unexpected errors, such as below:
Line 91: Line 91:
     If ReferenceVariable.Getav Health < 30
     If ReferenceVariable.Getav Health < 30


Since boolean conditions (&& ||) are inefficient and implemented poorly in Oblivion, use nested IF-blocks whenever possible.
Since boolean operators (&& ||) are implemented poorly in Oblivion, use nested IF-blocks whenever possible.


== Comparisons and Expressions ==
== Comparisons and Expressions ==
Anonymous user

Navigation menu