Jump to content
The simFlight Network Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Detlef_747

  • Rank

Profile Information

  • Gender
  • Location
  1. Hello Thomas, using Lvars did the trick for me. I experimented using the following Lua code: local lvname={} local k=1 local disp, n, val local aircraft = "" local len, stop lvname[k]="AP_PWR"; k=k+1 lvname[k]="bAPPowerSwVar"; k=k+1 lvname[k]="Track"; k=k+1 lvname[k]="bAPEngageSwVar"; k=k+1 lvname[k]="Pitch Hold"; k=k+1 lvname[k]="IAS Hold"; k=k+1 lvname[k]="bAPBankSwVar"; k=k+1 lvname[k]="KBank"; k=k+1 lvname[k]="MotorA"; k=k+1 lvname[k]="CurBank"; k=k+1 lvname[k]="MotorE"; k=k+1 lvname[k]="bAPHeightIASSwVar"; k=k+1 lvname[k]="bAPTrackSwVar"; k=k+1 lvname[k]="bAPGlideSwVar"; k=k+1 lvname[k]="bAPPitchSwVar"; k=k+1 lvname[k]="HeadingModeKnob"; k=k+1 lvname[k]="LogicHeadingMode"; k=k+1 lvname[k]="MotorR"; k=k+1 lvname[k]="Normal-Heading"; k=k+1 lvname[k]="FD_OnClick"; k=k+1 aircraft = ipc.readSTR(0x3d00, 256) len, stop = string.find (aircraft, "\0", 1, false) aircraft = string.sub(aircraft, 1, len-1) while 1 do disp = aircraft for n=1,k-1 do val = 0 val = ipc.readLvar("L:"..lvname[n]) if val==nil then val = "nil" end disp = disp.."\n"..lvname[n].."="..val end ipc.display(disp) ipc.sleep(50) end Thanks for your help Detlef
  2. Hello Thomas, thank you again for your advice. I did never use L:vars and ignored documentation about it until now. I tried arround a lot today. I think you are right, for some features the P3D autopilot at least for the C-130 aircraft seems to use L:vars. I don't like that so much since those variables probably differ between aircrafts. I have a very old self made hardware with switches and LEDs mainly that communicates via COM serial interface with the PC. That used to work fine for many years with FSX. Now, recently I decided to switch to P3D and I have re-programmed all my software from Visual Basic (FSX) to Lua (P3D) using FSUIPC. A couple of things do work, but I have still a lot to do. And I bought PanelBuilder to design my own instrument panel. I dont need 3D cockpits because I have my own switch console and a beamer for the outside picture. Now with the autopilot there seem to be three ways: (1) try to find out the Lvars for the aircrafts I want to use and write to them using Lua. (2) Program mouse macros to set the switches on the original aircraft gauges. (3) Forget about the built-in autopilot and bank or pitch the Aircraft, by directy writing to appropriate variables. A lot to do any way I look at it. Now, With Lvars I need to do detective work to find out the right ones then try to make them work for me. And this would probably be different for different aircrafts. Actually I don't like to fly military aircrafts so much so in the near future I would like to find a 747, 737 that works fine for me. Mouse macros are also dependent on different aircrafts, and I plan to configure my own panel. And probably the autopilot gauge needs to be in the same spot all the time to make the mouse macros work. But I never tried that. Maybe I will e.g. to use the build in gauge to open cargo doors or so. And finally if I forget the built-in autopilot: at least I can probably do that for every aircraft. But my gauges (from PanelBuilder) will then not show the autopilot engaged. And I need to find a way to disconnect the joystick axis with Lua. Well... whatever way I look at it, there's lot to do. I am not decided yet how to proceed. Maybe I start to find some attractive civil jet / airliner first. Thank you Detlef
  3. Hello Thomas, thank you for your reply. I have not yet come arround to try your suggestion but will do. Thank you Detlef
  4. Hello everybody, I have difficulties to get a Lua script to set the heading hold mode of the C-130 aircraft. I have tried the 0x7c8 variable as well as using ipc.control(65798). If I press the heading hold button per mouse, I can activate the autopilot. So A/P power is on and the A/P master switch is on. However, if I try per Lua script, the A/P heading lock mode toggles on and off without even showing the A/P heading(track) lock light coming on. I try this Lua script: while 1 do has_ap = ipc.readStruct(0x764, "1UD") ap_masterswitch = ipc.readStruct(0x7bc, "1UD") ap_hdg = ipc.readStruct(0x7cc, "1UW")/65536*360 hdg = ipc.readUD(0x580)/65536/65536*360 -- ipc.writeUD(0x7c8, 1) ipc.control(65798) hdg_lock = ipc.readUD(0x7c8) ipc.display("ap_masterswitch="..ap_masterswitch.. "\nap_hdg="..ap_hdg.."\nhdg_lock="..hdg_lock) ipc.sleep(50) end hdg_lock shows 1, 0, 1, 0 and so on. Any help with this is appreciated. Thank you Detlef
  5. Hi Thomas, yes I see. Thank you and here it comes. Detlef [General] UpdatedByVersion=5152 History=K8WWIYSSL0KJVKHEHSL64 InitDelayDevicesToo=No PMDG737offsets=Auto PMDG747offsets=Auto PMDG777offsets=Auto Annotate=Yes UseSystemTime=No UseMidMouseBtn=Yes MouseWheelMove=No MouseWheelTrim=No MouseWheelTrimSpeed=1 JoystickTimeout=20 RestoreSimcWindows=No FixMachSpeedBug=No AutoScanDevices=Yes DisconnTrimForAP=No ZeroElevForAPAlt=No ThrottleSyncAll=No WhiteMessages=No ShowPMcontrols=No SpoilerIncrement=512 MagicBattery=No RudderSpikeRemoval=No ElevatorSpikeRemoval=No AileronSpikeRemoval=No ReversedElevatorTrim=No ClockSync=No ClockSyncMins=5 ClearWeatherDynamics=No TimeForSelect=4 LoadFlightMenu=No LoadPlanMenu=No PauseAfterCrash=No BrakeReleaseThreshold=75 SaveDataWithFlights=No ZapSound=firework ShortAircraftNameOk=Substring UseProfiles=Yes EnableMouseLook=No DelayedMouseLookZoom=No WideLuaGlobals=Yes TextFileMaxRead=4095 TextFileNumbers=Yes TextFilePhonetics=Yes AxesWrongRange=No TCASid=Flight TCASrange=40,3 AxisCalibration=No DirectAxesToCalibs=No ShowMultilineWindow=Yes SuppressSingleline=No SuppressMultilineFS=No AxisIntercepts=No DontResetAxes=No ThreadAffinityMask=x0 LuaAffinityMask=x0 InitDelay=0 GetNearestAirports=Yes LogOptionProtect=Yes TimeForLuaClosing=2 WeatherReadFactor=2 WeatherRewriteSeconds=1 TrafficStallTime=1 InitialStallTime=10 NormalStallTime=1 LuaRerunDelay=66 ComReadLoopTime=20 ControlsListBuild=30293 Console=No LogLua=Yes FSVersionUsed="Lockheed Martin® Prepar3D® v4", SimConnectUsed= [Traffic Limiter] AirportPreference=50 PlannedAirportsPreference=50 GroundPreference=50 NearerPreference=50 TargetFrameRate=0 TrafficLimit=0 [JoyNames] AutoAssignLetters=No 1=Logitech Attack 3 1.GUID={52394020-B5E6-11E9-8003-444553540000} 0=CH Pro Pedals USB 0.GUID={5238F200-B5E6-11E9-8002-444553540000} 2=CH Pro Throttle USB 2.GUID={5239B550-B5E6-11E9-8007-444553540000} [JoystickCalibration] RudderBlendLowest=1 AllowSuppressForPFCquad=Yes ExcludeThrottleSet=Yes ExcludeMixtureSet=Yes ExcludePropPitchSet=Yes SepRevsJetsOnly=No ApplyHeloTrim=No UseAxisControlsForNRZ=No FlapsSetControl=0 FlapDetents=No ReverserControl=66292 Reverser1Control=66422 Reverser2Control=66425 Reverser3Control=66428 Reverser4Control=66431 MaxThrottleForReverser=256 AileronTrimControl=66731 RudderTrimControl=66732 CowlFlaps1Control=66162 CowlFlaps2Control=66163 CowlFlaps3Control=66164 CowlFlaps4Control=66165 SteeringTillerControl=0 MaxSteerSpeed=60 Rudder=-16380,-512,512,16380 Throttle=-16383,16380 LeftBrake=-16380,16380/16 RightBrake=-16380,16380/16 [Axes] PollInterval=10 RangeRepeatRate=10 0=0X,256,D,7,0,0,0 -{ DIRECT: LeftBrake }- 1=0Y,256,D,8,0,0,0 -{ DIRECT: RightBrake }- 2=0Z,256,D,3,0,0,0 -{ DIRECT: Rudder }- 3=1X,256,D,1,0,0,0 -{ DIRECT: Aileron }- 4=1Y,256,D,2,0,0,0 -{ DIRECT: Elevator }- 5=2X,256 6=2X,B,128,16255,65864,0 -{ Entering=LANDING_LIGHT_LEFT }- 7=2Z,256,D,4,0,0,0 -{ DIRECT: Throttle }- [Buttons] PollInterval=25 ButtonRepeat=20,10 1=P2,10,CL2:S,0 -{LuaSet RealSwitches (Flag 0)}- 2=P2,9,C1084,0 -{LuaKillAll}- 3=P2,0,CL1:D,0 -{LuaDebug ipcDebug}- 6=P1,10,CL6:R,0 -{Lua display_fuel}- 7=P1,9,C66708,0 -{EXTINGUISH_ENGINE_FIRE}- 8=P1,3,C65681,0 -{VIEW_FORWARD_LEFT}- 9=U1,3,C65674,0 -{VIEW_FORWARD}- 10=P1,4,C65675,0 -{VIEW_FORWARD_RIGHT}- 11=U1,4,C65674,0 -{VIEW_FORWARD}- 12=R1,2,K36,8 -{Key press: Home}- 13=R1,1,K35,8 -{Key press: End}- 14=P2,13,K83,8 -{Key press: S}- 15=P2,15,K83,9 -{Key press: shft+S}- 16=P2,14,C66153,0 -{NEXT_SUB_VIEW}- 17=P2,12,C66154,0 -{PREV_SUB_VIEW}- 18=P2,7,C65827,0 -{NEXT_VIEW}- 19=P2,1,C65589,0 -{SPOILERS_TOGGLE}- 20=R2,2,K113,8 -{Key press: F2}- 22=P2,3,K112,8 -{Key press: F1}- 23=R2,36,K37,9 -{Key press: shft+Left}- 25=R2,32,K39,9 -{Key press: shft+Right}- 26=R2,38,K38,9 -{Key press: shft+Up}- 27=R2,34,K40,9 -{Key press: shft+Down}- 28=R1,0,K75,11 -{Key press: ctl+shft+K}- [AutoSave] Next=1 Interval=60 Files=10 SaveOnGround=No AutoSaveEnabled=No [GPSout] GPSoutEnabled=No Port=COM1 Speed=4800 Interval=2000 PosTo6Decimal=No SimModeIndicator=No Sentences= [GPSout2] GPSoutEnabled=No Port=<none set> Speed=4800 Interval=2000 PosTo6Decimal=No SimModeIndicator=No Sentences= [WideServer] WideFSenabled=No AdvertiseService=1 Port=8002 Port2=9002 [Sounds] Path=C:\P3D\Sound\ Device1=Primärer Soundtreiber Device2=Lautsprecher (High Definition Audio Device) Device3=Digital Audio (S/PDIF) (High Definition Audio Device) Device4=Remoteaudio [Auto] [LuaFiles] 1=ipcDebug 2=RealSwitches 3=textmenu 4=tevent 5=display_ap 6=display_fuel [Keys] 1=76,8,L2:R,0 -{L: Press=Lua RealSwitches }- 2=190,8,1084,0 -{.>key: Press=LuaKillAll }- 3=86,8,L5:R,0 -{V: Press=Lua display_ap }-
  6. Hello everybody, I got it solved following your advice, so thank you. I changed every control within P3D that was assigned to a button to the same button, thus effectively removing all button assignments. I saved that configuration as buttons_deleted in case I need it at some time. Then I unchecked controllers in the P3D settings. Still after that I had trouble with elevator up button assignments. My impression is for elevator trim up I may have used the wrong control, since the aircraft control surface change from the trim fought against the control stick. In any case, I assigned the buttons to Pos1(home) and End keys now. That worked. And I did a lot of other button programming in FSUIPC which also worked. Oh and also I reassigned all axis to FSUIPC. I have a Logitech joystick and CH products throttle control and rudders. Again, thanks for your help Detlef
  7. Hi everybody, I am trying to assign Joystick Buttons to Elevator trim down and elivator trim up. And trim down works but trim up causes P3D to cycle through the views. I tried to delete the Control assignment in P3D that I had set earlier in the P3D menu but somehow the sim still uses that old button assignment and ignores the FSUIPC button assigment. Do you know how I can delete all Joystick button definitions from P3D? I want to program them using FSUIPC. Thank you Detlef
  8. Hello John, that worked! Thank you again for your fast help. I am making progress with my project to get my old switch hardware working with P3D. The Lua script is 3000 lines long by now, and it seems to work ok. At least it is not working worse than my old Visual Basic solution. But I did not really do much flying with it until now. Some things, for example auto pilot functions, I can only test in flight. The FSUIPC documentation about ipc Lua functions and sim control variables is just great and very helpful. I will change to the new FSUIPC. Thank you Detlef
  9. Hello everybody, (I copied my question here originating from the user contributions forum which was probably wrong) I encountered the following problem today. Everything was working fine in my system two days ago. I have written a Lua script that was working fine. Now all of a sudden today after starting P3D, when I select FSUIPC Add-on from the menu the P3D window just shows black until I press the ESC key. I have no idea why that happens. I am not aware of any change in my system. The only thing I noted today when starting the PC, somehow P3D was already running and told me that the display resolution is wrong and whether I want to change. I said no. Maybe that was an error. But with the screen resolutions settings in Windows 10 and in P3D everything seems fine. I have: P3D Sim connect FSUIPC5, Version 5.151 Windows 10 Any advice would be appreciated. Thank you Detlef
  10. Hi John, thank you again. 🙂 No, starting a script per L key was just a convenient way for me for my first steps with Lua. My flight sim computer is in one room, and I am sitting more comfortable in another room at a Laptop, which is connected per Windows 10 Remote Desktop . Actually I am planning to react on input from the serial interface (COM3) which is my switch console. And also on timer events. My time is limited so it will take quite a while till I get there and further with the project. Yes, thanks for pointing that out. I think I understand that now. Again, thanks for your help. I will do more trying and work as I find time. I attach a picture of my RealSwiches console, almost 20 years old now. Detlef
  11. Hi John, thank you very much for your fast answer. It got me thinking some more. Yes I am aware of the logging features. I start a Lua script by setting a key (L in my case) to start the script. So if my script has the name kevent.lua I set the key L to the control Lua kevent. I think that works fine. Thank you for pointing me to the fsuipc.ini file, though. I tried that too now. I found out, regardless whether I start a Lua script via [Auto] section or via pressing the L key: The events work when I just start the event at the end of a Lua program. But if I initiate the events, and wait in a loop afterwards in the same lua file for the events happening, the events do not fire. For example this works: ipc.display("Timer event test") gCount = 10 ---------------------------------------------------- function MyTimer() gCount = gCount-1 end ------------------------- init ------------------------ event.timer(100, "MyTimer") But this won't work: (the events don't fire) ipc.display("Timer event test") gCount = 10 ----------------------------------------------------- function MyTimer() gCount = gCount-1 end ------------------------- init ------------------------ event.timer(100, "MyTimer") --------------- waiting while 1 do ipc.display(gCount) ipc.sleep(50) end So it seems I need to do that in different lua files. I now need to figure out how I can use global variables, that are global across different Lua files. ... Or use other mechanisms. I am a Lua beginner, so still learning here. Thank you Detlef
  12. *** Moved from FAQ Support Forum *** Dear fellow simmers, it is a long time since I last modified my flight simulator setup, about 10 years and more! I had built my own console with switches and LEDs, to interface with FSX. It was working until now with FSX and Windows 7. I had programmed it myself using FSUIPC (4 I think) and Visual Basic. Now, just 2 weeks ago I installed Windows 10 and also P3D V4.5. When trying my old program (called RealSwitches) some switches still brought the correct reactions in P3D as they did before in FSX. For example gear up and down still worked. However many things are not working. So I decided to go ahead and write a new program for my old switch console. Reading the FSUIPC documentation I discovered Lua and did some experimenting with it. It generally works, and I tried some of the examples. But what I cannot get working is even the simplest routine using the Lua event library. No event fires. I tried for example timer events and key events. I thought maybe someone here knows or knows where to look. Here is my Lua code, which should just react on pressing the "V" key. From looking at the log file for the lua script I can see that the event function KeyReceived() is never called. The same was the case when I tried with timer events. ipc.display("eins") gCount = 10 ----------------------------------------------------- function KeyReceived() ipc.log("gotcha") gCount = gCount-1 end ------------------------- init ------------------------ event.key(TIC_MS, 86, 0, "KeyReceived") -- Key v (normally make screenshot) event.cancel("KeyReceived") ipc.sleep(50) event.key(TIC_MS, 86, 0, "KeyReceived") -- Key v (normally make screenshot) ---------------------------- loop, event handlers doing their job while gCount>0 do ipc.sleep(50) end ---------------------------- close sOutput = "Fertig" ipc.display(sOutput) ipc.exit() Any help would be most appreciated. Thank you Detlef
  • 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.