[dismiss]
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
m
→Oblivion evaluates entire If statement
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 | Since boolean operators (&& ||) are implemented poorly in Oblivion, use nested IF-blocks whenever possible. | ||
== Comparisons and Expressions == | == Comparisons and Expressions == |