May 14, 20251 yr Hello Lorby, I am building a custom StreamDeck profile for the SWS PC-12/47. 1. I would like to set a Key Down event for the variable L:AUTOPILOT_KAS297B_MODE to switch between V/S mode and normal ALT select mode. I can make the button turn on but not off again. I tried copying something similar from another profile but it doesn't work as intended. Can you please help me figure this out? 2. The SWS PC-12/47 has a custom 100/1000ft ALT SEL knob/dial represented by the variables: SWS_KAS297_Inner_Knob_CW SWS_KAS297_Outer_Knob_CW SWS_KAS297_Inner_Knob_CCW SWS_KAS297_Outer_Knob_CCW The outer knob sets 1000ft increments and the inner knob 100ft but I don't understand how the mode is set between V/S and ALT select. I have used the following but it sets both the V/S and ALT and sets both 100 and 1000 ft increments at the same time when turning fast. Q. What is the correct way to separate the V/S and ALT modes and the 100/1000 ft inputs? Q2. As I already have an ALT dial, I would love the Key Down event to switch between 100/1000 ft values, if that is possible? Q3. Reading the variable AUTOPILOT VERTICAL HOLD VAR, Feet/minute shows an incorrect value, the same issue with the Altitude display. Any ideas why? UPDATE - I found the correct variable to display the AP ALT and AP V/S: L:SWS_KAS297B_Autopilot_Selected_Altitude, Number L:SWS_KAS297B_Autopilot_Selected_Vertical_Speed, Number 3. I would like to switch images over a dial when a certain variable value =1. The variable is a boolean (Autopilot Mode ALT SEL or V/S) ALT SEL is 0 and V/S is 1. I have managed to switch the image but because the variable is a boolean, I don't know how to specify 0 or 1 to activate either the 'ALT SEL ON' image or the 'V/S ON' image, and so both images switch when you push the button. How would I achieve that? Thank you Edited May 14, 20251 yr by toby23 Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Commercial Member 3 hours ago, toby23 said: 1. I would like to set a Key Down event for the variable L:AUTOPILOT_KAS297B_MODE to switch between V/S mode and normal ALT select mode. I can make the button turn on but not off again. I tried copying something similar from another profile but it doesn't work as intended. Can you please help me figure this out? Remember that Simulator LVars always require a Unit, at the very least ", Number". Otherwise the LVar will never leave AAO. Also, can you please post the actual code as text? It is next to impossible to see if this code is written correctly from screenshots. Tip: write your scripts in the AAO script editor and test them. Then copy the compiled code from the grey textbox at the bottom and paste it into the SD Action. 3 hours ago, toby23 said: The outer knob sets 1000ft increments and the inner knob 100ft but I don't understand how the mode is set between V/S and ALT select. Impossible to know without information about the type of those assets. LVar? BVar? IE? HVar? Just the name doesn't tell anyone anything. 3 hours ago, toby23 said: Q. What is the correct way to separate the V/S and ALT modes and the 100/1000 ft inputs? The behavior code of the knob says this for the "LeftSingle" mouse event: (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) 3 hours ago, toby23 said: Q2. As I already have an ALT dial, I would love the Key Down event to switch between 100/1000 ft values, if that is possible? Possible yes, but not effortless. You have to write three scripts: two to handle the left/right turns using a control LVar that tells them to do 100 or 1000 increments. And a third script that toggles that control LVar. The LVar can have any name you want. Script 1: (L:My100_1000_Switch) 0 == if{ 1 (>H:SWS_KAS297_Inner_Knob_CW) } els{ 1 (>H:SWS_KAS297_Outer_Knob_CW) } Script 2: (L:My100_1000_Switch) 0 == if{ 1 (>H:SWS_KAS297_Inner_Knob_CCW) } els{ 1 (>H:SWS_KAS297_Outer_Knob_CCW) } Script 3: 1 (L:My100_1000_Switch) - (>L:My100_1000_Switch) NOT TESTED! OFF THE TOP OF MY HEAD! 3 hours ago, toby23 said: Q3. Reading the variable AUTOPILOT VERTICAL HOLD VAR, Feet/minute shows an incorrect value, the same issue with the Altitude display. Any ideas why? Several potential reasons. Firstly, the aircraft logic doesn't have to use those variables at all. Second, the autopilot variables in MSFS are indexed. You have to provide the number of the AP "slot" that you want to query - without the index you only get slot 0. (A:AUTOPILOT VERTICAL HOLD VAR:0, Feet/minute) (A:AUTOPILOT VERTICAL HOLD VAR:1, Feet/minute) (A:AUTOPILOT VERTICAL HOLD VAR:2, Feet/minute) (A:AUTOPILOT VERTICAL HOLD VAR:3, Feet/minute) Edited May 14, 20251 yr by Lorby_SI LORBY-SI
May 14, 20251 yr Author Thank you, I think my edits might have crossed with your reply. Please see above for the variables. The 100ft increments use this script: Spoiler (M:InputType) 1 == if{ (M:Event) 'LeftSingle' scmi 0 == if{ (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) quit } } els{ (M:Event) 'RightSingle' scmi 0 == if{ (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) quit } } (M:Event) 'WheelUp' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CW) } } els{ (M:Event) 'WheelDown' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CCW) } } els{ (M:Event) 'Lock' scmi 0 == if{ (M:RelativeX) (>O:_LastX) (M:RelativeY) (>O:_LastY) 1 (>O:_Is_Interacting) } els{ (M:Event) 'Unlock' scmi 0 == if{ 0 (>O:_LastX) 0 (>O:_LastY) (O:_PushLocked) if{ 0 (>O:_PushLocked) } (O:_PullLocked) if{ 0 (>O:_PullLocked) } 0 (>O:_Is_Interacting) } els{ (M:Event) 'LeftDrag' scmi 0 == if{ (M:RelativeX) (O:_LastX) - sp0 0.2 0.01 (M:InputType) 1 == ? (>O:_InputThresholdX) l0 abs (O:_InputThresholdX) > if{ l0 (O:_InputThresholdX) / abs flr sp1 l0 (O:_InputThresholdX) % abs sp2 :1 (* for loop *) l1 0 <= if{ g2 } l1 -- sp1 l0 0 > if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CW) } } els{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CCW) } } g1 :2 l0 0 > if{ (M:RelativeX) l2 - (>O:_LastX) } els{ (M:RelativeX) l2 + (>O:_LastX) } } (M:RelativeY) (O:_LastY) - sp0 0.05 0.025 (M:InputType) 1 == ? (>O:_InputThresholdY) l0 abs (O:_InputThresholdY) > if{ l0 (O:_InputThresholdY) / abs flr sp1 l0 (O:_InputThresholdY) % abs sp2 :3 (* for loop *) l1 0 <= if{ g4 } l1 -- sp1 l0 0 > if{ (M:InputType) 1 == if{ (E:SIMULATION TIME, second) (>O:_LastPushTime) } (O:_PushLocked) ! (M:InputType) 1 == and if{ 1 (>O:_PushLocked) (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) } (O:_PullLocked) if{ 0 (>O:_PullLocked) } } els{ (M:InputType) 1 == if{ (E:SIMULATION TIME, second) (>O:_LastPullTime) } (O:_PullLocked) ! (M:InputType) 1 == and if{ 1 (>O:_PullLocked) } (O:_PushLocked) if{ 0 (>O:_PushLocked) } } g3 :4 l0 0 > if{ (M:RelativeY) l2 - (>O:_LastY) } els{ (M:RelativeY) l2 + (>O:_LastY) } } } } } } } quit ...and the 1000ft this: Spoiler (M:Event) 'WheelUp' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Outer_Knob_CW) } } els{ (M:Event) 'WheelDown' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Outer_Knob_CCW) } } els{ (M:Event) 'Lock' scmi 0 == if{ (M:RelativeX) (>O:_LastX) } els{ (M:Event) 'Unlock' scmi 0 == if{ 0 (>O:_LastX) } els{ (M:Event) 'LeftDrag' scmi 0 == if{ (M:RelativeX) (O:_LastX) - sp0 0.00025 0.001 (M:InputType) 1 == ? (>O:_InputThreshold) l0 abs (O:_InputThreshold) > if{ l0 (O:_InputThreshold) / abs flr sp1 l0 (O:_InputThreshold) % abs sp2 :1 (* for loop *) l1 0 <= if{ g2 } l1 -- sp1 l0 0 > if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Outer_Knob_CW) } } els{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Outer_Knob_CCW) } } g1 :2 l0 0 > if{ (M:RelativeX) l2 - (>O:_LastX) } els{ (M:RelativeX) l2 + (>O:_LastX) } } } } } } } quit Edited May 14, 20251 yr by toby23 Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Author I would love to understand how to switch the image for the boolean value 0 or 1. Is that possible? Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Commercial Member 4 minutes ago, toby23 said: use this script: These scripts are really easy to read: (M:Event) tells you which mouse event is handled in this section. Create the scripts in AAO accordingly (=one script for each mouse event section that you require.) Ignore all parts containing O: and I: variables, those cannot be handled from the outside. LORBY-SI
May 14, 20251 yr Commercial Member Just now, toby23 said: I would love to understand how to switch the image for the boolean value 0 or 1. Is that possible? Sorry, I don't understand. What image? Where? How? On the StreamDeck? Which Action? Where does that boolean value come from? LORBY-SI
May 14, 20251 yr Author Just now, Lorby_SI said: Sorry, I don't understand. What image? Where? How? On the StreamDeck? Which Action? Where does that boolean value come from? This is my layout with the ALT mode active: L:AUTOPILOT_KAS297B_MODE, bool - Value is 0 This is my layout with the V/S mode active: L:AUTOPILOT_KAS297B_MODE, bool - Value is 1 GOAL: Only one 'alternative image' should be active at a time, either 'FT' or 'FT/MIN' depending on if the L:AUTOPILOT_KAS297B_MODE, bool - Value is 0 or 1. PROBLEM: I don't know how to set the boolean value to show the correct image. Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Author 20 minutes ago, Lorby_SI said: Also, can you please post the actual code as text? It is next to impossible to see if this code is written correctly from screenshots. This is the only code that I can 'grab' from pressing CTRL G while hovering over the 'Switch between V/S and ALT' button in developer mode: Spoiler (M:InputType) 1 == if{ (M:Event) 'LeftSingle' scmi 0 == if{ (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) quit } } els{ (M:Event) 'RightSingle' scmi 0 == if{ (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) quit } } (M:Event) 'WheelUp' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CW) } } els{ (M:Event) 'WheelDown' scmi 0 == if{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CCW) } } els{ (M:Event) 'Lock' scmi 0 == if{ (M:RelativeX) (>O:_LastX) (M:RelativeY) (>O:_LastY) 1 (>O:_Is_Interacting) } els{ (M:Event) 'Unlock' scmi 0 == if{ 0 (>O:_LastX) 0 (>O:_LastY) (O:_PushLocked) if{ 0 (>O:_PushLocked) } (O:_PullLocked) if{ 0 (>O:_PullLocked) } 0 (>O:_Is_Interacting) } els{ (M:Event) 'LeftDrag' scmi 0 == if{ (M:RelativeX) (O:_LastX) - sp0 0.2 0.01 (M:InputType) 1 == ? (>O:_InputThresholdX) l0 abs (O:_InputThresholdX) > if{ l0 (O:_InputThresholdX) / abs flr sp1 l0 (O:_InputThresholdX) % abs sp2 :1 (* for loop *) l1 0 <= if{ g2 } l1 -- sp1 l0 0 > if{ 1 if{ (O:_KnobAnimVar) 10 + dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CW) } } els{ 1 if{ (O:_KnobAnimVar) 10 - dnor (>O:_KnobAnimVar) (>H:SWS_KAS297_Inner_Knob_CCW) } } g1 :2 l0 0 > if{ (M:RelativeX) l2 - (>O:_LastX) } els{ (M:RelativeX) l2 + (>O:_LastX) } } (M:RelativeY) (O:_LastY) - sp0 0.05 0.025 (M:InputType) 1 == ? (>O:_InputThresholdY) l0 abs (O:_InputThresholdY) > if{ l0 (O:_InputThresholdY) / abs flr sp1 l0 (O:_InputThresholdY) % abs sp2 :3 (* for loop *) l1 0 <= if{ g4 } l1 -- sp1 l0 0 > if{ (M:InputType) 1 == if{ (E:SIMULATION TIME, second) (>O:_LastPushTime) } (O:_PushLocked) ! (M:InputType) 1 == and if{ 1 (>O:_PushLocked) (L:AUTOPILOT_KAS297B_MODE, Bool) ! (>L:AUTOPILOT_KAS297B_MODE, Bool) } (O:_PullLocked) if{ 0 (>O:_PullLocked) } } els{ (M:InputType) 1 == if{ (E:SIMULATION TIME, second) (>O:_LastPullTime) } (O:_PullLocked) ! (M:InputType) 1 == and if{ 1 (>O:_PullLocked) } (O:_PushLocked) if{ 0 (>O:_PushLocked) } } g3 :4 l0 0 > if{ (M:RelativeY) l2 - (>O:_LastY) } els{ (M:RelativeY) l2 + (>O:_LastY) } } } } } } } quit Edited May 14, 20251 yr by toby23 Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Commercial Member 7 minutes ago, toby23 said: PROBLEM: I don't know how to set the boolean value to show the correct image. Sorry, don't know how to help you with that. I really can't write your SD profile for you. With the Rotary Encoder Canvas, all definitons have a "Visibility" parameter. That is what you use to make an image or a text visible or invisible. But - you are obviously changing the images already - so you apparently know how to do that?? Edited May 14, 20251 yr by Lorby_SI LORBY-SI
May 14, 20251 yr Commercial Member 1 minute ago, toby23 said: This is the only code that I can 'grab' from pressing CTRL G while hovering over the 'Switch between V/S and ALT' button in developer mode: That is not what I am talking about. I mean YOUR code that you posted above in the type S: action. When you want people to check the code in your StreamDeck action, posting a screenshot is mean. I don't think anyone will bother with re-typing your code. And even assuming that I did, I couldn't tell you if your actual code has syntax errors in it. LORBY-SI
May 14, 20251 yr Author 8 minutes ago, Lorby_SI said: Sorry, don't know how to help you with that. I really can't write your SD profile for you. With the Rotary Encoder Canvas, all definitons have a "Visibility" parameter. That is what you use to make an image or a text visible or not. Perhaps I didn't explain well enough. I can switch the images out with using the commands below but this changes both images (ALT and V/S) as I don't understand how to switch only one image at a time because the variable is L:AUTOPILOT_KAS297B_MODE, bool and I don't know how to specify the values 0 or 1 for ALT or V/S mode. What is missing is an option to set the value 0 or 1. I can set the Visibility value but how do I set the Boolean value? BUTTON OFF BUTTON ON Edited May 14, 20251 yr by toby23 Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Author 4 minutes ago, Lorby_SI said: When you want people to check the code in your StreamDeck action, posting a screenshot is mean. I don't think anyone will bother with re-typing your code. And even assuming that I did, I couldn't tell you if your actual code has syntax errors in it. Sorry, I am trying hard here to understand this but find it quite difficult to wrap my head around. I would never be mean. If you mean the code that I was trying to use, it was: 1 (L:AUTOPILOT_KAS297B_MODE) - (>L:AUTOPILOT_KAS297B_MODE) which I copied from the 100/1000ft 'switch' code that you gave me for another profile over a year ago. Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
May 14, 20251 yr Commercial Member 2 minutes ago, toby23 said: Perhaps I didn't explain well enough. I can switch the images out with using the commands below but this changes both images (ALT and V/S) as I don't understand how to switch only one image at a time because the variable is L:AUTOPILOT_KAS297B_MODE, bool and I don't know how to specify the values 0 or 1 for ALT or V/S mode. I'm sorry, but I don't get it. Maybe it is late or maybe I am being dumb, but I really don't understand what you are asking. In your screenshot, ALT and V/S are different Actions. When they both switch, you apparently have set the same Visibility rules for both actions. Just remove the Visibility on the one that you don't want to change? LORBY-SI
May 14, 20251 yr Commercial Member 5 minutes ago, toby23 said: If you mean the code that I was trying to use, it was: As stated above, the LVars are missing the unit. You cannot just copy and paste simulator code. The sim doesn't need Units in LVars, but AAO does. The unit tells AAO that you want this variable to be sent to the simulator. Without a unit it is just an AAO internal calculation variable - so your script had no effect in the sim. 1 (L:AUTOPILOT_KAS297B_MODE, Number) - (>L:AUTOPILOT_KAS297B_MODE, Number) Edited May 14, 20251 yr by Lorby_SI LORBY-SI
May 14, 20251 yr Author 2 minutes ago, Lorby_SI said: I'm sorry, but I don't get it. Maybe it is late or maybe I am being dumb, but I really don't understand what you are asking. In your screenshot, ALT and V/S are different Actions. When they both switch, you apparently have set the same Visibility rules for both actions. Just remove the Visibility on the one that you don't want to change? God, I am slow today. You're right. I just needed to change the Visibility value to 0 of the other button. Thanks Ryzen 5800X3D, 64GB RAM, RTX 4090, Windows 11Link to my: Dynamic Flight Dispatch Tool
Create an account or sign in to comment