Conditional display (SCASM tweak)
With some design programs it is not possible to specify conditions for the display of your objects (or parts of them). But how about the lights that should only be shown at night or the Christmas tree that should be displayed only in December? With a relatively simple modification to the source code it is possible to display the object only when you want it. The structure of the code is as follows:
IfVarRange( :labelname var con1 con2 ) ; the code you want only to display in the certain condition :labelname
You probably think now that such code is nice, but what do you do with it? Here are some practicle examples how you can use it.
If you want your object only to display at a certain image complexity setting you can use the IfVarRange command to display the object only at the settings you want. To do this you need to find the Area command at the begin of your object. This could look something like this:
Area( 5 %1 %2 22 ) PerspectiveCall( :Obj ) ShadowCall( :Obj )
Now at the following line to this code:
Area( 5 %1 %2 22 ) IfVarRange( : 346 3 5 ) PerspectiveCall( :Obj ) ShadowCall( :Obj )
Here a check is made if the variable 346, which is the image complexity setting, is between 3 (dense) and 5 (extremely dense). If that is true the code below it is displayed, if not a jump is made to the label :. This label is a special label that will take you to the end of the file right away.
Time of day
Another example is where you want to display a certain object only at a certain time of day. Here is a piece of code that displays a light dot:
RGBLColor( EF 195 195 195 ) Dot( 0 10 0 )
To make sure that the dot is only displayed at dusk/dawn and night you can add the following lines:
IfVarRange( :nolight 28C 2 4 ) RGBLColor( EF 195 195 195 ) Dot( 0 10 0 ) :nolight
In this case the variable for time of day (28C) is checked. If the value is between 2 (dusk/dawn) and 4 (night) the light is displayed, otherwise a jump to the label nolight is made.