Jump to content
The simFlight Network Forums

How to Lua code 2 index event


DaveSCUSA

Recommended Posts

The events below are logged when turning the Avionics Master Switch On/Off in the cockpit. I would like to attached this activity to the Avionics switch on the Honeycomb Alpha. The AVIONICS_MASTER_SET is not used in this aircraft. Apparently the aircraft logic connects and disconnects the RH_Main_BUS (#3) to the Avionics Bus (#4) as listed in the Systems.cfg. 

Avionics On
   389375 *** EVENT: Cntrl= 67073 (0x00010601), Param1= 3 (0x00000003), Param2= 4 (0x00000004) ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE
Avionics Off
   424703 *** EVENT: Cntrl= 67073 (0x00010601), Param1= 3 (0x00000003), Param2= 4 (0x00000004) ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE

According to the SDK, the event is coded (Polish Reverse) -  (K:3:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE:4, Bool)

The only way I can see to toggle this event is to execute:

ipc.execCalcCode(“K:3:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE:4, Bool”)

Is this correct or is there a better way? Is there an improvement to ipc.control(67073, param) to enter 2 indices?

 

Link to comment
Share on other sites

Haven't you already asked this question?
The only way to send an event with more than one parameter is via calculator code. As to the exact RPN format if the calculator code for such an update, I am not sure.  Check the Asobo  documentation or ask on the Asobo forums. 

18 hours ago, DaveSCUSA said:

The only way I can see to toggle this event is to execute:

ipc.execCalcCode(“K:3:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE:4, Bool”)

Does that work? If not. try: ipc.execCalcCode(“4 (>K:3:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)”)
Maybe also check out some of the MF presets that are already using this - just search for ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE at https://hubhop.mobiflight.com/presets/

Link to comment
Share on other sites

8 hours ago, John Dowson said:

Haven't you already asked this question?
The only way to send an event with more than one parameter is via calculator code. As to the exact RPN format if the calculator code for such an update, I am not sure.  Check the Asobo  documentation or ask on the Asobo forums. 

Thank you. What I was asking was the syntax of using. ipc.execCalcCode. You answered that.

Thanks for the input on Mobiflight. Since I don't use it, it is not on my radar. I'll give it an attempt.

The reason many of us come to you is that you have more experience than anyone (except Asosbo developers) in SimConnect, Lua and Polish notation. For many of us, the documentation is inadequate and confusing. Looking to you for clarity.

Link to comment
Share on other sites

15 hours ago, DaveSCUSA said:

Thanks for the input on Mobiflight. Since I don't use it, it is not on my radar. I'll give it an attempt.

The MF HubHop website is very useful resource - it contains the calculator code/presets found by the community and is very useful for a repository of calculator code for various aircraft. You should certainly use this for calc. code examples. The MF discord server (MSFS2020 channel) is also the place to ask questions on calc code syntax and how to determine the calc code to be used for specific functions.

15 hours ago, DaveSCUSA said:

The reason many of us come to you is that you have more experience than anyone (except Asosbo developers) in SimConnect, Lua and Polish notation. For many of us, the documentation is inadequate and confusing. Looking to you for clarity.

Calc code is pretty new to me as well, and I am by no means an expert in this area. I help out if I can, and if I can't I will try and point you in the right direction. I am extremely busy at the moment and don't have time to look into such things (that are really out-of-scope of the support I provide for FSUIPC) in detail.

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.