[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
Better wording and correct section
imported>Sarkandar |
imported>JOG (Better wording and correct section) |
||
Line 81: | Line 81: | ||
This is true when either myVar2 is 5 OR both, myVar1 and myVar2 are 1 | This is true when either myVar2 is 5 OR both, myVar1 and myVar2 are 1 | ||
---- | |||
Note also, that Oblivion evaluates all parts of an IF-statement. When you combine expressions with "&&" for example and the first expression is false, then the second one will still be evaluated. | |||
If ReferenceVariable != 0 && ReferenceVariable.Getav Health < 30 | |||
Will crash Oblivion when the reference variable is undefined ("0"), because the second part is evaluated although the first part already returned "false". In such cases you need to use nested IF-blocks instead: | |||
If ReferenceVariable != 0 | |||
If ReferenceVariable.Getav Health < 30 | |||
Line 131: | Line 142: | ||
After the condition or the "else" statement the rest of the line is ignored. There aren't any error messages to warn you, so (since the line appears to be correct) you might spend a lot of time locating the source of the problem. | After the condition or the "else" statement the rest of the line is ignored. There aren't any error messages to warn you, so (since the line appears to be correct) you might spend a lot of time locating the source of the problem. | ||
[[Category:Commands]] | [[Category:Commands]] |