P-40 and Prepar3d
-
- Airman Basic
- Posts: 1
- Joined: 26 Oct 2013, 04:11
Re: P-40 and Prepar3d
Thanks for info.
-
- A2A Master Mechanic
- Posts: 3396
- Joined: 02 Aug 2008, 17:04
- Location: San Francisco
Re: P-40 and Prepar3d
I haven't flown in P3D in a long time but back when I installed it and ported over my
A2A aircraft I ran into the scaling of axis issue. I created a Lua script to get around
the issue.
I'll post it here. The script also displays some of the values when changed in a small
Lua window.
Just copy and paste this into Notepad and save as a "DispP40.lua" or any name of your
choice as long as the extension is ".lua". Place it in you P3D Modules folder.
Add this entry to your FSUIPC4.ini file:
[Auto.Curtiss P-40]
1=Lua KillAll
2=Lua DispP40
This will run the lua script when you load the P40. If you change the name of the Lua script, then you need to change
it in the line above as well.
Paul
A2A aircraft I ran into the scaling of axis issue. I created a Lua script to get around
the issue.
I'll post it here. The script also displays some of the values when changed in a small
Lua window.
Code: Select all
-- A2A P-40 Lua scripts
-- Prepar3D version
-- Lat updated 09/18/2012 - P.D. Strogen
-- The following functions just briefly display the current
-- setting when the applicable function is changed.
function Vent(offset, val)
Vent_Set =ipc.readLvar("L:CabinVent")
ipc.display("Vent = "..Vent_Set, 1)
end
function Gear_Handle_Position(control, param)
Gear_Handle =ipc.readLvar("L:LandingGearLeverPos")
if Gear_Handle == 2 then x = "Down" end
if Gear_Handle == 1 then x = "Neutral" end
if Gear_Handle == 0 then x = "Up" end
ipc.display("Gear Handle = "..x, 2)
end
function Flap_Handle_Position(control, param)
Flap_Handle =ipc.readLvar("L:LandFlapsPos")
if Flap_Handle == 2 then y = "Down" end
if Flap_Handle == 1 then y = "Neutral" end
if Flap_Handle == 0 then y = "Up" end
ipc.display(" Flap Handle = "..y, 2)
end
function Handle_Positions(control, param)
Gear_Handle =ipc.readLvar("L:LandingGearLeverPos")
Flap_Handle =ipc.readLvar("L:LandFlapsPos")
if Gear_Handle == 2 then x = "Down" end
if Gear_Handle == 1 then x = "Neutral" end
if Gear_Handle == 0 then x = "Up" end
if Flap_Handle == 2 then y = "Down" end
if Flap_Handle == 1 then y = "Neutral" end
if Flap_Handle == 0 then y = "Up" end
ipc.display("Gear Handle = "..x.." Flap Handle = "..y, 2)
end
function FUEL_TANK(control, param)
FTank =ipc.readLvar("L:FSelP40State")
if FTank == 0 then x = "OFF" end
if FTank == 1 then x = "RESERVE" end
if FTank == 2 then x = "WING" end
if FTank == 3 then x = "FUSALAGE" end
if FTank == 4 then x = "AUX" end
ipc.display("TAnk Select = "..x, 2)
ipc.writeSTR(0x3380, x)
ipc.writeUW(0x32FA, 3)
end
-- Headphones on/off...doesn't always work reliably!
function Headphones(control, on_off)
ipc.writeLvar("L:Headphones", on_off)
ipc.writeLvar("L:SystemCondSelectFSX", 57)
ipc.writeLvar("L:SystemCondValueFSX", on_off)
end
-- Just some test stuff
function Message(control, param)
msg = ipc.readSTR(0x3380, 126)
ipc.display("New Msg "..msg, 2)
end
-- These are Prepar3D specific functions to overcome the
-- problem with the axis assignment and range of movement issues.
function Radiator_Lever(control, Lever_in)
Lever_Out = 100- ((Lever_in + 16383)/327.67)
ipc.writeLvar("L:Eng1_RadiatorLeverPos", Lever_Out)
ipc.display("RAD Flap = "..Lever_Out, 1)
end
function Oxy_Alt(control,Alt_in)
Alt_Out = (Alt_in + 16383)/327.67
ipc.writeLvar("L:OxyAltSetValve", Alt_Out)
Oxy_Alt_Set = ipc.readLvar("L:OxyAlt")
ipc.display("Oxy Alt = "..Oxy_Alt_Set, 1)
end
event.offset(0x66C4,"UB","Vent")
event.key(120, 8, "Handle_Positions")
event.key(117, 8, "Flap_Handle_Position")
event.key(118, 8, "Flap_Handle_Position")
event.key(71, 8, "Gear_Handle_Position")
event.offset(0x66C5,"UB","FUEL_TANK")
event.offset(0x66C7,"UB","Headphones")
event.offset(0x3380,"UW","Message")
-- These are the Prepa3D specific event triggers.
-- The axis are assigned to 'send to an offset'
-- in the FSCIPC4 Controls menu.
event.offset(0x66D0,"SW","Radiator_Lever")
event.offset(0x66D2,"SW","Oxy_Alt")
choice as long as the extension is ".lua". Place it in you P3D Modules folder.
Add this entry to your FSUIPC4.ini file:
[Auto.Curtiss P-40]
1=Lua KillAll
2=Lua DispP40
This will run the lua script when you load the P40. If you change the name of the Lua script, then you need to change
it in the line above as well.
Paul
Who is online
Users browsing this forum: No registered users and 9 guests