Jump to content
The simFlight Network Forums

ark1320

Members
  • Posts

    670
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by ark1320

  1. Below is a version of my Approach Callouts script for MSFS. It uses a main LUA scirpt, called ApprCallOutMSFS.lua, and a Sound folder called ApproachCallouts that contains wav files for calling out altitudes, Decision Height, flap settings and gear position. You will see the path to my sound folder at the top of the main Lua script. There are a few displays as well that appear in a small window (based on the FSUJIPC Window library) which is located in the upper right corner of the screen on my particular setup. The uploaded zip file below contains the main Lua script and the sound folder with the wav files. There are comments at the top of the script that are worth reading if you plan to try an use or modify it. I'll be glad to try an answer any questions. Although I use this script all the time, it has been years since I originally wrote it for FSX and P3D, and also a while since I updated it for MSFS, so some of the design details are a bit hazy right now (age problem!). I've also put this script in the User Contributions subforum and there is a little more info there. Al ApproachCallouts4MSFS.zip
  2. You are right, I had NO idea the term "calculator code" referred to an actual MS/Asobo defined construct. Though it was just a FSUIPC name for a new capability. A search of the MSFS SDK turned up this relevant warning: Always good to lean something new! Thanks, Al
  3. Hi John, It seems the ipc.execCalcCode function does not recognize the use of > for the greater than symbol > in XML code. For example, if I execute the little test code below as shown it works in that the displayed value for Test Var1 is correct, a 3. But, if I then go back and change the 3 to a 4 and change the > symbol to > in the first line so it becomes ipc.execCalcCode(" 4 (>L:TestVar1) "), a 3 is still displayed when the code runs. Unfortunately, for some reason the > syntax (which I don't like) is frequently used for the > symbol in XML coding. I copied some code to use in a Lua script that used the ipc.execCalcCode() function in a number of lines, and it took me a loooong time to figure out it wasn't working because the code I copied used the > syntax. If getting the > syntax to work with the ipc.execCalcCode function is not a viable option, then I think a warning note of some kind in the Lua Library and Advanced Users guide would be a good idea. I looked but did not find anything on this. Thanks, Al ipc.execCalcCode("3 (>L:TestVar1) ") ipc.sleep(500) Test_Var1 = ipc.readLvar("L:TestVar1") wnd.clear(w) wnd.text(w, " Test Var1 = "..Test_Var1) ipc.sleep(5000)
  4. Great info as usual -- many thanks John. Al
  5. John, Will an axis setting, such as rudder axis slope, etc., that is specified in the non-aircraft specific JoystickCalibration section of the FSUIPC7.ini file apply to an aircraft that has an aircraft specific (Profile) JoystickCalibration section if that particular slope (for the rudder axis in this example) is NOT also specified in the aircraft specific profile JoystickCalibration section? Thanks, Al
  6. I don't have any Go Flight equipment or experience, but I see two possible issues here: 1. Offset 0x07F2 is listed as 2 bytes in size in the FSUIPC7 Offsets Status PDF document. So 0x07F2 holds 16 bits, a Word quantity, not a 32 bit Double word quantity. 2. Since the vertical speed can be positive or negative, you are dealing with a Signed, not an Unsigned, value. So given the above, in the event.offset( ) expression suggest you try "SW" , which indicates a Signed 16 bit single Word value, instead of "UD", which indicates an Unsigned 32 bit Double word value . Easy to do, so worth a try I think. Al
  7. Is there a way to display more than one variable on a line using wnd.text()? EDIT: Finally found this syntax works (leaving the post here in case it helps others): wnd.text(w, " Name1 = "..value1.." Name2 = "..value2.."Name3 = "..value3) Thanks, Al
  8. I think this is a MSFS sim bug. It happens with a number of planes that don't have a GPS, even the Wright Flyer! I don't see how this is a FSUIPC7 issue. Al
  9. John -- think you fixed it! I tried commenting out different combinations of presets with // and FSUIPC7 always started when I clicked on the test FSUIP7.exe file. And just in time too, I still have a few hairs left on my head! 😅 I really appreciate you taking the time to look into this issue. I know you are very busy. Best, Al
  10. Sure, will try your test version and report back. Al
  11. Hi John, I 've done some more testing but don't have a conclusion. Here is a pared down test myevents.txt file: Note the first preset is commented out. The sim is not running, and when I double click on the FSUIPC7.exe file FSUIPC7 does NOT start and I get the log file (partial apparently) shown. If I simply uncomment that first preset, FSUIPC7 also does not start. // Next presets for HJet //HJET_AT_TOGGLE#(L:CSC Pushed, bool) ! (>L:CSC Pushed, bool) HJET_AT_FMS_MAN_TOGGLE#(L:HJET_THROTTLE_MAN,bool) ! (>L:HJET_THROTTLE_MAN,bool) HJET_OBS_CRS_INC#(>H:AS1000_PFD_CRS_INC) HJET_OBS_CRS_DEC#(>H:AS1000_PFD_CRS_DEC) //currently using the standard MSFS control bindings Increase/Decrease Autopilot Reference Altitude //HJET_AP_ALT_INC#(L:HJET_AP_ALT_VAR, number) 100 + (>L:HJET_AP_ALT_VAR, number) //HJET_AP_ALT_DEC#(L:HJET_AP_ALT_VAR, number) 100 - (>L:HJET_AP_ALT_VAR, number) ********* FSUIPC7, Version 7.3.17 (25th February 2023) by John Dowson ********* MS Store installation detected: Checking for FS path in 'C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\UserCfg.opt' FS path found = C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\ WebSocket server found: C:\Users\Al\Documents\Al's Flight Simulation\AddOns\FSUIPC7\modules\\Utils\FSUIPCWebSocketServer.exe Windows 10 Pro 64 Bit reported as Build 19045, Release ID: 2009 (OS 10.0) Reading options from "C:\Users\Al\Documents\Al's Flight Simulation\AddOns\FSUIPC7\modules\FSUIPC7.ini" Checking the Registrations now ... User Name="Alan Klayton" User Addr="arklayton@comcast.net" FSUIPC7 Key is provided WIDEFS7 not user registered, or expired 63 System time = 28/02/2023 10:33:58 63 FLT path = "C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\" 63 Allowing calibration when not assigned with 'Send direct to FSUIPC Calibration' 156 ------------------------------------------------------------------- If I delete the first commented out preset from myevents.txt and double click on FSUIPC7.exe, FSUIPC7 DOES start and I get the log file below. And if I just uncomment the first preset and also uncomment the last two presets, so no presets are commented out, again FSUIPC7 starts! ********* FSUIPC7, Version 7.3.17 (25th February 2023) by John Dowson ********* MS Store installation detected: Checking for FS path in 'C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\UserCfg.opt' FS path found = C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\ WebSocket server found: C:\Users\Al\Documents\Al's Flight Simulation\AddOns\FSUIPC7\modules\\Utils\FSUIPCWebSocketServer.exe Windows 10 Pro 64 Bit reported as Build 19045, Release ID: 2009 (OS 10.0) Reading options from "C:\Users\Al\Documents\Al's Flight Simulation\AddOns\FSUIPC7\modules\FSUIPC7.ini" Checking the Registrations now ... User Name="myName" User Addr="myEmail" FSUIPC7 Key is provided WIDEFS7 not user registered, or expired 63 System time = 28/02/2023 10:31:55 63 FLT path = "C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\" 63 Allowing calibration when not assigned with 'Send direct to FSUIPC Calibration' 157 ------------------------------------------------------------------- 172 10012 Calculator Code presets have been loaded and are available for use 203 Registered HotKey 'InvokeFSUIPCOptionsKey' (key=0x46, modifier=0x1) 219 FS path = "C:\Users\Al\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\" 219 ---------------------- Joystick Device Scan ----------------------- 219 ------------------------------------------------------------------- 344 LogOptions=00000000 00000001 So I don't understand what is going on. For example, why in the first case is deleting that first preset any different than commenting it out? And if FSUIPC7 starts with no presets commented out, why won't it start with some presets commented out? I get the same results if the sim is running or not, and these presets do work with the HJet. Are there any rules regarding blank lines in a myevents.txt file? Thanks, Al
  12. Delete please. Thx.
  13. If I delete the 4 last lines commented out below in my myevents.txt file, or if I simply uncomment those 4 lines, I can start FSUIPC7 (ver 7.3.17). However, if I leave those 4 lines just commented out, I can not start FSUIPC7 even by manually double clicking on FSUJIPC7.exe. Any ideas why that might be, why the // don't seem to work for those lines -- so strange! It does not seem to make a difference if the sim is running or not. And a lesson here is that a problem with the myevents.txt file can prevent FSUIPC7 from starting. It took me a long time to figure out why FSUIPC7 would not start. Thanks, Al // myevents.txt For my FSUIPC XML Calculator code Presets. See FSUIPC Advanced Users Guide, Pg 48. // This will be listed in the Key or Button assignment control dropdown lists as Flight_Director_Off if the Select for Preset box is checked. FLIGHT_DIRECTOR_OFF#(A:AUTOPILOT MASTER, Bool) 0 == (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, Bool) 1 == and if{ (>K:TOGGLE_FLIGHT_DIRECTOR) } // turn off FD if AP off and FD on // C414 Heater and Fan TOGGLE_HEATER_SWITCH#(L:CABIN_HEAT,bool) ! (>L:CABIN_HEAT,bool) TOGGLE_CABIN_FAN#(L:GENERIC_Momentary_CABIN_FAN,Bool) 0 == if{ 1 (>L:GENERIC_Momentary_CABIN_FAN,Bool) } els{ (L:GENERIC_Momentary_CABIN_FAN,Bool) 1 == if{ 2 (>L:GENERIC_Momentary_CABIN_FAN,Bool) } els{ 0 (>L:GENERIC_Momentary_CABIN_FAN,Bool) } } // Next presets for HJet HJET_PURPLE_MAP_INC#(>H:AS3000_TSC_Vertical_1_Joystick_INC) HJET_PURPLE_MAP_DEC#(>H:AS3000_TSC_Vertical_1_Joystick_DEC) HJET_BLUE_MAP_INC#(>H:AS3000_TSC_Vertical_2_Joystick_INC) HJET_BLUE_MAP_DEC#(>H:AS3000_TSC_Vertical_2_Joystick_DEC) HJET_ADVANCE_CHECKLIST#(>H:gauges_ha420_sys_Checklist_enter) HJET_AT_TOGGLE#(L:CSC Pushed, bool) ! (>L:CSC Pushed, bool) HJET_AT_FMS_MAN_TOGGLE#(L:HJET_THROTTLE_MAN,bool) ! (>L:HJET_THROTTLE_MAN,bool) //HJET_OBS_CRS_INC#(>H:AS1000_PFD_CRS_INC) //HJET_OBS_CRS_DEC#(>H:AS1000_PFD_CRS_DEC) //HJET_AP_ALT_INC#(L:HJET_AP_ALT_VAR, number) 100 + (>L:HJET_AP_ALT_VAR, number) //HJET_AP_ALT_DEC#(L:HJET_AP_ALT_VAR, number) 100 - (>L:HJET_AP_ALT_VAR, number) EDIT: After more testing it seems the presence of the # character in a preset that is commented out with // prevents FSUIPC7 from starting. I found one solution to the problem described here is to use the semicolon ; to indicate a comment instead of // as suggested in the FSUIPC7 Advanced Users Guide. Don't know if this might be text editor dependent for some reason. I use NotePad++.
  14. Hi John, In the past I've always used a single throttle axis to control both engines of an aircraft. I now am trying to assign a separate axis to each engine of the C414, and in this case the throttles do not have a reverse range. The assignments are profile specific. The calibration looks like this: and the entry in the FSUJIPC.ini file under the profile specific JoystickCalibration section looks like this: Throttle1=-16380,-512,512,16380/32 Throttle2=-16384,-512,512,16209/32 Does this look correct? If so, I don't understand why when a throttle is all the way back, there is 0 OUT for -16384 IN. Is that just the consequence of No reverse zone? And where did the +-512 come from in the ini file entries? I expected the FSUIPC7.ini entry to look similar to what I get when I use a single axis for both engines, e.g. I expected Throttle1=-16384,16383 and Throttle2=-16384,16383 . However, this dual axis setup does seem to work as far as the operation of the throttles in the sim is concerned! So it seems there is something fundamental I don't understand. Thanks, Al
  15. In case it helps anyone, here's what I came up with for the HJet throttles. I currently just use one axis lever to control both engines , but the below can easily be expanded to use two axis levers for those so motivated (each script below gets divided up into two scripts, one for each engine/throttle lever, and two offsets are used, 0xA000 and 0xA002). This single lever solution makes use of three tiny Lua scripts. With the main script the Saitek controller throttle axis value is stored in offset 0xA000. If the value changes by at least a magnitude of 128 the function HJet_Throttle() is called to convert the raw axis value to a number between 0 and 1, and this number is written to the two HJet Lvars that control the two HJet throttles. This script is loaded automatically when FSUIPC starts through the FSUIPC7.ini Profile Specific file entry that looks like this: [Auto.HJet] 1=Lua HJet_Throttle Here is the main script that gets loaded automatically: -- HJet_Throttle.lua function HJet_throttle() throttle = (ipc.axis("T","X") + 16384)/32587 -- need throttle range of 0 to 1 for TQ throttle axis range of -16384 to +16203 ipc.writeLvar("L:THROTTLE1_SET", throttle) ipc.writeLvar("L:THROTTLE2_SET", throttle) end --******************************************** --********* Main Program ******************** --******************************************** ipc.writeLvar("L:THROTTLE1_SET", 0) -- initialize throttles to idle position. ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) event.offsetmask(0xA000, 0xFF80, "SW", "HJet_throttle") -- mask requires a change of at least 128 to trigger the function call. -- Under FSUIPC7 Axis Assignments, the HJet throttle axis value has been -- assigned to Offset 0xA000 as Offset Word Set Main script axis assignment. The two tiny scripts below move the HJet throttles between cutoff and idle. There is switch at the bottom of my Saitek throttle axis. When the switch is closed by moving the lever down into the switch, HjetThrotCuttoff.lua is called, and when the lever is moved up out of the switch position HjetThrotIdle.lua is called. --HjetThrotCuttoff.lua ipc.writeLvar("L:THROTTLE1_SET", -1) ipc.writeLvar("L:THROTTLE2_SET", -1) ipc.writeLvar("L:HA420_ThrottlePos_R", 0) ipc.writeLvar("L:HA420_ThrottlePos_L", 0) --HjetThrotIdle.lua ipc.writeLvar("L:THROTTLE1_SET", 0) ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) Setup of the cutoff - idle switch. Frankly, whether or not all the above is a "good" solution for the HJet throttles I don't know. But I have been using this for a while now and it seems to work fine. And of course, this solution is set up to be HJet Profile Specific. Al HJetThrotCutoff.lua 187 B · 1 download HJet_Throttle.lua 985 B · 1 download HjetThrotIdle.lua 184 B · 1 download
  16. In case it helps anyone, here's what I came up with for the HJet throttles. I currently just use one axis to control both engines , but the below can easily be expanded to use two axis levers for those so motivated. This solution makes use of three tiny Lua scripts. The Saitek controller throttle axis value is stored in offset 0xA000. If the value changes by at least a magnitude of 128 the function HJet_Throttle() is called to convert the raw axis value to a number between 0 and 1, and this number is written to the two HJet Lvars that control its throttles. This script is loaded automatically when FSUIPC starts through the FSUIPC7.ini Profil Specific file entry that looks like this: [Auto.HJet] 1=Lua HJet_Throttle This is the main script that gets loaded automatically: -- HJet_Throttle.lua function HJet_throttle() throttle = (ipc.axis("T","X") + 16384)/32587 -- need throttle range of 0 to 1 for TQ throttle axis range of -16384 to +16203 ipc.writeLvar("L:THROTTLE1_SET", throttle) ipc.writeLvar("L:THROTTLE2_SET", throttle) end --******************************************** --********* Main Program ******************** --******************************************** ipc.writeLvar("L:THROTTLE1_SET", 0) -- initialize throttles to idle position. ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) event.offsetmask(0xA000, 0xFF80, "SW", "HJet_throttle") -- mask requires a change of at least 128 to trigger the function call. -- Under FSUJIPC7 Axis Assignments, the HJet throttle axis vale has been -- assigned to Offset 0xA000 as Offset Word Set The two tiny scripts below move the HJet throttles between cutoff and idle. There is switch at the bottom of my Saitek throttle axis. When the switch is closed by moving the lever down into the switch, HjetThrotCuttoff.lua is called, and when the lever is moved up out of the switch position HjetThrotIdle.lua is called. --HjetThrotCuttoff.lua ipc.writeLvar("L:THROTTLE1_SET", -1) ipc.writeLvar("L:THROTTLE2_SET", -1) ipc.writeLvar("L:HA420_ThrottlePos_R", 0) ipc.writeLvar("L:HA420_ThrottlePos_L", 0) --HjetThrotIdle.lua ipc.writeLvar("L:THROTTLE1_SET", 0) ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) Frankly, whether or not all the above is a "good" solution for the HJet throttles I don't know. I'm new to the HJet and I'm not sure I fully understand how its throttles work. But the above solution does seem to work OK. And of course, this solution is HJet Profile Specific. Al HJetThrotCutoff.lua HJet_Throttle.lua HjetThrotIdle.lua
  17. I put the scripts called P3D_Flt_Params.lua and MSFS_Flt_Params.lua in the User Contribution area. Post is called Display P3D and MSFS Aircraft Flight Parameters Al
  18. Here are two small Lua scripts I call P3D_Flt_Params.lua (for P3D) and MSFS_Flt_Params.lua (for MSFS2020) that display trim values, the flaps setting, and landing gear position in a small window. The possible landing gear values are Up, Down, and Transit (when gear is moving). The scripts can be expanded to include other parameters if desired. Note at the top of the scripts you have to enter a value for flaps_max. Since the max flaps value can be different for different aircraft, if you have a few aircraft with different values for this, you can simply just have a few copies of the script with different names, e.g., Learjet_Params.lua. C402_Params.lua, etc., or of course you can change the value in the script as needed (setting the max flap value based on the aircraft name in the aricraft.cfg file is another but more involved approach for this). Note however, the total number of characters in the script name to the left of the .lua cannot be more than 16. You can also make changes at the top of the scripts to resize or reposition the windows. Assign a key or button to a script to toggle the window on and off. Al P3D Window MSFS Window P3D_Flt_Params.lua MSFS_Flt_Params.lua
  19. Hi John, I reinstalled FSUIPC7 and all is now working. I should have thought of trying that before bothering you with this -- sorry. Al
  20. John, It seems under SU11 FSUIPC7 no longer will auto-start luas when FSUIPC7 is started/restarted when MSFS is running and has an aircraft loaded, at least not on my system. Al
  21. Just as another data point, so far all my key and button assignments seem to work with today's SU11 update. Al
  22. Great info, thanks John. A delta of 0.009 radians equates to a bearing change of about 1/2 degree. And do subsequent event.offset function calls kill the previous call if it is still running? I'm asking because I have a delay [ ipc.sleep() ] in the called function. Al
  23. Hi John, I have an application using the code event.offset(0x6050, "DBL","gps_course_fcn"). My question is, with a high precision ( I assume) data type like DBL, is there some tolerance you use to determine if the value has changed, or will any change in the "DBL" value trigger event.offset? Also, will a subsequent event.offset call to the function gps_course_fcn kill an existing instance of that function? Thanks, Al
  24. John, Works as advertised! Thank you, Al
  25. What are the definitions of Frame and VisualFrame? I ran some experiments with the little test program above. Could not get consistent results, however, perhaps other issues such as the loading time of the script, etc played a role. Does Frame refer to the basic rate at which the sim is running-- maybe around 18Hz (55ms), at least that was what P3D ran at I believe. Or does Frame refer to the FPS you happen to be getting at that time? Does VisualFrame relate to the refresh rate of your monitor, or maybe that is what is related to the FPS? My sim FPS is locked at 30Hz (33.3ms). Btw, I assume whatever delay is needed, it is also needed after the ipc.createLvar() command before the value being set by that command is available -- true? Thx, Al
×
×
  • 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.