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.

need macro help

Featured Replies

Hi all,I've been working on adding a few things to the default 737-800 and I'm having trouble getting macros to work. I'm trying to add V speeds to the pfd and have a couple of macros do some calculations to get the speeds based on the aircraft's weight. If I get these working, then I'll add some other calculations to it too.Here's what I have:

<Macro Name="baseweight">82000</Macro>		<Macro Name="basev1">102</Macro>		<Macro Name="incrvr">(A:TOTAL WEIGHT, pounds) @baseweight - 8 / 5 * (>@g:gincrv1)</Macro>		<Update>			@basev1 (@g:gincrv1) + (>L:newv1,enum)		</Update>		<Element>			<Position X="10" Y="10"/>			<FormattedText X="38" Y="12" Font="Arial Black" FontSize="11" Adjust="Center" VerticalAdjust="Bottom" Color="0xF0D0D0" BackgroundColor="#080808" Bright="Yes">				<String>					%((L:newv1,enum))%				</String>			</FormattedText>		</Element>

I'm trying to at least display the V1 number to see if it's working, but nothing shows up. I've tried various trypes of variables, but none seem to work. I made the (L:newv1,enum) a macro to see if it worked that way, but it didn't.I was originally trying to put it in a shift statement, where it moves a text "-1" on the airspeed strip. Here's the shift statement I tried.

                        <Shift id="Shift">                        	<Scale>0.000,1.567</Scale>                        	<Expression id="Expression">                            	<Minimum>-100.000</Minimum>                            	<Maximum>100.000</Maximum>                            	<script>(A:Airspeed select indicated or true, knots) (L:newv1,enum) -</Script>                        	</Expression>                    	</Shift>

Again, I've tried using the g: macro instead of L: but nothing works. It seems like half the time the whole pfd becomes blank and the other half, the "-1" text never shows. I know the shift statement works, because at first I was just using a constant number to test it out and get the positioning correct.Thanks.David

Hi,Try, :<String>%((L:newv1,enum))%!d!</String>Jan

Jan

 

 

 

"Beatus ille qui procul negotiis..."

  • Author
Hi,Try, :<String>%((L:newv1,enum))%!d!</String>Jan
Hi Jan,That didn't work for some reason. It seems that the macros I write don't want to work at all. I did however get it to work, sort of. I got it to calculate V1 and put it on the airspeed strip with this:
<Update id="V1 Calc">  <script>102 (A:TOTAL WEIGHT, pounds) 82000 - 8000 / 5 * near + (>L:newv1,enum)</Script></Update>

And this puts it on the airspeed strip:

<Element id="V1">  <FloatPosition>0.000,0.000</FloatPosition>  <Element id="V1"> 	<FloatPosition>0.000,0.000</FloatPosition> 	<GaugeText id="GaugeText">   	<Axis>0.000,8.000</Axis>   	<BackgroundColor>Black</BackgroundColor>   	<Bright>True</Bright>   	<FontColor>Cyan</FontColor>   	<FontHeight>8</FontHeight>   	<GaugeString>-1</GaugeString>   	<HorizontalAlign>CENTER</HorizontalAlign>   	<Size>20,13</Size>   	<Transparent>True</Transparent> 	</GaugeText>   </Element>   <Shift id="Shift">  	<Scale>0.000,1.567</Scale>  	<Expression id="Expression"> 		<Minimum>-100.000</Minimum>      	<Maximum>100.000</Maximum>      	<script>(A:Airspeed select indicated or true, knots) (L:newv1,enum) -</Script> 	</Expression>  </Shift></Element>

That all works fine. But when I start to add any others, either the whole gauge goes blank, or V1 becomes 0.Whenever I put in this line, without displaying Vr on the gauge, V1 becomes 0. Any ideas why?

<Update id="SpeedVR Calc">  <script>102 (A:TOTAL WEIGHT, pounds) 82000 - 8000 / 6 * near + (>L:speedVr,enum)</Script></Update>

I can't figure out why that would cause the (L:newv1,enum) to become 0.Thanks,David

Hi,Sorry, see fsx.Only tested in fs9:<Macro Name="baseweight">82000</Macro><Macro Name="basev1">102</Macro><Update>@basev1 (A:TOTAL WEIGHT,pounds) @baseweight - 9000 / 5 * near + (>L:incrv1,number)@basev1 (L:incrv1,number) + (>L:newv1,number) @basev1 (A:TOTAL WEIGHT,pounds) @baseweight - 8000 / 6 * near + (>L:incrvR,enum) @basev1 (L:incrvR,number) + (>L:speedVr,enum) </Update><Element><Position X="10" Y="10"/><FormattedText X="100" Y="300" Font="Arial Black" FontSize="16" Adjust="Center" VerticalAdjust="Bottom" Color="0xF0D0D0" BackgroundColor="#080808" Bright="Yes"><String>V1 %((L:newv1,number))%!d!\nVR %((L:speedVr,number))%!d!\n</String></FormattedText></Element>and this works.Other way withour macros and update:<Element><Position X="10" Y="200"/><FormattedText X="100" Y="300" Font="Arial Black" FontSize="16" Adjust="Center" VerticalAdjust="Bottom" Color="0xF0D0D0" BackgroundColor="#080808" Bright="Yes"><String>%(102 (A:TOTAL WEIGHT,pounds) 82000 - 9000 / 5 * near + (>L:incrv1,number) 102 (L:incrv1,number) + (>L:newv1,number) )%((L:newv1,number))%!d!\n%(102 (A:TOTAL WEIGHT,pounds) 82000 - 8000 / 6 * near + (>L:incrvR,number) 102 (L:incrvR,number) + (>L:speedVr,number) )%((L:speedVr,number))%!d!\n</String></FormattedText></Element>Hope it helps,Jan

Jan

 

 

 

"Beatus ille qui procul negotiis..."

  • Moderator

Do keep in mind that @Macros are nothing magic. They are simply a useful shorthand technique, which provide a less verbose way of creating/editing scripts.They are nothing more than 1:1 replacements for a (possibly) very l o n g s t r i n g o f t e x t . :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author

Jan,Thanks for your help. After changing a few things in what you gave me, I finally got all of my v speeds to work correctly.Bill,They sure seem like magic, because when I used the code Jan gave me with the macros, the number came out to be 0, yet when I just used the number the macro represented, it worked.David

  • Moderator

When I used "magic" I simply meant that @Macros aren't function() calls, subroutines, or any other fancy-schmanzy coding trick...They also don't always work as expected, or at all for that matter! :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Create an account or sign in to comment

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.