Just use the Code tag with the icon present above the text area while writing the post, this will write the start and ending tags for code and we paste in the middle of them :
Just like this :
Code: Select all
function stbyBatt_callback(position, direction)
if position == 2 then
-- CURRENTLY IN THE ARM POSITION
if direction == -1 then
-- SWITCH IS BEING MOVED DOWN TO THE OFF POSITION
xpl_command("C172/cockpit/stbyBattDec") -- WORKS. AM AND SIM SWITCHES REACT PROPERLY. C172/cockpit/stbyBatt DATAREF VALUE CHANGES TO 0.
end
elseif position == 1 then
-- CURRENTLY IN THE OFF POSITION
if direction == 1 then
-- SWITCH IS BEING MOVED UP TO THE ARM POSITION
xpl_command("C172/cockpit/stbyBattInc") -- WORKS. AM AND SIM SWITCHES REACT PROPERLY. C172/cockpit/stbyBatt DATAREF VALUE CHANGES TO 1.
else
-- SWITCH IS BEING MOVED DOWN TO THE TEST POSITION
xpl_command("C172/cockpit/stbyBattDec") -- DOES NOT WORK. NO EFFECT IN EITHER THE AM OR SIM SWITCHES. C172/cockpit/stbyBatt DATAREF VALUE STAYS AT 0.
-- I assume their internal code that forces the automatic return to the OFF position kicks in immediately or I'm simply overlooking something.
end
end
end
stbyBatt_id = switch_add("stby_batt_test.png", "stby_batt_off.png", "stby_batt_arm.png", 0, 0, 256, 165, "VERTICAL", stbyBatt_callback)