Andre92 Posted February 15, 2022 Report Posted February 15, 2022 Hello, I am trying to assign a button to the Tailwheel lock for the Milviz PC-6. On the Hubhop site of Mobiflight i found the following code: (A:TAILWHEEL LOCK ON, Bool) 0 == if{(>K:TOGGLE_TAILWHEEL_LOCK)} Can i use this for FSUIPC as well? If so, how? Sorry for the noob question, but i'm more and more confused with MSFS way of implementing events A: K: L: H:....? 🙃 Regards, André
John Dowson Posted February 15, 2022 Report Posted February 15, 2022 6 minutes ago, Andre92 said: I am trying to assign a button to the Tailwheel lock for the Milviz PC-6. On the Hubhop site of Mobiflight i found the following code: (A:TAILWHEEL LOCK ON, Bool) 0 == if{(>K:TOGGLE_TAILWHEEL_LOCK)} Can i use this for FSUIPC as well? If so, how? Yes - a 'K' type variable is the same as an FSUIPC control, so just assign your button to the control (when you select 'select for FS control') Toggle Tailwheel Lock. 'A' type variables are simvars and are held in fsuipc offsets (that is in offset 0x2A90). The conditional check 'A:TAILWHEEL LOCK ON, Bool) 0 == if' is only checking the lock is off before sending the control ('(>K:TOGGLE_TAILWHEEL_LOCK)') , so its the code to turn on the wheel lock. You don't really need that if assigning to a button. If assigning to a switch, with one button for off and another for on, then you would use an offset condition (see Advanced User Guide) to only send the control if the actual state of the wheel lock (as reported in that offset) was in the correct position (value 1 or 0, depending if the assignment is for on or off). The latest version of FSUIPC, v7.2.16, released a few hours ago, also has assignments to MobiFlight (as well as user-provided) presets available for direct assignment in the menus. Please download and try that. The MF presets should be available automatically, but please check the Advanced User guide for details. John
Andre92 Posted February 16, 2022 Author Report Posted February 16, 2022 (edited) That worked great! Thank you John, also for taking the time to write such a detailed answer. I've made two small lua files to read the offset and turn the tailwheel on/off depending on the state. Works like a charm. They are attached here, in case someone else wants to use them. (Place them in the fsuipc directory and assign them through the FSUIPC Interface) Andre MilvizPC6_Tailwheel.zip Edited February 16, 2022 by Andre92 Changed the ipcwrite to unsigned double
John Dowson Posted February 16, 2022 Report Posted February 16, 2022 Hi Andre, glad you got it working. One thing in your lua scripts - you are reading as an 'unsigned double', which is correct, but writing as a signed double. It will still work in this case, but better to also write as a signed double using the ipc.writeUD() function. Also, you could have achieved the same using a standard control assignment with an offset condition. That would be slightly faster, as the lua method requires your script to be compiled each time before it is ran, but in this case it doesn't matter much. John
Andre92 Posted February 16, 2022 Author Report Posted February 16, 2022 Hi John, I've corrected the lua files and will take a look at setting an offset condition directly to the assignment when i have more time, this evening. Thanks for your help! Andre
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