![]() |
|
|||||||
| Register | Wiki | Downloads | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
| Gauges Use this forum for all your gauges related discussions |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
C/C++ Gauges: Accessing FS variables
Hi everybody,
first post for me here. Thanks to Nick and Arno for setting this up. I hope it's going to be successful So here's my question. Not really a question. More a request for opinions. With FSX, we have three different ways to access FS variables: - MODULE_VAR / lookup_var() - XML / execute_calculator_code() - SimConnect Which one of those do you actually prefer (for gauge use!) and why? I used the old module_var/lookup_var stuff in FS2004 but I thought it's time to consider the other ways too. Does anyone have any profiling information for the different methods? Thanks a lot. Best regards, Hans Hartmann Digital Aviation / Flight1 |
|
#2
|
|||
|
|||
|
Hans, with each new gauge I have found myself using the execute_calculator_code(); method more and more often, particularly for those variables which are returned in truly horrible pseudo-variables, which then require a large hunk of conversion code...
When you can ask for a return in MHz directly, it just makes no sense to perform the typical bcd-to-decimal conversion kung-fu. Asking for a return in percent is easier and faster than having to rescale a return from 0 to 16384, etc. Perhaps it's just me, but personally ACES should have named the command something more descriptive, such as get_xml_var (which I actually have implemented by modifying my local fs9gauges.h file... As for the use of SimConnect within a gauge, that simply doesn't make any sense at all to me, since it would be unnecessarily complex and quite possibly suffer from latency issues.
|
|
#3
|
||||
|
||||
|
Quote:
The default name is appropriate - you are not limited to just A:Vars. You can use any valid xml expression that returns a number (or string, I suppose...) Doug |
|
#4
|
|||
|
|||
|
Quote:
The prototype allows one to fetch float, integer or string variables, but they are all A:vars AFAIK... Aside from a handful of E:var types and P:var types, all of 'em are A:var types. Regardless though, they are all XML variables... ![]() Unless execute_calculator_code() would allow one to send an XML event to the sim, get_xml_variable() seems more intuitive... Last edited by n4gix; 30 Sep 2006 at 11:28. |
|
#5
|
||||
|
||||
|
execute_calculator_code( "(A:SIM ON GROUND, bool) if{(L:Some LVAR, number)} els{(L:Some Other LVAR, number)}", &answer, NULL, NULL);
A trivial example perhaps, but, assuming my syntax is correct, this will work. Doug |
|
#6
|
|||
|
|||
|
Quote:
OK, Doug. Point taken. I do in fact "fetch" custom XML L:vars using the same technique... I know I'm being pedantic, but L:vars are still simply "XML variables" albeit custom created... As I recall though from my conversation with Susan (and others) while in Redmond last year is that this part of the gauges.h was created for their benefit in programming the gps.dll and a few other fiddly-bits, and they never actually foresaw anyone else using 'em themselves in their C gauges... ![]() In any event, what is needed is a send_calculator_code (or send_xml_event) to really make it 'complete.' It would be extremely handy to be able to control some events that've been left out of gauges.h file...
Last edited by n4gix; 01 Oct 2006 at 12:33. |
|
#7
|
||||
|
||||
|
Quote:
execute_calculator_code("(>K:SOUND_TOGGLE)", NULL, &return_value, NULL); The return value is zero. It would presumably be non-zero if the event somehow failed when called. Doug |
|
#8
|
|||
|
|||
|
Quote:
I simply haven't had the time to test this at all myself, being overly busy upgrading models and gauges of all Eaglesoft products I have had a hand in for FSX release. The only remaining question is how one would pass a value for a _SET event... Last edited by n4gix; 02 Oct 2006 at 12:26. |
|
#9
|
||||
|
||||
|
You've been upgrading gauges, N4GIX? Here's a question:
How easy (or difficult) is it to upgrade FS98-style gauges to XML? I made a bunch of custom gauges for a chopper I made by replacing the graphics in the FS9 default Bell 206B. I was originally going to release the project as an FS9 addon, but at this point it seems like a better idea to upgrade the gauges to XML and continue developing in FSX when it's available. So I'm hoping that upgrading the gauges won't be a nightmare. ________ Buy new condo in Pattaya Last edited by Mick; 19 Sep 2011 at 05:07. |
|
#10
|
|||
|
|||
|
Quote:
OTOH, if you can legally strip the bitmaps out of an FS98 style gauge, recreating it in XML shouldn't be that difficult. Nearly every gauge you would "convert" already has a working XML prototype in FSX, so copying the code and replacing the bitmaps with your own would only leave making the necessary edits to sizes, centers of rotation, and non-linearity tables. Frankly though, the new "XML Gauge Program" that will come with the Deluxe version should make creating XML gauges from your own bitmaps a much faster process...
|
|
#12
|
|||
|
|||
|
Quote:
Can you retrieve a value from an XML variable from inside a C++ gauge? How can I do that? Thanks Jose |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Variables available in FS | arno | General | 25 | 09 Aug 2012 15:00 |
| variables buffer overflow | AlanMzk | SCASM & ASM tweaking | 6 | 20 Jun 2005 14:40 |
| About FS variables | Ranger | SCASM & ASM tweaking | 8 | 14 May 2005 03:27 |
| lighted gauges in VC | mcq | General | 4 | 08 Apr 2005 08:31 |
| Using variables in dynamic scenery | Gorchi | General | 16 | 27 Sep 2004 18:12 |