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

FSX XMLVARS.dll array problem

Messages
371
Country
france
Hi,

I use the fantastic XMLVARS.dll from Tom Aguilo.

I have understand how works simple Vars.

But I don't undestand the chapter to create Vars array

All the sample use macro, and I have some difficulties to understand the synthax of the macros.


When I use simple XMLVars, all works fine, I have understood the function

Code:
'VarRegionArrival' (>C:XMLVARS:SearchVarName,string)
0 (>C:fs9gps:NearestVORCurrentLine)
(C:fs9gps:NearestVORCurrentICAO,string) 1 2 ssub (>C:XMLVARS:StringValue,string)

Works perfectly.

But I want create XMLVars array with one dimension, to read a index file of SID , with the loggerx module of Rob McElrath.


Sample of my file that is in CSV format :
Code:
78
02,EAST,DIKOL
02,EAST,RANUX
02,EAST,BUBLI
02,SOUTH,DORDI
02,SOUTH,PILUL
02,SOUTH,OKASI
02,SOUTH,LATRA
02,SOUTH,ERIXU
02,SOUTH,AGOPA
02,WEST,LGL
02,WEST,EVX
02,NORTH,OPALE
02,NORTH,ATREX
02,NORTH,NURMO
06,EAST,DIKOL
06,EAST,RANUX
06,EAST,BUBLI
06,SOUTH,PILUL
....
....
the first number is the number of records.


I want to read and store in 3 XMLVars array these datas.

I write this code :
Code:
(G:Var1) 0 == if{
	'Project Airbus\\' (C:fs9gps:FlightPlanDepartureAirportIdent,string) scat '\\' scat 'SID.idx' scat (>C:LOGGER:openRead) 
	(C:LOGGER:Number) (>L:SIDnumber,enum)
	1 sp0
	:100
		'IndexSIDRunway:',l0 (>C:XMLVARS:SearchVarName,string)
		(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
		'IndexSIDDirection:',l0 (>C:XMLVARS:SearchVarName,string)
		(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
		'IndexSIDName:',l0 (>C:XMLVARS:SearchVarName,string)
		(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
		l0 ++ d sp0
	l0 (L:SIDnumber,enum) < if{ g100 }
	(C:LOGGER:EOF) 1 == if{ 1 (>G:Var1) }
	1 (>C:LOGGER:CloseRead)
	}

But it doesn't work.

The first value is read (78) because store in a L:Vars,

But I think that my synthax for the XmlVars array is not correct.

Can you tell me how to have a XMLvars array ?
 
Last edited:
Hi,

Instead of

'IndexSIDRunway:',l0 (>C:XMLVARS:SearchVarName,string)

write

'IndexSIDRunway:' l0 scat (>C:XMLVARS:SearchVarName,string)

And the same for the rest of the code. Your vars should be initialized as

IndexSIDRunway:1
IndexSIDRunway:2
IndexSIDRunway:3


etc.

Hope this helps

PS: In the dll documentation you will find a bunch of macros for handling array var structures which should make this stuff a lot easier.
 
What I can be stupid sometimes ! I am ashamed

I'm not comfortable with macros. I have difficulties understanding the operation of them. I am old


Thank you very much Tom.

Best regards

François
 
François, "@macros" in XML are nothing more complicated than literal replacement of some text.

Code:
  <Macro Name="ADF">
    10000 * s0 10 %
    s2 l0 10 / flr 10 % 16 * l2 +
    s2 l0 100 / flr 10 % 256 * l2 +
    s2 l0 1000 / flr 10 % 4096 * l2 +
    s2 l0 10000 / flr 10 % 65536 * l2 +
    s2 l0 100000 / flr 10 % 1048576 * l2 +
    s2 l0 1000000 / flr 10 % 16777216 * l2 +
    s2 l0 10000000 / flr 10 % 268435456 * l2 +
    s2
  </Macro>

    <!-- SET ADF FREQ -->
    281.0 @ADF (>K:ADF_COMPLETE_SET)

The above example is precisely the same as this one without the use of a @macro:
Code:
    <!-- SET ADF FREQ -->
    281.0 10000 * s0 10 % s2 l0 10 / flr 10 % 16 * l2 + s2 l0 100 / flr 10 % 56 * l2 + s2 l0 1000 / flr 10 % 4096 * l2 + s2 l0 10000 / flr 10 % 65536 * l2 +  s2 l0 100000 / flr 10 % 1048576 * l2 + s2 l0 1000000 / flr 10 % 16777216 * l2 + s2 l0 10000000 / flr 10 % 268435456 * l2 + s2 (>K:ADF_COMPLETE_SET)

Now honestly aside from the @macro example being easier to read, there is no particular reason for using the @macro unless one needs to "set" an ADF frequency more than once!

A much more useful @macro is the @ExtDigit example in the Wiki here. As you can see from the following, I've made good use of it for "extracting digits" for various "number drum" type displays!

Code:
  <Macro Name="ExtDigit">
    @1 sp0
    @3 0 >
    if{ l0 10 @3 pow * sp0 }
    l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int
  </Macro>

  <Update Hidden="Yes">
    <!-- TAT CALCULATIONS -->
    @ExtDigit((A:TOTAL AIR TEMPERATURE, celsius),2,0) (>L:TAT_10s,enum)
    @ExtDigit((A:TOTAL AIR TEMPERATURE, celsius),1,0) (>L:TAT_1s,enum)
    @ExtDigit((A:TOTAL AIR TEMPERATURE, celsius),2,2) (>L:TAT_10ths,enum)

    <!-- EPR BUG CALCULATIONS -->
    @ExtDigit((L:EPR_Bug_Left,enum),1,0) (>L:EPR_Bug_Left_100ths,enum)
    @ExtDigit((L:EPR_Bug_Left,enum),2,0) (>L:EPR_Bug_Left_10ths,enum)
    @ExtDigit((L:EPR_Bug_Left,enum),3,0) (>L:EPR_Bug_Left_1s,enum)

    @ExtDigit((L:EPR_Bug_Right,enum),1,0) (>L:EPR_Bug_Right_100ths,enum)
    @ExtDigit((L:EPR_Bug_Right,enum),2,0) (>L:EPR_Bug_Right_10ths,enum)
    @ExtDigit((L:EPR_Bug_Right,enum),3,0) (>L:EPR_Bug_Right_1s,enum)

  </Update>
 
I don't know why, but I not understand macros; For me, there are "un-readable".....


But thnaks to you, the problem is solved, and now, my SID index file is read by my gauge :

The 78 SIds of PARIS -Orly LFPO :
960855LFPOSID.jpg



I have justy follow your instructions :

Code:
(L:SID,bool) 1 == if{
	(G:Var1) 0 == if{
		'FD_FMC\\' (C:fs9gps:FlightPlanDepartureAirportIdent,string) scat '\\' scat 'SID_index.csv' scat (>C:LOGGER:openCSVRead) 
		(C:LOGGER:Number) (>L:SIDnumber,enum)
		1 sp0
		:100
			'IndexSIDRunway:' l0 scat (>C:XMLVARS:StoreVarName,string)
			(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
			'IndexSIDDirection:' l0 scat (>C:XMLVARS:StoreVarName,string)
			(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
			'IndexSIDName:' l0 scat (>C:XMLVARS:StoreVarName,string)
			(C:LOGGER:string) (>C:XMLVARS:StringValue,string)
			l0 ++ d sp0
		l0 (L:SIDnumber,enum) &lt;= if{ g100 }
		(C:LOGGER:EOF) 1 == if{ 1 (>G:Var1) }
		1 (>C:LOGGER:CloseRead)
		(L:SIDnumber,enum) 35 &lt;= if{ 1 (>L:Colonnes,enum) }
		36 70 (L:SIDnumber,enum) rng if{ 2 (>L:Colonnes,enum) }
		71 105 (L:SIDnumber,enum) rng if{ 3 (>L:Colonnes,enum) }
		}
	}

All works fine

Thank you

I can now build my free SID/STAR database for my FMC, with , I hope , the help of some people.
 
I don't know why, but I not understand macros; For me, there are "un-readable".....

Very nicely done sir! Kudos... :wizard:

I must conclude then that my examples were too complicated and have hidden the actual simplicity. Here is a simpler example:


Suppose that I need to use this calculation many times in some gauge:
Code:
(A:Autopilot altitude lock var, feet) (A:Indicated altitude, feet) - abs
Now I could simply copy/paste this mathematical expression as often as needed, but I don't need to! Instead, I will create a @Macro to substitute for all that typing...
Code:
<Macro Name="AltDiffAbs">
     (A:Autopilot altitude lock var, feet) (A:Indicated altitude, feet) - abs
</Macro>
Now, instead of typing out that long mathematical expression many times, I can simply type @AltDiffAbs instead!
 
Hi N4gix,

Your explanation is clear.

So, in this case, I understand that macro allows to write less lines of code and the file must be smaller. Maybe some memory space is win so....

But, is the code executed faster when you use macro ?

DO you think that is a better way to use macros ?
 
Last edited:
Yes, no, maybe... :wizard:

Mostly @Macros are a convenience for the person writing the XML script. When expanded and parsed by the sim's engine, the XML script is converted into executable C code, so it really is irrelevant whether one uses @Macros or not...

I just wanted to make it clear that @Macros are nothing more complicated than serving as a 'marker' for a bunch of literal text. As such, the 'marker' is replaced by that literal text when the gauge is run!

Too many times, beginning XML 'scripters' assume that @Macros are equivalent to C code "callback functions," which they most certainly are not!
 
Thanks n4gix,

now, my SID managment gauge works perfectly

I select the SID "SAU 9P" to a departure from the runway 23 to the east
49073041a.jpg



By press the ADD_SID button, the SID is automatically added to the flight plan:
17834087b.jpg


THR RED altitude, Acceleration altitude, initial clearance altitude, Speed and Alt constraint (if exists) are automatically injected in the FMS.


I have offer the FSdeveloper comunity to create a project ot create a world databaseof SID/STAR in the project recruting section, but no responses.

yet I give my xml files, that read SID /STAr data files and inject automatically the datas in FS GPS and also the xml file that I have wrote which allow to save edited flight plan in .pln format.
All these files can be incuded in any panel.

My project is a bullshit ?
 
Oh no, I think your project is a brilliant idea! Most likely though is that everyone else (or at least those here who've been following your progress) are already buried nose deep in their own work...

However, if you have a way to open/read a standard Microsoft Access Database file, I have an fsd.mdb file that contains all of the FS9/FSX navdata, which is in identical format to the Navigraph database files.

Alternatively, I have the same data available as separate .dbf files.

If either or both are of interest to you, send me a PM with an email address and I'll send you a link to download the file(s).
 
My project is a bullshit ?

No, absolute NOT!!
GREAT WORK!

But writing all SID/STARS in textfiles is a little bit boring and time consuming.

But with the offer from Bill this would be the first freeware FMC with SID/STARS!

GREAT WORK at all!!
 
Many thanks bill for your proposition.

But my project is totally based on the FS GPS and I know only the xml (no other programing language).

The FS database is near to the reality (i should must create only 3 waypoints for the 2 airports SID that I have made to test).

I use the .CSV file format and I had some perf information in the file.

If you want test the aircraft, with the SID function that works for to airports (LFBD and LFBO), you can download it here :
Complete Pack A320 CFM IAE with panel 0.44 and SID working
This is a complete pack (171 Mo) .


To open the gauge, Shift+7, and the SID function is on the F-PLN page.

There is a temporary manual that is not completed. The aircraft is not completed, but all the FCU airbus mode works (managed/selected) and the takeoff/climb and cruise managed are completed;

For the descent, only a basic managed function is completed. I must define the STAR and approach file before continue my code.
 
Many thanks bill for your proposition.

But my project is totally based on the FS GPS and I know only the xml (no other programing language.

You missed my point. The database I have is the actual, complete FS9/FSX database! Every airport, airway, navaid, STAR, etc. is in there.

Converting the separate .dbf files into CSV format should be very easy, and only needs to be done once. ;)

http://download.cnet.com/DBF-to-CSV/3000-2065_4-10405766.html
 
Back
Top