Jump to content
The simFlight Network Forums

howto show a panel using a lua script

Recommended Posts

Pete, Is there a way to show a prepar3d panel automatically immediately after the flight is loaded?

One way is to make sure the flight is saved with the panel showing.

Anyway, I don't think there's any difference between P3D panels and FSX ones, is there? Both have FS commands to do this. "Panel 1" to "Panel 9" for the first 9 as listed in the view menu for them and notmally assigned to keyboard Shift 1- Shift 9, and also Panel ID Open, Panel ID close, Panel ID toggle, each of which takes the panel's ID as parameter. IDs are standard for standard panels but are otherwise defined in the PANEL.CFG file for the aircraft. There is a list of the standard panel IDs named in the PANEL.CFGs someplace.

To send controls automatically on a change of aircraft you can use the [Auto ...] section facilty for each aircraft or profile, with a line which executes a macro containing the control operation. Alternatively, to do it on a flight being loaded, you could have a Lua plug-in running (initially loaded from ipcReady.lua) which worked on an event.system(FLIGHTLOAD, ...), and sent the appropriate controls then using ipc.control.



Link to comment
Share on other sites

  • 2 weeks later...

And, is there a way to ask if a panel is still opened every X seconds using a lua? Particularly I can´t find an example of asking it?

I don't know any way apart from seeing if the Window exists and is visible. There's no facility in the Lua libraries to do that at present. Some of FS's panels and windows actualy exist all the time and are simply made visibile or invisible. They also have two incarnations -- docked and undocked. Treatment is different for the two modes, as undocked windows are top-level ones and easier to find. The docked ones are child windows.

Why would you need to know in any case?


Link to comment
Share on other sites

  • 4 weeks later...

Apologies for the delay in replying. As announced, I have been away on holidays.

I need it for undocked windows. I need it because when I change my position and the game reloads, it close my two windowed panles and I want to reopen both automatically.

There are utility programs which record and restore undocked FS windows, or you could investigate doing it with a plug-in using the Lua EXT library. See the "TileSix.lua" example provided in the Lua package in your FSUIPC Documents sub-folder.


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.