n4gix
Resource contributor
- Messages
- 11,674
- Country

I'm trying to script a remote control keypad/panel for a G1000.
All of the edge buttons and most of the knobs on the MFD have been moved to the remote control unit, so I need an (easy?) way to accomplish my goal.
Unfortunately, because of the absolute horror of all the inter-dependent @macros it is becoming a bit of a nightmare.
I was doing fine until I got the the ENT button. In the remote unit's <Mouse> section, I have the following script:
As you can see, left clicking on the button sets (L:RmtENT,enum) = 2 and releasing the button (either release/leave) will set (L:RmtENT,enum) = 1.
In the G1000_MFD, I'm capturing the remote buttons in the <Update> section:
All this does is replicate the original <Click> section. When (L:RmtENT,enum) is 2, the @ENTButton macro is loaded. When (L:RmtENT,enum) is 1 (button released), (L:RmtENT,enum) is set to 0 to prevent the script from firing again.
So far, so good. The problem comes when I try to place the @ENTButton macro with the rest of the @macros at the top (above the <Update> section. Apparently there are some calculations that are dependent on having had the <Update> section run first, as the gauge will instantly CRASH...
If I move the @ENTButton macro below the <Update> section the gauge will load and run without crashing, but the script will not execute properly...
Does anyone know of a "easier" way to do this?
All of the edge buttons and most of the knobs on the MFD have been moved to the remote control unit, so I need an (easy?) way to accomplish my goal.
Unfortunately, because of the absolute horror of all the inter-dependent @macros it is becoming a bit of a nightmare.
I was doing fine until I got the the ENT button. In the remote unit's <Mouse> section, I have the following script:
Code:
<!-- =========================== ENTER Button ========================================= -->
<Area Name="ENT Button" Left="170" Top="106" Width="34" Height="25">
<Click Kind="LeftSingle+Leave">
(M:Event) 'LeftSingle' scmp 0 == if{ 2 (>L:RmtENT,enum) }
(M:Event) 'Leave' scmp 0 == if{ 1 (>L:RmtENT,enum) }
</Click>
<Cursor Type="Hand"/>
<Tooltip>GPS_ENTER_BUTTON</Tooltip>
</Area>
In the G1000_MFD, I'm capturing the remote buttons in the <Update> section:
Code:
(L:RmtENT,enum) 2 == (@g:entButtonDown) 0 == and if{ 1 (>@g:entButtonDown) @ENTButton }
(L:RmtENT,enum) 1 == (@g:entButtonDown) 1 == and if{ 0 (>@g:entButtonDown) 0 (>L:RmtENT,enum) }
So far, so good. The problem comes when I try to place the @ENTButton macro with the rest of the @macros at the top (above the <Update> section. Apparently there are some calculations that are dependent on having had the <Update> section run first, as the gauge will instantly CRASH...
If I move the @ENTButton macro below the <Update> section the gauge will load and run without crashing, but the script will not execute properly...
Does anyone know of a "easier" way to do this?


