• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Urgent request for Help

Messages
29
Hello!
Im working since months on a Gauge for a Radar Warning System for my Project with real Symbols and Sounds. The Source-Code is a new, advanced Form of Arne Bartels Traffic dll and to 99.9% finished.
The only thing to do in the dll is sending 2 or 3 things to a L:Var wich are allready in the Source Code, so no big deal if someone understands C++.

I would be very thankful if someon could help. Basically it should take only 10 or 15 minutes to do this.

Best Regards
 
I copied this straight from the comments in my code. It's terse but accurate.
Questions, just ask. This is easy to do.

Code:
*** XML interface notes ***

--> To Read an XML var:
ID MyID = check_named_variable("MyCustomVar");
FLOAT64 val = get_named_variable_value(MyID);

--> To Write an XML var:
ID MyID = check_named_variable("MyCustomVar");
set_named_variable_value(MyID,NewVal);
NewVal is a FLOAT64.

*** IMPORTANT *** the XML variable above MUST ALREADY HAVE BEEN CREATED
or the set using the above code will fail.  Here's how to create an
XML var with a zero value from C:

execute_calculator_code("0 (>L:MyCustomVar,number)",NULL,NULL,NULL);

--> You can use also the units with:
int unit_enum=get_units_enum("number");
ID MyID = check_named_variable("MyCustomVar");
FLOAT64 val = get_named_variable_typed_value(MyID,unit_enum);

--> This is the use of execute_calculator_code:

execute_calculator_code("(A:ADF ACTIVE FREQUENCY:1, KHz)",&adf1_freq,NULL,NULL);
execute_calculator_code("(A:ADF ACTIVE FREQUENCY:2, KHz)",&adf2_freq,NULL,NULL);
We now have adf1_freq and adf2_freq as FLOAT64 variables, with no muss, no fuss since
we asked for 'em to be returned in KHz already.
The function in gauges.h uses this prototype:
BOOL (FSAPI *execute_calculator_code) (PCSTRINGZ code, FLOAT64* fvalue, SINT32* ivalue,
                                              PCSTRINGZ* svalue);
This allows us to retrieve float, integer or string values from XML variables directly.

Hope this helps,
Dutch
 
Hello!
Thanks for the Answer! I saw this allready somewhere else. The Problem is that I can not create the dll out of the Sourcecode and I'm allready too tired to learn how to use Visual Studio just for this little thing :( This would take at least 2 Months .....Aaaaahhhhh :eek:
 
Hi chmil,

If you send me the source code I can try to compile it for you, provided that it is as you say "99.9% finished" ;). I have been working with Arne's code for a few years and know it inside and out (I think).

I recommend trying to learn at least the basics of gauge creation with VS though, preferably using Dai Griffiths excellent documentation along with the SDK. It is a great experience when you finally get the hang of it.

Cheers /Tom
 
Hey Tom!
Thanks for your offering, but the thing is, it's me, Isra :D:D:D ! As you see, I had no luck around the world to get help for the thing we both know allready. :(
 
*duh* Well, that explains why it sounded so familiar. ;)

As I have already said, it's no big deal to pipe variable values between the dll and the xml gauge. As I understand it you want the following vars:

NearestAircaftCurrentDistance, NM
NearestAircaftCurrentTrueBearing, radians
NearestAircaftCurrentATC_ID, string
NearestAircaftCurrentLine, number
NearestAircaftItemsNumber, number

Is that correct?

/Tom
 
Hey Tom!
Yes thats correct! I need the Vars to add the Sounds to each Aircraft, showing up on Screen.
For the Ground everything is allready done....looks like this:

rwrscreen.jpg


Search and Unknown Radars, Unknowns has differend kind of U's with dots depending on the Ground Frequency. (5 U's I have added)
The 4 in the Circle is a detected Bloodhound Ground-Air Missile Base, from a nice Scenery I have installed.
As you know, all Symbols put out a Sound if they change the Status.

The only thing is I need the same for the Aircrafts. I have something allready working, useing the TCAS.dll, but it is too limited...!
I am sure for you it is not a big thing, for me it is, since my Wife is breaking my balls :D.
You know Tom, I'm closing my FS Design Activities pretty soon, going into VS is not the way for me :(
 
I copied this straight from the comments in my code. It's terse but accurate.
Questions, just ask. This is easy to do.

Couple of comments on your code:

- There's no need to use the execute calculator code, just to initialize the variable in C++, just use the following form:

Code:
ID myID = register_named_variable( "MyCustomVar");
set_named_variable_value( myID, 0 );

I guess the 2nd line is not strictly necessary, because the variable will be created with a 0 value anyway.


- There's no need to use the execute calculator code to read the ADF (or any other A: variable...), much easier and faster doing this way:

Code:
int khz_units = get_units_enum("khz");

double adf1 = aircraft_varget( 482, khz_units, 0 )
double adf2 = aircraft_varget( 482, khz_units, 1 )

Note the 482: it's the enum equivalent ( in FS9 ) for the A:ADF ACTIVE FREQUENCY variable. It's required to be sent in this form, because in FS9 the get_aircraft_var_enum() function call doesn't work so, you need to have some include file with a list of token, I think someone did one called XML_TOKENS.H, so you can use an easier form, like:

Code:
double adf1 = aircraft_varget( ADF_ACTIVE_FREQUENCY, khz_units, 0 )

Assuming the 482th entry in the enum is named ADF_ACTIVE_FREQUENCY...

In FSX, get_aircraft_var_enum() works so, you could write it this way:

Code:
int khz_units = get_units_enum("khz");
int adf_active_frequency = get_aircraft_var_enum( "ADF ACTIVE FREQUENCY" );

double adf1 = aircraft_varget( adf_active_frequency, khz_units, 0 )
double adf2 = aircraft_varget( adf_active_frequency, khz_units, 1 )
 
Last edited:
Back
Top