dougfir Posted May 19, 2021 Report Share Posted May 19, 2021 I'm missing something about running a Lua script.. I'm using a registered version of FSUIPC7 v 7.1.0 with MSFS2020 I modified one of the provided lua examples and named it "IASDisplay.lua" and put it into the root FSUIPC7 folder. In my FSUIPC7.ini file I have: [LuaFiles] 1=IASDisplay Under the Assignments menu I assigned Alt+D to run LuaIASDisplay I run FSUIPC7 which starts MSFS2020 and shows Connected. Everything looks normal but using Alt+D does not start the script, at least not that I can see. FSUIPC7.log shows "KeyDown received from FS but not programmed" but in Key Assignments it shows that script assigned to Alt+D. So, I'm looking for a way to start the script, either through the FSUIPC7 Assignments menu or through MSFS2020's Controls dialogs. Log attached. IASDisplay Script: w = wnd.open("IAS", WND_FIXED, 100,100,425,185) -- Update the display at 1000 msec intervals (see event at end) function mytimer(time) -- display 1 = airspeed airspeed = math.floor((ipc.readSD(0x02BC) / 128) + 0.5) --display.show(h, 1, "Airspeed " .. airspeed .. " knots") wnd.text(w,airspeed) end -- Adjust timing to taste: 1000 = 1 second event.timer(1000, "mytimer") Thanks FSUIPC7.log Link to comment Share on other sites More sharing options...
dougfir Posted May 19, 2021 Author Report Share Posted May 19, 2021 Further to my post above I redid the key assignment leaving out the "Alt" key. So "D" alone triggered the script and this worked. Is there some problem using "Alt" with Lua and MSFS2020? Link to comment Share on other sites More sharing options...
dougfir Posted May 19, 2021 Author Report Share Posted May 19, 2021 More on my first lua foray, page 1 of the FSUIPC Lua Plug-Ins.pdf reads "When you start a Lua program running which is already running, the previous incarnation is first ruthlessly and unceremoniously terminated. " I found this not to be the case. I edited my previous test script and then invoked it again from the same Key Assignment but the previous code would always run. I was just trying to change the window position and size. I finally had to quit both the sim and FSUIPC7 and restart in order to see the new script. I hope I'm missing something here, that would be a really tedious way to code. Link to comment Share on other sites More sharing options...
Pete Dowson Posted May 20, 2021 Report Share Posted May 20, 2021 10 hours ago, dougfir said: More on my first lua foray, page 1 of the FSUIPC Lua Plug-Ins.pdf reads "When you start a Lua program running which is already running, the previous incarnation is first ruthlessly and unceremoniously terminated. " I found this not to be the case. Well, it works for me, every time. I develop all my plug-ins this way. Are you sure it isn't related to the MSFS window problems? I only use P3D5. I'm sure john can check it, bit you should show the relevant logs. Pete Link to comment Share on other sites More sharing options...
John Dowson Posted May 20, 2021 Report Share Posted May 20, 2021 11 hours ago, dougfir said: I found this not to be the case. I edited my previous test script and then invoked it again from the same Key Assignment but the previous code would always run. I was just trying to change the window position and size. It does kill and re-run the script. However, the size and position information is only used the first time the script is ran, then on subsequent runs the size & position is taken from your FSUIPC7.ini file, from your [ExtWindow] section. So, to get the new size/position, you must delete the entry for that window in that section first. Alternatively, Ext windows can be moved and re-sized manually, using the arrow keys to move and the same keys but with either the alt or ctrl modifier to resize, and the updated size/position will also be recorded in your ini file. Or you can modify the size / position directly in the ini file. Link to comment Share on other sites More sharing options...
dougfir Posted May 20, 2021 Author Report Share Posted May 20, 2021 Pete, I'm not familiar with "the MSFS window problems". John has answered the problem. Edit the .ini file as well as the script. Link to comment Share on other sites More sharing options...
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