Jump to content
The simFlight Network Forums

create a menu like GSX with lua script using FSUIPC ?

Recommended Posts

2 hours ago, duyvh0309 said:

I would like to knwow if is it possible to create a menu like GSX with lua script using FSUIPC ?

No. Currently FSUIPC only offers to create SimConnect Message windows (ipc.display). You can of course fashion a GSX-style menu with that, then have a series of event.key lines, one for each possible selection,, which call a function to action that selection.

This way you are not restricted to keys 0-9, you can use whatever keys you wish, including those combinations with Ctrl, Shift or whatever. If you don't want them to be passed on to the Sim you'd need to add "LuaTrapKeyEvent=Yes" to the [General] section of the FSUIPC INI file.

After a response has been received and actions, use ipc.exit() to terminate the plug-in.




Link to comment
Share on other sites



On 7/9/2020 at 9:24 AM, duyvh0309 said:

I would like to knwow if is it possible to create a menu like GSX with lua script using FSUIPC ?

We have now added facilities for this. Could you try the following dll please (v6.0.10a): FSUIPC6.dll

There are facilities to create menus either via lua facilities or offsets:

ipc.SetMenu or
ipc.setmenu(title, prompt, table_of_items)
Prompt can be omitted for black in that space
Title and prompt can be omitted for blank in both spaces
The table of items is a Lua table with up to 10 entries.
event.MenuSelect or
event.menuselect(result, "function_name") or
With the former you can have a different function for each result. 
In both cases the result is supplied to the function which is declared as 
function function_name(result)
The result is 
1 - 9 for items 1-9 selected
0 for item 0 (10) selected
-1 for Menu Removed
-2 for Menu replaced (eg by another Lua -- all use the same ID)
-3 for menu timed out (not likely -- no timeout facility offered.
-4 for something else (not just "queued" or "displayed" -- not reported.
5100 - 51FF:
write menu tests here, up to 256 bytes including final terminator. 
Each string terminated by zero byte.
First string = Title
Second string = Prompt
Then up to 10 more strings. The text (no item numbers) of item 1-9 and 0.
Limited to 256 bytes altogether.
Write 0 to byte 5100 to close it unanswered.
0 is written by FSUIPC to Byte 5100 when selection is made or other things happen.
The selection is written to Byte 5101.
Here are a couple of scripts we have used to test this:
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.

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.


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