Jump to content
The simFlight Network Forums

Recommended Posts

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

Pete

 

 

Posted

 

@duyvh0309

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:

LUA FACILITIES
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
event.menuselect("function_name")
 
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.
 
OFFSETS:
 
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.
 
Results:
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:

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.