Airbuspilot Posted October 14 Report Posted October 14 Hello, may i ask for a little Help please? I need to readout the Values of some controls like 66719 (SeatBeltSwitch) with a lua Script. Could somebody please give me a Code Example for that Task? Thanks in Advance, Joachim
John Dowson Posted October 14 Report Posted October 14 6 minutes ago, Airbuspilot said: I need to readout the Values of some controls like 66719 (SeatBeltSwitch) with a lua Script. What do you mean by this? If you want to intercept that control in a lua scrip, use something like the following: function InterceptControl(controlnum, param) //do stuff here - for now, just log ipc.log("Control " .. controlnum .. "intercepted with parameter " .. param) end event.control(66719, "InterceptControl") John
Airbuspilot Posted October 15 Author Report Posted October 15 Thanks for the Answer John. I will give you a short Explanation of what i mean. The Value within the Control 66719 could be 0 or 1. Depending on the Switch Position in the used A/C. In my Case the FBW A320neo. I want to ask which Value is set and do some Stuff after getting the active Value, depending on the Value, that i found. Is there any easier Code than the one, you gave above? Joachim
John Dowson Posted October 15 Report Posted October 15 1 hour ago, Airbuspilot said: Depending on the Switch Position in the used A/C. In my Case the FBW A320neo. I want to ask which Value is set and do some Stuff after getting the active Value, For the position of the overhead seatbelt switch in the FBW A320, just read the lvar L:XMLVAR_SWITCH_OVHD_INTLT_SEATBELT_Position, i.e. seatBeltSwitch = ipc.readLvar("L:XMLVAR_SWITCH_OVHD_INTLT_SEATBELT_Position") John
Airbuspilot Posted October 15 Author Report Posted October 15 I know about this XmlVar. Unfortunately the Value doesn't change from 0 to 1 or vice versa when operating the Switch in the Cockpit. It stays on 0. Alternatively i found the SimConnectVar CABIN SEATBELTS ALERT SWITCH. The Value changes when operating the Switch in the Cockpit. Could you please give a Code Example for the Readout of this Variable?
John Dowson Posted October 15 Report Posted October 15 20 minutes ago, Airbuspilot said: Unfortunately the Value doesn't change from 0 to 1 or vice versa when operating the Switch in the Cockpit. Hmm..what version of the FBW A320 are you using (release or dev)? It should hold the correct value, according to the MF presets... 21 minutes ago, Airbuspilot said: Alternatively i found the SimConnectVar CABIN SEATBELTS ALERT SWITCH. The Value changes when operating the Switch in the Cockpit. That is a simvar that is currently not held in any offsets. To be able to read the value of this simvar, you first need to add it to a free/spare FSUIPC offset. You can do this via the myOffsets.txt file - please see the Advance User guide, section Adding Simulator variables (simvars) to FSUIPC offsets on page 35 of the Advanced User guide, Once it is in an offset, you can read the value using the lua ipc library to read offset values. John
Airbuspilot Posted October 16 Author Report Posted October 16 I am using the 0.11.1 Stable Version of the FBW A320. Should i change it to the Dev Version to use the XmlVar? I don't have any Experiences in adding Simvars to FSUIPC Offsets yet. But i will give it a try. Thanks for naming the Manual and Section to learn about it. Thanks for all your valuable Help. Joachim
John Dowson Posted October 16 Report Posted October 16 2 hours ago, Airbuspilot said: I am using the 0.11.1 Stable Version of the FBW A320. Should i change it to the Dev Version to use the XmlVar? Just took a look at both the stable and dev versions and I see the same in both - this lvar stays at 1 regardless of the position of the switch. You should maybe report this to FBW. So try the simvar instead. Once you have added it to an offset, log/monitor that offset (using FSUIPCs offset logging facilities) and see if that changes value when you change the switch position. I have checked that in the dev version and it works there - this is the entry in the myOffsets.txt file that I use to add the simvar to offset 0x66C0: // offset, size, simvar, type, units [, w] 0x66C0, 1, CABIN SEATBELTS ALERT SWITCH,I32, Bool This should also work in the stable, but please test. John
Airbuspilot Posted October 17 Author Report Posted October 17 BTW: It is the same Behaviour in the Headwind A339. Because of your great Documentation, i figured out, how to use the myOffsets.txt. It's a great Thing. It works fantastic in the A320 and the A339. Thanks for your Patience and the great Help. Joachim
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now