Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Reading/setting PMDG rotor brake variables

Featured Replies

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.

  • Commercial Member

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

  • Commercial Member

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

  • Commercial Member

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

  • Author

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

  • 2 weeks later...

Here is the GEAR UP code:

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

WW5130.png

| i7-14700KF - 4080 SUPER | 32 GB RAM | Win 11 Pro | HC Bravo | AAO | StreamDeck | 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.