Jump to content
The simFlight Network Forums

MSFS and Lua Scripts


ark1320
 Share

Recommended Posts

I am having a lot of trouble getting Lua scripts that I've used for a long time in previous sims working in MSFS, and would be interested to hear how it is going for other Lua script users. I've written some very simple test scripts, but have not had much luck with those either -- they work sometimes, but not other times. Getting messages to display does not seem to work well either. So I'm just curious what others are finding which will be a clue to help me determine if "I'm the problem",  or if it is perhaps related to the current state of the sim.

I typically use Lua scripts to do things like set courses and headings, altitudes, radio frequencies, to operate the autopilot, etc. So far with MSFS I've just been trying to set a Nav frequency without much luck.

Thanks,

Al

Link to comment
Share on other sites

13 hours ago, ark1320 said:

Getting messages to display does not seem to work well either

There are currently quite a few known ussues with the SimConnect_Text functions and its is currently not possible to have an updating text window. Due to this, I have added the lua wnd library to FSUIPC7 (previously only available in WideClient). I have attached two scripts which show the fps (and other things), one using the non-working simconnect text funcytons (via lua of course) and the other using the newly added wnd library, which should give you an idea how it works.

Note also that anything using lvars won't work, as these don't exist in MSFS.

13 hours ago, ark1320 said:

or if it is perhaps related to the current state of the sim.

Most probably. But if you find an offset or control that isn't working as expected, please let me know.

Thanks,

John

FPS_Monitor.luaFPS_MonitorW.lua

Edited by John Dowson
grammer corrected
Link to comment
Share on other sites

5 hours ago, John Dowson said:

Most probably. But if you find an offset or control that isn't working as expected, please let me know.

John,

I don't understand your comment that Lvars don't (won't) exist in MSFS. My understanding is a developer can use XML coding if so desired, and so I'd expect Lvars would exist in that case.  And also there is the legacy mode for porting over existing a/c, with some modifications I would assume, that would have Lvars. Or is my understanding incorrect?  I do realize Gauges written in C++ and compiled into Wasm are different and won't have Lvars. 

I will certainly pass on any non-working  offsets or controls not currently listed as such in your spreadsheet.

Al

Link to comment
Share on other sites

16 minutes ago, ark1320 said:

I don't understand your comment that Lvars don't (won't) exist in MSFS. My understanding is a developer can use XML coding if so desired, and so I'd expect Lvars would exist in that case.

There are various types of variables used in XML gauges. I'm sure something similar to lvars exists, but I don't know if they are called 'lvars'. Somebody else may be able to explain this better - I'm not a guage programmer.

However, as far as FSUIPC is concerned, it doesn't matter. Previously, in P3D, LM provided access to such variables through the Panels.dll. In MSFS, we only have access to data through SimConnect at the moment, and SimConnect provides no way to access anything that is not exposed through that API.

We are still waiting for information on what facilities, if any, will be provided to access such data.

Link to comment
Share on other sites

3 hours ago, John Dowson said:

There are various types of variables used in XML gauges. I'm sure something similar to lvars exists, but I don't know if they are called 'lvars'. Somebody else may be able to explain this better - I'm not a guage programmer.

However, as far as FSUIPC is concerned, it doesn't matter. Previously, in P3D, LM provided access to such variables through the Panels.dll. In MSFS, we only have access to data through SimConnect at the moment, and SimConnect provides no way to access anything that is not exposed through that API.

We are still waiting for information on what facilities, if any, will be provided to access such data.

OK, I understand now -- thanks.

It seems that if you make a change to a Lua script, you have to exit and restart FSUIPC7 for the change to take effect. Does that seem correct, for now at least?

Have you had any reports on problems with the ipc.set() and ipc.get() functions, and with ipcPARAM values not being correctly recognized? I'm just trying to sort thru things that are not working.

Also the ipc.ask() function does not seem to work which I have often used to get user input such as a desired airspeed or frequency. Is there another way to do this currently?

Thanks,

Al

Link to comment
Share on other sites

3 hours ago, ark1320 said:

It seems that if you make a change to a Lua script, you have to exit and restart FSUIPC7 for the change to take effect. Does that seem correct, for now at least?

No, it isn't true. You can just start the Lua plug-in again. The previous incarnation will be automatically killed and the revised one started. This has always been the case.

If you are starting the plug-in automatically (via an [Auto] entry in the INI, or from another Lua like ipcReady.lua) then you'll need to just assign a keypress or button to loading it whilst you are developing it.

Pete

3 hours ago, ark1320 said:

Have you had any reports on problems with the ipc.set() and ipc.get() functions, and with ipcPARAM values not being correctly recognized? I'm just trying to sort thru things that are not working.

They too should work, being unchanged since FSUIPC6.

3 hours ago, ark1320 said:

Also the ipc.ask() function does not seem to work which I have often used to get user input such as a desired airspeed or frequency. Is there another way to do this currently?,

None of the facilities needing in-FS screen displays work correctly yet as the text display facilities aren't working in SimConnect. You could probably emulate the facility using the WND Lua library.

Pete

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.