Conditional display (ASM tweak)
With MakeMDL 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 that Christmas tree that you want to 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:
IFIN1 labelname, var, con1, con2 ; the code you want only to display at the certain condition labelname label word
So you must first find the code of the object(s) you want to apply the condition to. After that you place the IFIN1 command in front of it. This command has four parameters. The first one is the label that is jumped to if the condition is not met. This is the label you need to place behind the object you want to apply the condition to. All names of labels must be unique, so if you add conditions to different objects in one source, make sure you give all the labels a different name. The next parameter is the variable you want to check for. The next two parameters are the minimum and the maximum value, between which the variable must be for the condition to be fulfilled.
Example: Lights at night
An example of a condition that is often applied is to make lights only display at night and at dusk/dawn. To do so you need to place a simple condition check around the lights in the source code. First look for the line that defines your light, it should look something like this:
BGL_LIGHT LIGHT_NAV, 0.0, 0.0, 0.0, 20, 0.60, 0.40, 0FF09132dh, 0.0, 0.0, 1.0
Then place the check around it, so that your code looks like this:
IFIN1 nolight, tod, 2, 4 BGL_LIGHT LIGHT_NAV, 0.0, 0.0, 0.0, 20, 0.60, 0.40, 0FF09132dh, 0.0, 0.0, 1.0 nolight label word
Example: Entire object at a certain frequency
In some other cases you want to add the condition to the entire object, not only to part of it. In that case you can best place the condition around the command where the total object is called. For this look for the piece of code similar to this:
BGL_CALL_32 My_Object_MasterScale_1 BGL_END BGL_RETURN
If we want this object to be only visible when you have tuned your NAV2 radio to the frequency of 112.00, you can add the following check around this master call:
IFIN1 no_object, 07C2h, 1200h, 1200h BGL_CALL_32 My_Object_MasterScale_1 no_object label word BGL_END BGL_RETURN