Jump to content
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

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.


Ed Wilson

Mindstar Aviation
My Playland - I69

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


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

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


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

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


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