December 1, 20223 yr I'm trying to set the altitude with the ALT preselector in 1000 ft steps higher or less. It's an Carenado CJ2 aircraft on a FSX:SE Sim, and Carenado is very tricky. I asked their support for help, but they told me, thats not possible, because its too complex and they have their own thing. The FSUIPC logger tells me, if I set the altitude with the mouse, it starts 6 event-IDs at the same time to set the desired altitude. With Linda tracer I found a Lvar "L:CUSTOM_AP_ALT_VAR_SET_ENGLISH" to operate the ALT value. I made a lua macro with it. At Mobiflight in the macro settings at the value window, I wrote 1000 in it. Then I do one click with the encoder to fire the macro, I get 1000 on the PC monitor. More clicks nothing, no action - the value stays as it is, just 1000. If I write e.g. 5000 in the value window and I do one click, I get 5000 on the monitor, but nothing more. Further I made a little Lua test file: ipc.writeLvar("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", 4000) and fire this file with an button press in FSUIPC. So I get 4000 ft altitude on the monitor. It's similar to the macro. If I change the value e.g. I fill in 5000, I get 5000 ft. My thinking goes in that direction: I have 2 lua files, one for inc/1000 and one for dec/1000. But unfortunately I have no idea, how to manage this. Maybe someone could give me a little help. Thanks in advance Best regards Franz Edited December 1, 20223 yr by wif added some more text
December 1, 20223 yr Franz, I am totally unfamiliar with the Carenado CJ2, nor have access to either the aircraft or its Lvars. However, this might work for you: function AltitudeSet_Up () a = ipc.readLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") a = a + 1000 ipc.writeLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", a) end function AltitudeSet_Down () a = ipc.readLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") a = a - 1000 ipc.writeLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", a) end Assign the first function to one button press and the second to another. I'm not sure how/where you're putting your lua files, but I normally put them in the specific aircraft's user file, and assign the lua to a button from there. For instance, when LINDA first opens select the Carenado CJ2 from the aircraft drop-down box, then select [Joysticks]. Locate the button you wish to assign (easiest way is just press it) then right-click to bring up the assignment menu. Go down to the User functions and click the topmost Edit User Module. If you haven't added anything there yet it'll be blank except for the default messages. Add the two functions above after the line -- insert your code below here: and above the line -- Just a message in console and then click save then exit the window. Now you can assign the functions to your desired buttons. Edited December 1, 20223 yr by Masterius
December 2, 20223 yr Author Hi, thanks a lot for your perfekt instruction. It's working. I assigned the 2 functions to joystick buttons for testing. It's working as desired. After that I tried to assigned the functions to other buttons. But this is not possilble, because LINDA does not support this FSUIPC button press or key press to assign my encoder, which should fire the functions. Maybe do you know a trick to can assign another button except joystick buttons? Best regards Franz
December 3, 20223 yr 4 hours ago, wif said: Maybe do you know a trick to can assign another button except joystick buttons? I'm not sure what you mean by this. Do you mean a hat switch or rotary encoder?
December 3, 20223 yr 2 hours ago, wif said: I mean a rotary switch The only rotary switches I am familiar with are my Saitek radio panel and on my X52 HOTAS, and neither of those are readable by either LINDA or FSUIPC. Can LINDA or FSUIPC "read" your rotaries? If so, if they output readable signals, then there should be a way of doing what you want. ~Masterius
December 3, 20223 yr Author Hi Masterius, LINDA can't read my rotaries, FSUIPC can read it, but how manage I the connection between the functions and FSUIPC?
December 3, 20223 yr Author Hi Masterius, I did some investigation, maybe I found a solution, I am going to figure it out and I'll write you about my success. Franz
December 3, 20223 yr 2 hours ago, wif said: Hi Masterius, LINDA can't read my rotaries, FSUIPC can read it, but how manage I the connection between the functions and FSUIPC? 1 hour ago, wif said: Hi Masterius, I did some investigation, maybe I found a solution, I am going to figure it out and I'll write you about my success. Franz This is all predicated on FSUIPC being able to read your rotary, and do so as button presses: First, create two text files, one for each function. For instance, call one file Alt_Inc.lua and the other Alt_Dec.lua. Copy and paste the functions in their respective file. For instance, Alt_Inc.lua would be: function AltitudeSet_Up () a = ipc.readLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") a = a + 1000 ipc.writeLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", a) end Change Alt_Dec.lua to be: function AltitudeSet_Down () a = ipc.readLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH") if a<=1000 then a=0 ipc.writeLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", a) else a = a - 1000 ipc.writeLvar ("L:CUSTOM_AP_ALT_VAR_SET_ENGLISH", a) end end Second, place these files in the FSUIPC folder that also holds your LINDA files. You should see both LINDA.exe and FSUIPC(version).ini in that folder. Third, copy the fsuipc.ini file and save it somewhere on your drive as a backup, then open the original file. Look for the entry heading [LuaFiles]. If you do not see one, create one after the [Axes] and [Keys] entries. Next, add the Lua names to the [LuaFiles] section. If you had to create that (and using the above sample names) it would be this: 1=Alt_Inc 2=Alt_Dec If there are already entries there, add these using the next sequential numeric value. Once you have added these, save and close the file. Finally, start up your sim and load the Carenado CJ2. Open up FSUIPC. Select the "Buttons & Switches" tab. Tick the "ProfileSpecific" box, operate the rotary in the direction for altitude increase to that the "Press Button" box populates with the value for that rotary, then the "Select for FS Control" box. Next click the dropdown select arrow of the "Control sent when button pressed" menu, and scroll down until you find Lua Alt_Inc then select that. Repeat that for altitude decrease. Click [OK] to save and close FSUIPC. Your rotary should now work. ~Masterius Edited December 3, 20223 yr by Masterius
December 3, 20223 yr Author Hi Masterius, it's working with my rotary encoder. I switched this encoder from the arduino to the mmjoy. LINDA can see now this rotary encoder. According your instruction I did the assaigment. I am happy now. Thanks again for your help. Franz
December 3, 20223 yr Author Hi Masterius, I haven't seen your last message. As I wrote before, I found a solution with the mmjoy2. Next I'll do your Lua so I could use my setting as planned. Thanks a lot Franz
December 3, 20223 yr Author Hi Masterius, I'll be back, I tried your Lua script, unfortunately no success. I found out, that to assign the rotary encoder to FSUIPC goes for me via the software Mobiflight, it goes not direct what I told you earlier. That was my fault. Sorry for that. I did following: First I assigned the first lua file to a keypress in FSUIPC. Second in my software Mobiflight I assigned the rotary encoder to that keypress. This software can assign the rotary encoder via different ways. One way is via a keypress, another way would be via an user offset - the Lvar is written into that offset. I did it via the keypress. This keypress fires the lua file. I can see it on the logger in FSUIPC. I was not sure, what i should put into the parameter field. I tried an "a". But this doesn't work. Thereafter I tried an "0". the same again. Maybe this is the reason for not working? What to do think. Thanks in advance. Franz
December 4, 20223 yr Author Hi Masterius I assigned the lua file to a key press - this works, also I let the Parameter field blank. But as you can see, on the right site there is a 0 in the Parameter field. I cancelled the assignment several times and did it again as you described it above. Every time with a blank Parameter field. But every time, the right site shows an 0. When I turn the rotary, the logger shows it, it triggers the lua file, but no change at the Alt preselector. It stays at zero. Maybe do you have an idea? Thanks in advance Franz
Archived
This topic is now archived and is closed to further replies.