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.

Just to make sure I'm not quite as thick as I think I am...

Featured Replies

  • Commercial Member

Still on fuel systems: I've read Bill's XML<=>C stuff and I think this is correct:execute_calculator_code("(>K:FUEL TANK LEFT TIP QUANTITY)", NULL, &fuel, NULL);where fuel is a SINT32 in gallons. I'd be grateful for a yea/nay from the front row....-Dai

Dai, you got a nay...:-)Any of the three pointers are used to *retrieve* a value from the function. You pass the stringz argument, and the function fills the three pointers. Then you read the data that is pointed in your own function, using the one is most suitable for your purposes.Actually what execute_calculator_code does is to parse the stringz code (first parameter) using the XML parser and return the stack's resulting value, mostly like a or in an XML gauge.In your example, "(>K:FUEL TANK LEFT TIP QUANTITY)" returns an empty stack (0), then what you get in &fuel after calling the function is 0.So, you need to construct an assignment inside the stringz parameter, like thischar cChar[60];sprintf( cChar,"%d%s", fuel, " (>K:FUEL TANK LEFT TIP QUANTITY)");PCSTRINGZ szParam;szParam=cChar;execute_calculator_code(szParam, NULL, NULL, NULL);you don't need to read any of the three data pointers because you already know they would be 0.Tom

  • Commercial Member

>Still on fuel systems: I've read Bill's XML<=>C stuff and I>think this is correct:>>execute_calculator_code("(>K:FUEL TANK LEFT TIP QUANTITY)",>NULL, &fuel, NULL);>>where fuel is a SINT32 in gallons. I'd be grateful for a>yea/nay from the front row....>>-DaiOk, if you're wanting to read that value... it's not a "K" value.FLOAT64 fuel = 0;execute_calculator_code("(A:FUEL TANK LEFT TIP QUANTITY,gallons)",&fuel,NULL,NULL);

Ed Wilson

Mindstar Aviation
My Playland - I69

  • Author
  • Moderator

>Hi Ed>>No: I want to write to it as part of the refueling procedure.>>-Dai(A:FUEL TANK LEFT TIP QUANTITY,gallons) is "settable" in FSX, but only via SimConnect!You cannot "set" A:vars by any XML method... ...A:vars are "read only" by any other method :(Only true Key_Events may be 'set' via the execute_calculator_code method. IOW, only those tags listed in the Event IDs.htm of the FSX SDK, or the similar document for FS9 SDK.The prototype for such a command is:execute_calculator_code("value (>K:event)", NULL, NULL, NULL);However, I can't honestly think of any good reason to resort to this method, unless it's for something that's not already got a C type key_event equivalent! ;)Where it DOES come in handy is if you have need to set a "custom L:var" via a C gauge!execute_calculator_code("value (>L:MyCustomVar,unit)", NULL, NULL, NULL);

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Commercial Member

. I'm not prepared to write a SimConnect interface just for that... I guess KEY_REQUEST_FUEL simply fills things to the brim? I really wanted to be able to control what goes into which tank. So I'm being really thick... which bit of this have I thoroughly misinterpreted and why? From the FSX CHM file:Simulation Variable Description Units SettableFUEL TANK CENTER LEVEL Percent of maximum Y capacity Percent Over 100 Does 'Settable' refer *only* to SimConnect?-Dai

Yes, A: type variables are only settable via SimConnect. However, it's possible to assing values to events that perform actions which in term actualize the variables, meaning an indirect mode of obtaining the same result.My explanation was to show you the proper way to assign values to events using execute_calculator_code. Obviously I didn't pay attention to the actual name of the event you were using :-(But my code still remains as a clear example on how to concatenate values and strings to construct the strzero parameter.Tom

  • Author
  • Moderator

>. I'm not prepared to write a SimConnect interface just>for that... I guess KEY_REQUEST_FUEL simply fills things to>the brim? I really wanted to be able to control what goes into>which tank.You shouldn't need to. AFAIK, there's no real reason you shouldn't be able to invoke SimConnect stuff directly from your C gauge...However, from what I've read, even via SimConnect it is locked to 25% "fillrate" at each instance the function is invoked. At least, I seem to remember reading someone's comments about this about a year ago now... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Commercial Member

Hi Bill>You shouldn't need to. AFAIK, there's no real reason you>shouldn't be able to invoke SimConnect stuff directly from>your C gauge...Now there's a thought... I am right; sometimes I am stupid :)>However, from what I've read, even via SimConnect it is>locked to 25% "fillrate" at each instance the>function is invoked.I confess I lost the thread of this one. Do you mean that KEY_REQUEST_FUEL only gives 25% of the total aircraft volume at each invocation?-Dai

Dai, KEY_REQUEST_FUEL is used to require a fuel truck; to fill the tanks there is another event KEY_ADD_FUEL_QUANTITY (these names are the C version, to use them in execute_calculator code you must write their XML version)This event supports a passed value of 0 (no fuel) to 65535 (max fuel); if invoked with no passing value adds a 25% of fuel by default. The major drawback is you can't control which tanks are going to be filled, as the event applies to all of them in once. And like Bill's stated, you can use SimConnect from within your own dll; though it's a bit of tricky to handle the asyncronious flow of data.Tom

  • Author
  • Moderator

>> KEY_ADD_FUEL_QUANTITY >>Oh-oh, how did I miss that? :-eekMaybe because the $&*(!@'s at ACES put that new key_event under the "Aircraft Miscellaneous Systems" section instead of the "Aircraft Fuel System" heading? ;)Also, since you're coding in C anyway, and there is a C KEY_ event, it would be rather silly to bother with the execute_calculator_code method in this instance...To be perfectly honest, I had completely forgotten about that new KEY_ event myself... It's hard getting old... :~P

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.