danewatson 0 Posted January 9 Report Share Posted January 9 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. Quote Link to post Share on other sites
John Dowson 134 Posted January 9 Report Share Posted January 9 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 Quote Link to post Share on other sites
ark1320 11 Posted January 9 Report Share Posted January 9 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 Quote Link to post Share on other sites
danewatson 0 Posted January 10 Author Report Share Posted January 10 Thank you so much John and Al. I will attempt to try this out. Will let you know how I make out. Dane Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.