Jump to content
The simFlight Network Forums

Trigger custom events from .evt-files from LUA-Script


joeherwig

Recommended Posts

Hi John, Hi Pete, ladies and gents,

I have the events from the .evt file working great using FSUIPC7.
Now i'm struggling on the next challenge.

Instead of assigning it directly to buttons or axis, i'd like to trigger those events from LUA scripts and do some more things.
Unfortunately even searching all the FSUIPC documentation - i only found the brief hint below:
 

Quote

Add-on Custom Events

FSUIPC includes facilities for assigning buttons and keys to MSFS add-on custom events. These are named events (FS
controls) implemented in add-ons via SimConnect facilities. Custom event names always contain a period (.) and this
distinguishes them from MSFS internal events/controls.
The events to be made assignable are listed in '.evt' files placed in the FSUIPC installation folder. Up to 128 such files
will be recognised, each one containing no more than 256 entries defining a custom event name. The format of each
file is


[Events]
0=name.of.event1
1 = ...


etc.
Numbering can be 0-255 or 1-255, but the first omission terminates the list as far as FSUIPC is concerned.
The assignments can then be made in the normal drop-down lists in FSUIPC

 

Is there any way to trigger those events from within LUA scripts as well?
Even the FSUIPC7: Lua Library Reference didn't help me.

Probably i just missed it.

I now assigned those events to Buttons on the VRI MCP2A.
That results in 

 
[Buttons.A320]
0=P289,22,C32776,0  -{:A32NX.FCU_SPD_PUSH}-
1=P289,17,C32777,0  -{:A32NX.FCU_SPD_PULL}-
2=P289,23,C32783,0  -{:A32NX.FCU_HDG_PULL}-
3=P289,28,C32782,0  -{:A32NX.FCU_HDG_PUSH}-
4=P290,7,C32788,0   -{:A32NX.FCU_ALT_PUSH}-
5=P290,2,C32789,0   -{:A32NX.FCU_ALT_PULL}-
6=P290,14,C32790,0  -{:A32NX.FCU_VS_INC}-
7=P290,10,C32794,0  -{:A32NX.FCU_VS_PULL}-
8=P289,25,C32780,0  -{:A32NX.FCU_HDG_DEC}-
9=P289,24,C32780,0  -{:A32NX.FCU_HDG_DEC}-
10=P289,26,C32779,0     -{:A32NX.FCU_HDG_INC}-
11=P289,27,C32779,0     -{:A32NX.FCU_HDG_INC}-
12=P290,5,C32785,0  -{:A32NX.FCU_ALT_INC}-
13=P290,6,C32785,0  -{:A32NX.FCU_ALT_INC}-
14=P290,3,C32786,0  -{:A32NX.FCU_ALT_DEC}-
15=P290,4,C32786,0  -{:A32NX.FCU_ALT_DEC}-
16=P290,12,C32791,0     -{:A32NX.FCU_VS_DEC}-
17=P290,11,C32791,0     -{:A32NX.FCU_VS_DEC}-
18=P290,13,C32790,0     -{:A32NX.FCU_VS_INC}-
19=P290,15,C32793,0     -{:A32NX.FCU_VS_PUSH}-

in the FSUIPC7.ini.

Taking a look in the "FSUIPC7 for advanced users.pdf" i noticed, that it looks just like 

Quote

For controls: <Entry number> = <Action><Joy#>,<Btn#>,C<control>,<parameter>

So i added those as functions in my LUA:

function A32nx_HDG_Mode_Managed ()
     ipc.control(32782, 0)
end 

function A32nx_HDG_Mode_Selected ()
     ipc.control(32783, 0)
end 

Could you please confirm, that my assumptions are right?
In case it is like that. Would it be probably possible to somehow mention anywhere in the documentation how i can get the control numbers based on the aircraft event names?
It's a bit hard to reverse-engineer. 🙂

Thanks and have a good night!

Joe

 

Link to comment
Share on other sites

10 hours ago, joeherwig said:

Could you please confirm, that my assumptions are right?

Yes, that is correct.

10 hours ago, joeherwig said:

In case it is like that. Would it be probably possible to somehow mention anywhere in the documentation how i can get the control numbers based on the aircraft event names?

I have explained this in a few posts, but yes, you are right - I should add this to the documentation. See 

 

or 

 

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