May 13, 20242 yr I am a newbie with LINDA but have managed to assign a button on my Saitek X52 joystick to an existing FSX command Panel 1 . No problems, the Panel 1 window opens up. Now i have been playing around with my brother's Carenado King AIR B200, and the console has found a number of Lvars that are not listed Fsx controls that i can use...... With most of them i have been assigning them in FSUIPC with the toggle parameter and then assigning a key press. They are all working fine However, a few switches are three-way in the vcirtual cockpit. For example there is a 3 position windshield anti-ice in the virtual cockpit which is defined in the console (roughly) as ASD_WNDSHLD_ANTIICE_PILOT.. Using the LINDA console, the switch has three positions: OFF, ON and TEST the values are +1, 0, -1 . I have programmed 3 different keys on my keyboard in fsuipc with the different parameters and can switch to each position correctly even thoough it is hugely wasteful using three keys ( i just. wanted to check it works ). What i need is a LUA/LINDA.FSIPC??? command that will cycle between the three positions on the one switch!!! Do i need a LUA script ? or a LINDA function or can i do it easily in FSUIPC .. im stumped !!!! any help would be greatly appreciated Edited May 13, 20242 yr by sreweti
May 14, 20242 yr Author No replies so i went to the newest version of Chat GPT 4o.. i have a subscription, and posed the question. i was surprised that it answered such a specific question with ease. .. a bit scary actually the power of AI . lua fsuipc and LINDA are niche software but CHAT GPT just ripped it. I have finally tested it on my PC flight simulator and B200 and it works perfectly. .I Firstly you need linda to find teh correct LVARS as the B200 hasa lot of custom switches you wont find in FSX controls. It will also fine the value of the parameters of the LVAR which is greta Here is what Chat GPT replied to my query word for word To create a LUA script for FSUIPC that cycles through the positions of the three-way switch (OFF, ON, and TEST) using one key, you can use the following script as a starting point. This script will increment the switch position each time the key is pressed and wrap around when it reaches the end. Here is the script: Create a new LUA script file and name it something like cycle_switch.lua. Add the code below to the file: Save the script in the Modules folder of your FSX installation. Open FSUIPC and assign a key press to run this LUA script. To do this: Go to the "Key Presses" tab in FSUIPC. Press "Set" to define the key you want to use for cycling the switch. In the action list, select "Lua <your_script_name>". In this case, it will be "Lua cycle_switch". ( yes it was there after paling lua in modules folder!!! ) With this script, pressing the defined key will cycle the windshield anti-ice switch through its positions: OFF (0), ON (1), and TEST (-1). This way, you only need to use one key to control the switch. -- Define the LVar for the windshield anti-ice switch local lvar_name = "ASD_SWITCH_WDSHLD_ANTIICE_PILOT" -- Define the switch positions local switch_positions = {-1, 0, 1} -- Function to cycle through switch positions function cycleSwitch() -- Get the current value of the LVar local current_position = ipc.readLvar(lvar_name) -- Find the index of the current position local current_index = nil for i, v in ipairs(switch_positions) do if v == current_position then current_index = i break end end -- Determine the next position local next_index = current_index + 1 if next_index > #switch_positions then next_index = 1 end local next_position = switch_positions[next_index] -- Set the LVar to the next position ipc.writeLvar(lvar_name, next_position) end -- Call the function to cycle the switch position cycleSwitch()
May 14, 20242 yr Author in my case, i used the W for the Winshleld Anti Ice pilot - cycle switch.lua .. pressing the W key repeatedly cycles the switch up and down https://drive.google.com/file/d/1moUoFNpgtqRiiVOioJ9Yonr6A1CWsXxU/view?usp=sharing https://drive.google.com/file/d/16pJ9-epkD238cEqMpJyu__4Kwly_HTgK/view?usp=sharinghttps://drive.google.com/file/d/1yhMEdXBVKXNTudrgVuk2y_SwZgd9I6rE/view?usp=sharing
Archived
This topic is now archived and is closed to further replies.