I have a problem with some (easy) visibility-switching.
There is one other "gauge" which is conected to the aircrafts battery and light panels. It generates AM-variables for use with all my other gauges. It works clean.
Now, with my actual gauge-project I have the following problem:
I have verified, that the "server-gauge" delivers the variables.
Given this, my intention is to switch graphics depending on the variable light setting.
Following code "works" but nothing happens:
Code: Select all
function new_OhdKnobAngle(lights_master, ohd_knob_angle)
if lights_master == 1 then -- if lights are to be processed...
for myCnt = 10,90,10 do
if myCnt == ohd_knob_angle then
visible("L_opaque" .. myCnt .. ".png",true) -- make the image visible
-- print("L_opaque" .. myCnt .. ".png -> true")
if myCnt <= 80 then myCnt = myCnt + 10 else break end
else
visible("L_opaque" .. myCnt .. ".png",false) -- make all other images invisible
-- print("L_opaque" .. myCnt .. ".png -> false")
end
end
else
for myCnt = 10,90,10 do
visible("L_opaque" .. myCnt .. ".png",false)
end
end
end
All strings and variables are treated as intended.
Only the visible-command with the "concatenated" filename appears to do... nothing
I verified that the files are all present and the required names do exist, as well as the filenames do match (name, upper and lower-case).
For example:
lights_master is 1 -> light settings have to be processed
ohd_knob_angle is 70 -> the image with the name "L_opaque70.png" shall be visible and the others "10,20,30,40,50,60,80,90" shall be invisible.
visible("L_opaque" .. myCnt .. ".png",true) doesn't work for 70.
visible("L_opaque" .. myCnt .. ".png",false) doesn't work for the rest.
Where is my problem?