danewatson Posted January 9, 2021 Report Posted January 9, 2021 Is there anyway to use a keyboard NumPad entry to enter a course setting in an OBS or Heading Bug? In my P3D with FSUIPC I had lua scripts to accomplish this and just wondered if this is possible in MSFS with FSUIPC 7.
John Dowson Posted January 9, 2021 Report Posted January 9, 2021 4 hours ago, danewatson said: Is there anyway to use a keyboard NumPad entry to enter a course setting in an OBS or Heading Bug? In my P3D with FSUIPC I had lua scripts to accomplish this and just wondered if this is possible in MSFS with FSUIPC 7. It should be possible to adapt your script for MSFS. There are issues with the SimConnect_Text function in the MSFS SDK, so the lua functions that use these will also have issues. You can use (or adapt) this user contribution to request user keyboard input in MSFS: John
ark1320 Posted January 9, 2021 Report Posted January 9, 2021 On 1/8/2021 at 11:32 PM, danewatson said: Is there anyway to use a keyboard NumPad entry to enter a course setting in an OBS or Heading Bug? In my P3D with FSUIPC I had lua scripts to accomplish this and just wondered if this is possible in MSFS with FSUIPC 7. Below is a brief example of how to do what John has suggest above. Note however that this example uses the files ask_for_num() and get_asked_num() which are attached below. These are versions of the files ask_for_data() and get_asked_data() but don't work for letter characters, and as a result there is less delay in detecting an input since each time called get_asked_num() does not require establishing events for all the lowercase and uppercase letters. Using ask_for_data() and get_asked_data() would also work of course. Script get_asked_num() goes in the same folder as FSUIPC7.ini. Note that whether using ask_for _data() or ask_for_num() you will have to edit the function definition to insert the path to your Lua files location. Al -- Get_CRS&HDG.lua function ask_for_num(request_string) -- use for number only data ipc.set("NUM_REQUEST", request_string) ipc.set("NUM_ANSWER", request_string) ipc.runlua("C:\\Users\\... your path to Lua files...\\get_asked_num.lua") -- enter your path here repeat num_returned = ipc.get("NUM_ANSWER") ipc.sleep (100) until num_returned ~= request_string return num_returnedend -- Example Main Programwhile true do CRS1 = ask_for_num("Enter 3 Digits for Course ") if CRS1 == "*" then -- * is error char ipc.sleep(100) else break end end ipc.writeUW(0x0C4E,CRS1 ) while true do HDG = ask_for_num("Enter 3 Digits for Heading ") if HDG == "*" then -- * is error char ipc.sleep(100) else break endend HDG = math.floor(HDG*65536/360) -- format for FSUIPC, no decimal places ipc.writeUW(0x07CC,HDG ) ask_for_num_function_def.lua get_asked_num.lua 1
danewatson Posted January 10, 2021 Author Report Posted January 10, 2021 Thank you so much John and Al. I will attempt to try this out. Will let you know how I make out. Dane
Phlexx Posted January 8 Report Posted January 8 I'm new to the support forum as I'm just starting out with MSFS 2020, having moved from FSX. In the latter I had a set of LUA scripts (which may be the same as the OP) which were originally created in a download named 'NpC Numpad Control'. I'd like to use these with MSFS 2020 if that's possible & looks like the same question as raised by the OP back in 2021. I wonder if any further advice has surfaced to date which would help me achieve this? I'm currently using MSFS 2020 via a PC Game Pass & have FSUIPC 7 on a 'trial license' (which I just found on here, thanks!). I've just copied my FSUIPC 4 buttons & keys entries to my FSUIPC7 ini file (yet to be tested), along with the LUA script pointers, but my original LUA files resided in the FSX modules folder, so I don't know where to put them for MSFS 2020. As you can see, I'm not an expert with this, though I'm very proud of my home-built buttons & keypad control panel & my ability to have modified one of the original LUA scripts to also add ADF functionality as well to Numpad control, so I'm not a complete dunce(!) 🙂 Any help would be appreciated, as I don't want to go back to FSX now that I've seen MSFS 2020, understandably. Thanks.
John Dowson Posted January 9 Report Posted January 9 15 hours ago, Phlexx said: I wonder if any further advice has surfaced to date which would help me achieve this? The post above above by @ark1320 shows how to do this... 15 hours ago, Phlexx said: my original LUA files resided in the FSX modules folder, so I don't know where to put them for MSFS 2020. They go in the FSUIPC7 installation folder, or you can place them in a subfolder and set the LuaPath ini parameter to define the location (see documentation for details). Be aware that many generic controls (and thus offsets) don't work with many MSFS aircraft, especially add-ons, which implement their own systems, and you may have to change to using presets or lvars or input events, etc, instead of writing to offsets to trigger generic controls or simvar updates. But you just need to try these things to see if they work and then adjust accordingly for the aircraft that you are using. John
ark1320 Posted January 11 Report Posted January 11 (edited) On 1/8/2024 at 9:53 PM, Phlexx said: In the latter I had a set of LUA scripts (which may be the same as the OP) which were originally created in a download named 'NpC Numpad Control'. I have entered a version of NpC for MSFS in the FSUIPC User Contributions subforum. See Numberpad Control for MSFS 2020 (NpC4MSFS2020): Al Edited January 11 by John Dowson Link added
Phlexx Posted January 15 Report Posted January 15 Many thanks to John Dowson & user ark1320 for their replies to this. Most helpful & I'll now get to work implementing these into MSFS 2020 before my trial license for FSUIPC7 runs out. Once I know that all is well & I can use my home-made control system with it, I can confidently purchase a proper FSUIPC7 license. I've only had the new Sim for about a month now, so much to learn of course & I'm most grateful to you both for replying to my enquiry.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now