Jump to content

Archived

This topic is now archived and is closed to further replies.

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

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    18%
    $4,720.00 of $25,000.00 Donate Now
×
×
  • Create New...