Jump to content
The simFlight Network Forums

Recommended Posts

Posted

LUA script for the famous A2A Accusim Spifire.

-- List of parameters

--

-- 1 Generator on

-- 2 Generator off

-- 3 Generator Toggle

--

-- 4 Primerstate open

-- 5 Primerstate closed

-- 6 Primerstate toggle

-- 7 Priming

-- 8 Primer releasing and priming

--

-- 9 open Lid and starter ON

-- 10 starter OFF and close Lid

--

-- 15 Boost cut out off

-- 16 Boost cut out on

-- 17 Boost cut out toggle

--

-- 20 Mixture ratio lever weak

-- 21 Mixture ratio lever rich

-- 22 Mixture ratio lever toggle

--

-- 23 Top (Left) Fuel Selector ON

-- 24 Top (Left) Fuel Selector OFF

-- 25 Top (Left) Fuel Selector toggle

--

-- 26 Bottom (right) Fuel Selector ON

-- 27 Bottom (right) Fuel Selector Off

-- 28 Bottom (right) Fuel Selector toggle

--

-- 30 Ventral recog light "Beacon" steady

-- 31 Ventral recog light "Beacon" OFF

-- 32 Ventral recog light "Beacon" morse

--

-- 33 dorsal recog light steady

-- 34 dorsal recog light OFF

-- 35 dorsal recog light morse

--

-- 36 morse key

-- 37 morse key on

-- 38 morse key off

--

-- 40 Landing light extending

-- 41 Landing light retracting

-- 42 Landing light ext/retr toggle

--

-- 43 Left Landing light ON

-- 44 Left Landing light OFF

-- 45 Right Landing light ON

-- 46 Right Landing light OFF

--

-- 50 Left Landing light extend and ON

-- 51 Left Landing light retract and OFF

-- 52 right Landing light extend and ON

-- 53 right Landing light retract and OFF

--

-- 55 LL Beam up

-- 56 LL Beam down

--

-- 60 Defroster inc

-- 61 Defroster dec

--

-- 62 Gunsight ON

-- 63 Gunsight OFF

-- 64 Gunsight Toggle

--

-- 70 Oxy Alt Valve set inc

-- 71 Oxy Alt Valve set dec

-- 72 Oxymask and valve on/open

-- 73 Oxymask and valve off/closed

--

-- 80 Bottom Tank Fuel state (for 5 seconds)

-- 81 Bottom Tank Fuel state ON (for ON/OFF toggle switches)

-- 82 Bottom Tank Fuel state OFF (for ON/OFF toggle switches)

--

-- 83 top Tank Fuel state (for 5 seconds)

-- 84 top Tank Fuel state ON (for ON/OFF toggle switches)

-- 85 top Tank Fuel state OFF (for ON/OFF toggle switches)

--

-- 90 Engine cut out on

-- 91 Engine cut out off

-- 92 Engine cut out toggle

--

-- 95 Engine cartridge reload switch or starting magneto (depends on model)

--

--100 APU on

--101 APU ott

--102 APU toggle

--

-- 105 Cabin Vent inc

-- 106 Cabin Vent dec

--

-- 110 Landing gear silencer switch

Have fun!

-- A2A Spitfire accusim

-- LUA Script V 1.0
-- updated: Sunday, 24th Oct
-- 
-- (C) Guenter Steiner/guenseli

-- List of parameters
--

-- 1 Generator on
-- 2 Generator off
-- 3 Generator Toggle
--
-- 4 Primerstate open
-- 5 Primerstate closed
-- 6 Primerstate toggle
-- 7 Priming
-- 8 Primer releasing and priming
--
-- 9 open Lid and starter ON
-- 10 starter OFF and close Lid
--
-- 15 Boost cut out off
-- 16 Boost cut out on
-- 17 Boost cut out toggle
--
-- 20 Mixture ratio lever weak
-- 21 Mixture ratio lever rich
-- 22 Mixture ratio lever toggle
--
-- 23 Top (Left) Fuel Selector ON
-- 24 Top (Left) Fuel Selector OFF
-- 25 Top (Left) Fuel Selector toggle
--
-- 26 Bottom (right) Fuel Selector ON
-- 27 Bottom (right) Fuel Selector Off
-- 28 Bottom (right) Fuel Selector toggle
--
-- 30 Ventral recog light "Beacon" steady
-- 31 Ventral recog light "Beacon" OFF
-- 32 Ventral recog light "Beacon" morse
--
-- 33 dorsal recog light  steady
-- 34 dorsal recog light  OFF
-- 35 dorsal recog light  morse
--
-- 36 morse key
-- 37 morse key on
-- 38 morse key off
--
-- 40 Landing light extending
-- 41 Landing light retracting
-- 42 Landing light ext/retr toggle
--
-- 43 Left Landing light ON
-- 44 Left Landing light OFF
-- 45 Right Landing light ON
-- 46 Right Landing light OFF
--
-- 50 Left Landing light extend and ON
-- 51 Left Landing light retract and OFF
-- 52 right Landing light extend and ON
-- 53 right Landing light retract and OFF
--
-- 55 LL Beam up
-- 56 LL Beam down
--
-- 60 Defroster inc
-- 61 Defroster dec
--
-- 62 Gunsight ON
-- 63 Gunsight OFF
-- 64 Gunsight Toggle
--
-- 70 Oxy Alt Valve set inc
-- 71 Oxy Alt Valve set dec
-- 72 Oxymask and valve on/open
-- 73 Oxymask and valve off/closed
--
-- 80 Bottom Tank Fuel state (for 5 seconds)
-- 81 Bottom Tank Fuel state ON (for ON/OFF toggle switches)
-- 82 Bottom Tank Fuel state OFF (for ON/OFF toggle switches)
--
-- 83 top Tank Fuel state (for 5 seconds)
-- 84 top Tank Fuel state ON (for ON/OFF toggle switches)
-- 85 top Tank Fuel state OFF (for ON/OFF toggle switches)
--
-- 90 Engine cut out on 
-- 91 Engine cut out off 
-- 92 Engine cut out toggle
--
-- 95 Engine cartridge reload switch or starting magneto (depends on model)
--
--100 APU on
--101 APU ott
--102 APU toggle
--
-- 105 Cabin Vent inc
-- 106 Cabin Vent dec
--
-- 110 Landing gear silencer switch
-------------------------------------------------------------- GEN

-- Generator ON
if ipcPARAM == 1 then


    LVarSet = "L:Eng1_GeneratorSwitch"


    ipc.writeLvar(LVarSet, 1)

end



-- Generator off
if ipcPARAM == 2 then


    LVarSet = "L:Eng1_GeneratorSwitch"


    ipc.writeLvar(LVarSet, 0)

end



-- Generator toggle
if ipcPARAM == 3 then


    LVarSet = "L:Eng1_GeneratorSwitch"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end

-------------------------------------------------------------- Primer

-- Primerstate open
if ipcPARAM == 4 then


    LVarSet = "L:PrimerState"


    ipc.writeLvar(LVarSet, 1)

end



-- Primerstate closed
if ipcPARAM == 5 then


    LVarSet = "L:PrimerState"


    ipc.writeLvar(LVarSet, 0)

end



-- Primerstate toggle
if ipcPARAM == 6 then


    LVarSet = "L:PrimerState"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end



-- Priming
if ipcPARAM == 7 then


    LVarSet = "L:PrimerState"


    ipc.writeLvar(LVarSet, 2)

end



-- Primer releasing and priming
if ipcPARAM == 8 then



    LVarSet = "L:PrimerState"


	if ipc.readLvar(LVarSet) == 0 then

    	ipc.writeLvar(LVarSet, 1)
	ipc.sleep(1300)
	end

	ipc.writeLvar(LVarSet, 2)	


end

-------------------------------------------------------------- Starter

-- open Lid and starter ON
if ipcPARAM == 9 then






	ipc.writeLvar("L:Eng1StarterSwitchLid", 1)
	ipc.sleep(200)

	ipc.writeLvar("L:Eng1StarterSwitch", 1)

end


-- starter OFF and close Lid
if ipcPARAM == 10 then


	ipc.writeLvar("L:Eng1StarterSwitch", 0)
    	ipc.sleep(500)

	ipc.writeLvar("L:Eng1StarterSwitchLid", 0)


end





-------------------------------------------------------------- Boost Cut out

-- Boost cut out off
if ipcPARAM == 15 then


    LVarSet = "L:BoostCutout"


    ipc.writeLvar(LVarSet, 1)

end



-- Boost cut out on
if ipcPARAM == 16 then


    LVarSet = "L:BoostCutout"


    ipc.writeLvar(LVarSet, 0)

end



-- Boost cut out toggle
if ipcPARAM == 17 then


    LVarSet = "L:BoostCutout"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end



-------------------------------------------------------------- Mixture


-- Mixture ratio lever weak
if ipcPARAM == 20 then


    LVarSet = "L:MixtureRatioLever1Position"


    ipc.writeLvar(LVarSet, 1)

end


-- Mixture ratio lever rich
if ipcPARAM == 21 then


    LVarSet = "L:MixtureRatioLever1Position"


    ipc.writeLvar(LVarSet, 0)

end


-- Mixture ratio lever toggle
if ipcPARAM == 22 then


    LVarSet = "L:MixtureRatioLever1Position"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end

-------------------------------------------------------------- Fuel Selectors


-- Top (Left) Fuel Selector ON
if ipcPARAM == 23 then


    LVarSet = "L:FuelSelTop"


    ipc.writeLvar(LVarSet, 1)

end



-- Top (Left) Fuel Selector off
if ipcPARAM == 24 then


    LVarSet = "L:FuelSelTop"


    ipc.writeLvar(LVarSet, 0)

end



-- Top (Left) Fuel Selector toggle
if ipcPARAM == 25 then


    LVarSet = "L:FuelSelTop"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end

--------------------------------


-- Bottom (right) Fuel Selector ON
if ipcPARAM == 26 then


    LVarSet = "L:FuelSelBott"


    ipc.writeLvar(LVarSet, 1)

end



-- Bottom (right) Fuel Selector off
if ipcPARAM == 27 then


    LVarSet = "L:FuelSelBott"


    ipc.writeLvar(LVarSet, 0)

end



-- Bottom (right) Fuel Selector toggle
if ipcPARAM == 28 then


    LVarSet = "L:FuelSelBott"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end



-------------------------------------------------------------- lights



-- Ventral recog light "Beacon" steady
if ipcPARAM == 30 then


    LVarSet = "L:LightRecogVentralSwitch"


    ipc.writeLvar(LVarSet, 0)

end


-- Ventral recog light "Beacon" off
if ipcPARAM == 31 then


    LVarSet = "L:LightRecogVentralSwitch"


    ipc.writeLvar(LVarSet, 1)

end



-- Ventral recog light "Beacon" morse
if ipcPARAM == 32 then


    LVarSet = "L:LightRecogVentralSwitch"


    ipc.writeLvar(LVarSet, 2)

end

----------------------------------------------

-- dorsal recog light  steady
if ipcPARAM == 33 then


    LVarSet = "L:LightRecogDorsalSwitch"


    ipc.writeLvar(LVarSet, 0)

end


-- dorsal recog light off
if ipcPARAM == 34 then


    LVarSet = "L:LightRecogDorsalSwitch"


    ipc.writeLvar(LVarSet, 1)

end



-- dorsal recog light morse
if ipcPARAM == 35 then


    LVarSet = "L:LightRecogDorsalSwitch"


    ipc.writeLvar(LVarSet, 2)

end

---------------------------------------------- morse

-- morse key
if ipcPARAM == 36 then


    LVarSet = "L:KeyMorseArm"

	ipc.writeLvar(LVarSet, 1)
	ipc.sleep(100)
    ipc.writeLvar(LVarSet, 0)

end


-- morse key on
if ipcPARAM == 37 then


    LVarSet = "L:KeyMorseArm"

	ipc.writeLvar(LVarSet, 1)

end

-- morse key off
if ipcPARAM == 38 then


    LVarSet = "L:KeyMorseArm"

	ipc.writeLvar(LVarSet, 0)

end

----------------------------------------------

-- Landing light extending
if ipcPARAM == 40 then


    LVarSet = "L:LandingLightExtendSwitch"


    ipc.writeLvar(LVarSet, 1)

end

-- Landing light retracting
if ipcPARAM == 41 then


    LVarSet = "L:LandingLightExtendSwitch"


    ipc.writeLvar(LVarSet, 0)

end


-- Landing light ext/retr toggle
if ipcPARAM == 42 then


    LVarSet = "L:LandingLightExtendSwitch"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end

----------------------------------------------

-- Left Landing light ON
if ipcPARAM == 43 then


    LVarSet = "L:LandingLightSwitch"


    ipc.writeLvar(LVarSet, 0)

end


-- Left Landing light OFF
if ipcPARAM == 44 then


    LVarSet = "L:LandingLightSwitch"


    ipc.writeLvar(LVarSet, 1)

end

-- Right Landing light ON
if ipcPARAM == 45 then


    LVarSet = "L:LandingLightSwitch"


    ipc.writeLvar(LVarSet, 2)

end


-- Right Landing light OFF
if ipcPARAM == 46 then


    LVarSet = "L:LandingLightSwitch"


    ipc.writeLvar(LVarSet, 1)

end

----------------------------------------------

-- Left Landing light extend and ON
if ipcPARAM == 50 then


    ipc.writeLvar("L:LandingLightExtendSwitch", 1)
	ipc.sleep(100)

    ipc.writeLvar("L:LandingLightSwitch", 0)  

end



-- left Landing light retract and OFF
if ipcPARAM == 51 then


    ipc.writeLvar("L:LandingLightSwitch", 1)
	ipc.sleep(100)

    ipc.writeLvar("L:LandingLightExtendSwitch", 0)  

end


-- right Landing light extend and ON
if ipcPARAM == 52 then


    ipc.writeLvar("L:LandingLightExtendSwitch", 1)
	ipc.sleep(100)

    ipc.writeLvar("L:LandingLightSwitch", 2)  

end



-- right Landing light retract and OFF
if ipcPARAM == 53 then


    ipc.writeLvar("L:LandingLightSwitch", 1)
	ipc.sleep(100)

    ipc.writeLvar("L:LandingLightExtendSwitch", 0)  

end

----------------------------------------


-- LL Beam up
if ipcPARAM == 55 then

	LLBeam = "L:LeverLandingLightBeam"
	Var = ipc.readLvar(LLBeam)

	if Var < 100 then
	Var = Var + 1
	ipc.sleep(1)
	end

	ipc.writeLvar(LLBeam, Var)

end


-- LL Beam down
if ipcPARAM == 56 then

	LLBeam = "L:LeverLandingLightBeam"
	Var = ipc.readLvar(LLBeam)

	if Var > 0 then
	Var = Var - 1
	ipc.sleep(1)
	end

	ipc.writeLvar(LLBeam, Var)

end



-------------------------------------------------------------- Defroster
-- defroster inc
if ipcPARAM == 60 then

	Def = "L:WindowDefrosterSwitch"

	ipc.writeLvar(Def, 1)

end


-- defroster inc
--if ipcPARAM == 60 then

--	Def = "L:WindowDefrosterControlKnob"
--	Var = ipc.readLvar(Def)

--	if Var < 100 then
--	Var = Var + 10
--	ipc.sleep(1)
--	end

--	ipc.writeLvar(Def, Var)

--end



-- defroster dec
if ipcPARAM == 61 then

	Def = "L:WindowDefrosterSwitch"


	ipc.writeLvar(Def, 0)

end

-------------------------------------------------------------- Gunsight switch

-- Gunsight ON
if ipcPARAM == 62 then


    LVarSet = "L:GunSightSwitchOn"


    ipc.writeLvar(LVarSet, 1)

end



-- Gunsight off
if ipcPARAM == 63 then


    LVarSet = "L:GunSightSwitchOn"


    ipc.writeLvar(LVarSet, 0)

end



-- Gunsight toggle
if ipcPARAM == 64 then


    LVarSet = "L:GunSightSwitchOn"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end





-------------------------------------------------------------- oxygen


-- oxy alt set inc
if ipcPARAM == 70 then

	Oxy = "L:OxyAltSetValve"
	Var = ipc.readLvar(Oxy)

	if Var < 100 then
	Var = Var + 1
	ipc.sleep(1)
	end

	ipc.writeLvar(Oxy, Var)

end


-- oxy alt set dec
if ipcPARAM == 71 then

	Oxy = "L:OxyAltSetValve"
	Var = ipc.readLvar(Oxy)

	if Var > 0 then
	Var = Var - 1
	ipc.sleep(1)
	end

	ipc.writeLvar(Oxy, Var)

end


-------------------------------------------------------------- Oxymask and valve

-- Oxy mask and valve ON
if ipcPARAM == 72 then





	  ipc.writeLvar("L:SystemCondValueFSX", 1)
	ipc.writeLvar("L:SystemCondSelectFSX", 58)



	ipc.sleep(1000)



	if ipc.readLvar("L:OxyMaster") >= 0 then	

	i = 0
	while i < 100 do
   ipc.writeLvar("L:OxyMaster", i)
      ipc.sleep(1)


   	i = i + 10
	end

	end
end









-- Oxy mask and valve off
if ipcPARAM == 73 then


	  ipc.writeLvar("L:SystemCondValueFSX", 0)
	ipc.writeLvar("L:SystemCondSelectFSX", 58)



	ipc.sleep(1000)



	if ipc.readLvar("L:OxyMaster") <= 100 then	

	i = 100
	while i >= 0 do
   ipc.writeLvar("L:OxyMaster", i)
      ipc.sleep(1)


   	i = i - 10
	end

	end
end







-------------------------------------------------------------- Bottom tank state

-- Bottom tank state for 5 seconds ON
 if ipcPARAM == 80 then


	LVarSet = "L:BottTankOn"


	ipc.writeLvar(LVarSet, 1)
	ipc.sleep(5000)
	ipc.writeLvar(LVarSet, 0)


 end


-- Bottom tank state  ON
if ipcPARAM == 81 then


	LVarSet = "L:BottTankOn"


	ipc.writeLvar(LVarSet, 1)

 end


-- Bottom tank state  OFF
 if ipcPARAM == 82 then


	LVarSet = "L:BottTankOn"


	ipc.writeLvar(LVarSet, 0)

 end



-------------------------------------------------------------- Top tank state

-- Top tank state for 5 seconds ON
 if ipcPARAM == 83 then


	LVarSet = "L:TopTankOn"


	ipc.writeLvar(LVarSet, 1)
	ipc.sleep(5000)
	ipc.writeLvar(LVarSet, 0)


 end


-- Top tank state  ON
if ipcPARAM == 84 then


	LVarSet = "L:TopTankOn"


	ipc.writeLvar(LVarSet, 1)

 end


-- Top tank state  OFF
 if ipcPARAM == 85 then


	LVarSet = "L:TopTankOn"


	ipc.writeLvar(LVarSet, 0)

 end


-------------------------------------------------------------- Engine cut out

-- Engine cut out ON
if ipcPARAM == 90 then


    LVarSet = "L:SlowRunningCutoutSwitch"


    ipc.writeLvar(LVarSet, 1)

end



-- Engine cut out off
if ipcPARAM == 91 then


    LVarSet = "L:SlowRunningCutoutSwitch"


    ipc.writeLvar(LVarSet, 0)

end



-- Engine cut out toggle
if ipcPARAM == 92 then


    LVarSet = "L:SlowRunningCutoutSwitch"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

end

-------------------------------------------------------------- Engine cartridge reload switch

if ipcPARAM == 95 then

  acftname = ipc.readSTR(0x3D00, 35)

  if string.find(acftname,"Mk Ia",0,true)
  then
    LVarSet = "Eng1StartingMagneto"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)

  else
    LVarSet = "L:Eng1StarterCartridgeReloadSwitch"
    ipc.writeLvar(LVarSet, 1)
  end
--ipc.display(acftname)
--ipc.sleep(2000)

end

-------------------------------------------------------------- APU

-- APU ON
if ipcPARAM == 100 then


    LVarSet = "L:APUSwitch"


    ipc.writeLvar(LVarSet, 1)
    ipc.writeLvar("L:SystemCondValueFSX", 1)
	ipc.writeLvar("L:SystemCondSelectFSX", 53)

end



-- APU off
if ipcPARAM == 101 then


    LVarSet = "L:APUSwitch"


    ipc.writeLvar(LVarSet, 0)
    ipc.writeLvar("L:SystemCondValueFSX", 0)
	ipc.writeLvar("L:SystemCondSelectFSX", 53)

end



-- APU toggle
if ipcPARAM == 102 then


    LVarSet = "L:APUSwitch"
    val = 0

    if ipc.readLvar(LVarSet) == 0  then
    val = 1
    end

    ipc.writeLvar(LVarSet, val)
    ipc.writeLvar("L:SystemCondValueFSX", val)
	ipc.writeLvar("L:SystemCondSelectFSX", 53)

end

-------------------------------------------------------------- Cabin Vent


-- vent inc
if ipcPARAM == 105 then

	Def = "L:CabinVent"
	Var = ipc.readLvar(Def)

	if Var < 100 then
	Var = Var + 10
	ipc.sleep(1)
	end

	ipc.writeLvar(Def, Var)

end


-- vent dec
if ipcPARAM == 106 then

	Def = "L:CabinVent"
	Var = ipc.readLvar(Def)

	if Var > 0 then
	Var = Var - 10
	ipc.sleep(1)
	end

	ipc.writeLvar(Def, Var)

end


-------------------------------------------------------------- Landing gear silencer

-- LG silencer ON
if ipcPARAM == 110 then


    LVarSet = "L:GearHornSilencerSwitch"


    ipc.writeLvar(LVarSet, 1)

end

Posted

Exactly what I was looking for !

You're a genious, big thanks.

May I be so free to ask how you did find out these lua paramater commands ? Is it by trial and error, or is there some easier way to determine the parameter values ?

Just asking cause I'm a beginning FSUIPC user and this knowledge might be interesting to have to make scripts myself for other aircrafts.

Thanks.

TJ

  • 1 month later...

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.