Jump to content
Sign in to follow this  
n4gix

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

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Well, that's me boo'ed off the next series of the X(ML)-Factor.... Ooops... :( Many thanks, Tom.-Dai

Share this post


Link to post
Share on other sites

>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

Share this post


Link to post
Share on other sites

>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

Share this post


Link to post
Share on other sites

Like Bill said... you can't.I believe the only method of refueling is available via a SimConnect interface within FSX.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

. 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Many thanks to all who replied. Now, please excuse me while I go and sulk in the 'You Can't Do That' corner... :( :)-Dai

Share this post


Link to post
Share on other sites

>. 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

> KEY_REQUEST_FUEL is used to require a fuel truckAh! That useful piece of information is not in the help files anywhere, hence my confusion.> KEY_ADD_FUEL_QUANTITY Oh-oh, how did I miss that? :-eek-Dai

Share this post


Link to post
Share on other sites

>> 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

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...