Jump to content
Sign in to follow this  
Peter Clark

Reading/setting PMDG rotor brake variables

Recommended Posts

Hi,

So - trying to learn how to use Axis and Ohs to write my own scripts, I'm trying to do a "landing gear up" command. OK, so look at the xml in the behaviors, I see in relevant parts;

        <!-- 455 - LANDING GEAR Lever ############################# -->
        <Component ID="ngx_switch_455_a" Node="ngx_switch_455_a">
            <UseTemplate Name="ASOBO_GT_Anim_Code">
                <ANIM_NAME>ngx_switch_455_a</ANIM_NAME>
                <PART_ID>NGX_SWITCH_455_A</PART_ID>
                <ANIM_LENGTH>100</ANIM_LENGTH>
                <ANIM_CODE>
                        (L:switch_455_73X, number)
                <CALLBACKCODE>
                        455 100 * (&gt;L:SwitchID, number)

So, I read lvars from sim, and got 0, 30, 60 for the switch_455_73X changes when I use the gear handle, but I'm not sure how to convert these into my script to hit the K:ROTOR_BRAKE action? I've tried 45500 (>K:ROTOR_BRAKE) but it doesn't move the handle to up which the 0 value for switch 455 reads.

Sorry for the basic question but my seach-fu hasn't found a formula for (switch number X plus value Y = Z to rotor_brake).

TIA.

Share this post


Link to post
Share on other sites

You left out the part where the behavior logic actually processes the mouse events ("LeftSingle" = single click with the left mouse button)
 

 <CALLBACKCODE>
                        455 100 * (>L:SwitchID, number)

                        (M:Event) 'LeftSingle' scmp 0 ==
                        if{
                           (M:RelativeY) 0 >
                           if{ (L:SwitchID, number) 2 + (>L:SwitchID, number) }
                           els{ (L:SwitchID, number) 1 + (>L:SwitchID, number) }
                        }
						(M:Event) 'Move' scmp 0 ==
						if{
						   (L:SwitchID, number) 3 + (>L:SwitchID, number)
						}
						(M:Event) 'LeftRelease' scmp 0 ==
						if{
							(M:RelativeY) 0 >
							if{ (L:SwitchID, number) 5 + (>L:SwitchID, number) }
							els{ (L:SwitchID, number) 4 + (>L:SwitchID, number) }
						}
						(M:Event) 'RightRelease' scmp 0 ==
						if{
						   (L:SwitchID, number) 5 + (>L:SwitchID, number)
						}
						(M:Event) 'MiddleSingle' scmp 0 ==
						if{
						   (L:SwitchID, number) 6 + (>L:SwitchID, number)
						}
						(M:Event) 'WheelUp' scmp 0 ==
						if{
						   (L:SwitchID, number) 7 + (>L:SwitchID, number)
						}
						(M:Event) 'WheelDown' scmp 0 ==
						if{
						   (L:SwitchID, number) 8 + (>L:SwitchID, number)
						}
						(L:SwitchID, number) (>K:ROTOR_BRAKE)
				</CALLBACKCODE>

So the correct ROTOR_BRAKE codes would be:
(455 * 100) + n, and n going from 1 to 8.


This particular lever is a bit tricky, because the actual code depends on where you click on the lever "(M:RelativeY)"
Can't test it right now, but I assume that 
45502 (>K:ROTOR_BRAKE) 45505 (>K:ROTOR_BRAKE)
moves it one direction
45501 (>K:ROTOR_BRAKE) 45504 (>K:ROTOR_BRAKE)
moves it the other direction

It looks like you don't need the "LeftRelease" every time you send a "LeftSingle" mouse event. I just like to add them anyway, because I simply don't know if the 737 will handle mouse events correctly where the left button is always only pressed but never released.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Just for completeness sakes, you don't have to script this if you just want to assign it to a button.

In this example: Select "ROTOR_BRAKE" as the key down event, then dial in 45501 into the little numerical box to the right of the selector (that box contains the value that is sent with this event). Or doubleclick the numerical box and type 45501.
If you want to be thorough, do the same with key up, and set a value of 45504 there.


LORBY-SI

Share this post


Link to post
Share on other sites

And one last thing: be mindful that the LVar is the animation variable. It tells you that the lever in the VC is moving/has been moved - it does NOT tell you that the gear is up.

Edited by Lorby_SI

LORBY-SI

Share this post


Link to post
Share on other sites

Ah, OK. I'll play around with those. Basically what I'm after is up, pause (10 seconds) then down (and vice-versa for gear up). Generically gear up should be starting from gear down, so from position (down) move to position (up). going down should start from off. 

Fun and games!

Thanks for the pointers,

Edited by Peter Clark

Share this post


Link to post
Share on other sites

Here is the GEAR UP code:

1 (>K:GEAR_UP) (WAIT:10000) 45501 (>K:ROTOR_BRAKE) (WAIT:2000) 46002 (>K:ROTOR_BRAKE)


WW5130.png

| i9-10900F - 2080Ti | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck | Air Manager |

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...