HowTo:Use conditional structures
#if
The #if statement can only evaluate floating point expressions. There is no boolean logic using and, or or not. The equivalent must be achieved using arithmetic.
Here's an example of and where a rotation (for a texture, say) depends on both the row and column. Enclosing both the conditions in brackets isolates them and each produces either 0 or 1. Summing them will give 0, 1 or 2. The rotation will occur when both are true, producing 2.
#local fRotateY = 0;
// If Row = 1 and Col = 4
#if ((uiRow = 1) + (uiCol = 4) = 2)
// Rotates only row 1, column 4.
#local fRotateY = 45;
#end
And here's an example of or where the rotation depends on the column having either of two values. Again, enclosing both the conditions in brackets isolates them and each produces either a 0 or a 1. Summing them will give 0, 1 or 2. The rotation will occur when either or both are true and they produce 1 or 2. Note that the > 0 is optional and just a matter of style.
#local fRotateY = 0;
// If Row = 1 or Col = 6
#if ((uiRow = 1) + (uiCol = 6) > 0)
// Rotates all of row 1 and all of column 6
#local fRotateY = 45;
#end
And here's a truly ugly looking case which uses both. This is when you start wishing that they'd introduce a boolean type. ;-)
#local fRotateY = 0;
// If (Row = 1 and Col = 4) or Col = 6
#if (((uiRow = 1) + (uiCol = 4) = 2) + (uiCol = 6) > 0)
// Rotates row 1, column 4 and all of column 6
#local fRotateY = 45;
#end