Sign in to follow this  
dragonflightdesign

XML SET type variables

Recommended Posts

I'm trying to create a refueling system for my current project and thought I'd got it beaten by using the FUEL TANK XXXX variables as they are listed as settable. However, this doesn't work...execute_calculator_code("(A:FUEL TANK LEFT MAIN,Percent+requested_fuel)(>K:FUEL TANK LEFT MAIN)", NULL, &retval, NULL);where requested_fuel is also a percentage. It does absolutely nothing - it's got to be me at fault but where?-Dai

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Well... FUEL TANK LEFT MAIN isn't a keyboard event. It's just a read-only variable that returns how much fuel is in the left main tank. No more, no less.You didn't mention whether this is for FS9 or FSX... in FS9 there is exactly one event for refueling and I believe it's broken.In FSX I think SimConnect has a refuel capability... but I'm not 100% on that.

Share this post


Link to post
Share on other sites

Hi Dai,Unfortunately it is not possible to add fuel to individual tanks using XML events AFAIK. However, you can indeed add fuel in general using ADD_FUEL_QUANTITY event, from 0 to 65535 (100%) like this:int iFuel=32767; //50% to addchar cCode[60];PCSTRINGZ szCode;sprintf_s(cCode,"%d%s",iFuel," (>K:ADD_FUEL_QUANTITY)");szCode=cCode;execute_calculator_code(szCode, NULL,NULL, NULL);This could be your start point to experiment with different values.Tom

Share this post


Link to post
Share on other sites

All of the token variables listed as "settable" may only be "set" via SimConnect. This of course is necessary in order to keep any shared cockpits synchronized.Unfortunately, unless your coding for FSX, that isn't terribly helpful... :-roll

Share this post


Link to post
Share on other sites

Thanks guys - I really, really wanted to be able to set the individual tank levels.... however...Bill - are you hinting that it's possible to SimConnect to yourself i.e. if I was coding for FSX, then I could use the SimConnect effectively as a gauge within the aircraft?-Dai

Share this post


Link to post
Share on other sites

Well, yes. It's a round about way to do it, but there's no reason why you cannot write a small .dll and have SimConnect do the 'work' for you.Please note that this is entirely theory for me, as I've not tried anything like this myself... ;)

Share this post


Link to post
Share on other sites

Actually you can call SimConnect functions, which are asyncronious, within a custom DLL -not a common .gau but a .dll that instantiate Panel/Aircraft classes. There is a public function contained -Update() that executes on 18 HZ tick, so the calls can be put there. Currently I'm working on a similar stuff. You may want to see the "CabinComfort" example from FSX SDK to learn on how to program the dll.Tom

Share this post


Link to post
Share on other sites

It's worth pointing out that this is very similar to the way that you can retrieve data from the gps.dll using either XML or C code. ;)

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