Sign in to follow this  
towzaa

Can't make switches work on Captainsim C-130

Recommended Posts

I can't make the switchs on Captainsim C-130

This my code for some switches that worked

-- ## External Lights Panel #####################################
 
function Taxi_Lights_On ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("b065SwMainVar", 1)
end
 
function Taxi_Lights_Off ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("b065SwMainVar", 0)
end
 
function Taxi_Lights_Toggle ()
if _t("taxilightstgl") then
         Taxi_Lights_On ()
else
         Taxi_Lights_Off ()
end
end
 
-----------------------------------------------------
function Landing_Lights_On ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("b068SwMainVar", 1)
      ipc.writeLvar("b069SwMainVar", 1)
end
 
function Landing_Lights_Off ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("b068SwMainVar", 0)
      ipc.writeLvar("b069SwMainVar", 0)
end
 
function Landing_Lights_Toggle ()
if _t("landlighttoggle") then
         Landing_Lights_On ()
else
         Landing_Lights_Off ()
end
end
---------------------------------------------------
function Landing_Lights_Motor_Left_On ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("switch_landing_light_motor_left", 1)
end
 
function Landing_Lights_Motor_Left_Off ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("switch_landing_light_motor_left", 0)
end
 
function Landing_Lights_Motor_Left_Toggle ()
if _t("landlightmotorlefttoggle") then
         Landing_Lights_Motor_Left_On ()
else
         Landing_Lights_Motor_Left_Off ()
end
end
-----------------------------------------------------
function Landing_Lights_Motor_Right_On ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("switch_landing_light_motor_right", 1)
end
 
function Landing_Lights_Motor_Right_Off ()
 ipc.writeLvar("iSndPl", 69)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("switch_landing_light_motor_right", 0)
end
 
function Landing_Lights_Motor_Right_Toggle ()
if _t("landlightmotorrighttoggle") then
         Landing_Lights_Motor_Right_On ()
else
         Landing_Lights_Motor_Right_Off ()
end
end
 
-- --------------------------------------------------
-- ## Temp Datum Control Valve #####################################
 
-- ENG 1
function ENG1_Auto ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x011PosRudVar", 1)
end
 
function ENG1_Locked ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x011PosRudVar", 0)
end
 
function ENG1_Null ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x011PosRudVar", -1)
end
 
-- ENG 2
function ENG2_Auto ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x012PosRudVar", 1)
end
 
function ENG2_Locked ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x012PosRudVar", 0)
end
 
function ENG2_Null ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x012PosRudVar", -1)
end
 
-- ENG 3
function ENG3_Auto ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x013PosRudVar", 1)
end
 
function ENG3_Locked ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x013PosRudVar", 0)
end
 
function ENG3_Null ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x013PosRudVar", -1)
end
 
-- ENG 4
function ENG4_Auto ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x014PosRudVar", 1)
end
 
function ENG4_Locked ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x014PosRudVar", 0)
end
 
function ENG4_Null ()
 ipc.writeLvar("iSndPl", 423)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
      ipc.writeLvar("x014PosRudVar", -1)
end
 
-- ## Low Speed Ground Idle #####################################
 
function ENG1_ON ()
 ipc.writeLvar("pRpm1ButtonPos", 1)
end
 
function ENG1_OFF ()
 ipc.writeLvar("pRpm1ButtonPos", 0)
end
 
function ENG1_TOGGLE ()
if _t("LSGI_ENG1") then
        ENG1_ON ()
else
        ENG1_OFF ()
end
end
 
function ENG2_ON ()
 ipc.writeLvar("pRpm2ButtonPos", 1)
end
 
function ENG2_OFF ()
 ipc.writeLvar("pRpm2ButtonPos", 0)
end
 
function ENG2_TOGGLE ()
if _t("LSGI_ENG2") then
        ENG2_ON ()
else
        ENG2_OFF ()
end
end
 
function ENG3_ON ()
 ipc.writeLvar("pRpm3ButtonPos", 1)
end
 
function ENG3_OFF ()
 ipc.writeLvar("pRpm3ButtonPos", 0)
end
 
function ENG3_TOGGLE ()
if _t("LSGI_ENG3") then
        ENG3_ON ()
else
        ENG3_OFF ()
end
end
 
function ENG4_ON ()
 ipc.writeLvar("pRpm4ButtonPos", 1)
end
 
function ENG4_OFF ()
 ipc.writeLvar("pRpm4ButtonPos", 0)
end
 
function ENG4_TOGGLE ()
if _t("LSGI_ENG4") then
        ENG4_ON ()
else
        ENG4_OFF ()
end
end

And for some switch that isn't worked. (Ever switches on Overhead,Aux HYD,etc.)

(I tested and nothing happens) (when i rapidly press it (button) i see it's blinking and stops when i stop pressing (stop at the same positions at when i start)

-- ## Overhead Compartment #####################################
 
function GTC_Door_Open ()
      LVarSet = "p198PosVar"
      ipc.writeLvar(LVarSet, 100)
end
 
function GTC_Door_Close ()
      LVarSet = "p198PosVar"
      ipc.writeLvar(LVarSet, 0)
end
 
function GTC_Door_Toggle ()
if _t("gtcdoor") then
        GTC_Door_Open ()
else
        GTC_Door_Close ()
end
end
 
-- ## Caution Nacelle Overheat #####################################
 
function Caution_Nacelle_Overheat_Toggle ()
      ipc.writeLvar(LVarSet, 1)
      ipc.writeLvar("p072MainPosVar", 100)
 ipc.writeLvar("iSndPl", 572)
      ipc.sleep(150)
      ipc.writeLvar("iSndPl", 0)
end

How i can get a rid of this?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this