Jump to content
Sign in to follow this  
Guest

XML Coding

Recommended Posts

Guest Peewee1

Hi Gang,I have been asked to change the reading of the default Baron 58 Altimeter from inches of mercury to millibars. I have printed off the coding for the gauge but as this is a first attempt at XML I would appreciate some help. I've looked at some of the tutorials and can see what the relevent sections of code do but am just a bit unsure of what changes to make. I will backup the gauge and have a go at it until one of you more experienced types reply.I would like to become more involved in this so please reply and pushstart me.

Share this post


Link to post
Share on other sites

Hi Ken I thought that you might be leading up to this when you asked your question about the conversion formula.I am going to try to avoid reading any further responses to this posting -- so I can have a go at doing it myself -just to see if I can as a learning experience!! :)Actually, it would be quite valuable to me as , when flying online here in Australia, the controllers hand out the pressures in millibars/hectopascals . Not that it really matters with VATSIM, because all you need to do to set the altimeter is hit "B".Mind you , I'm probably about where you are right now -- I've only got the faintest of clues!! :) But at first glance , I can see a number of things in the XML file that would have to be modified and at least 2 bitmaps that need complete re-doing (thats' the hardest part in my opinion -- I'm no artist!!! Come to think of it , I am no programmer either! :)Barry

Share this post


Link to post
Share on other sites

Ken and Barry,I read your posts yesterday and pondered it.. It WOULD take alot of work making a new MB number strip (painting) and then calibration would come into play too.. I took Barry's suggestion to make a toggleable display but used a string to display MBs. The toggle to switch between the 2 is directly over the MB/HG window. It's a comprimise, but it works. Only took 40 minutes to modify. :-) The KISS principle.. :-)The complete XML is attached. With Notes showing what/where changes where made.. It should work as is even with the notes still in the XML. Regards,Roman[link:www.packers.com]GREEN BAY PACKERS][/i :-ukliam :-beerchug


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Guest Peewee1

Hi Barry,Thanks for the reply. I found a conversions page in a UK VFR Flight Guide I had, so I have the info I need. I have tried changing the values and text where it applies in the coding. The A/c loaded ok but the values were then stuck at 28.1. The pointers moved round the dial when I rotated the setting knob but the pressure setting stayed put. Still, that was a first attempt and I see that Roman has been working on it also.Like yourself, I would like to develop my gauge skills. Some of the work done by others is real good.Keep in touch if you like and we can develop these things as we go.

Share this post


Link to post
Share on other sites
Guest Peewee1

Hello Roman,Many thanks for your reply and for taking the time to do the coding. I appreciate that.I will insert your new code into the file and pass it onto my friend.Another friend has mailed me with another option, so I will try that also. Like I said to Barry, I am keen to develop my XML coding knowledge. The other type of Gau. files are a closed book to me. Do you know if there is a way to convert the symbols into readable text? When I open a Gauge file, not XML, I see lots of little square boxes and strange symbols. Is that the result of compiling the programming language? Maybe there is a de-compiler somewhere.

Share this post


Link to post
Share on other sites

>Hi Barry, >>Thanks for the reply. I found a conversions page in a UK VFR >Flight Guide I had, so I have the info I need. I have tried >changing the values and text where it applies in the coding. >The A/c loaded ok but the values were then stuck at 28.1. >The pointers moved round the dial when I rotated the setting >knob but the pressure setting stayed put. Still, that was a >first attempt and I see that Roman has been working on it >also. >>Like yourself, I would like to develop my gauge skills. Some >of the work done by others is real good. >>Keep in touch if you like and we can develop these things as >we go. Yes -- the problem for me with all this is the lack of time -- the learning curve on everything I do with FS2002 is so steep and I seem to be continually learning about all sorts of things. Just recently , after finally figuring out how to fly 2 fairly complex aircraft panels, the ERJ145 and the Dash8-300, I find that I have amost completely stopped flying and am spending more time in this forum than elsewhere . But even learning the ins-and-outs of Paintshop Pro is a big one! -- just so that I can put some fine lettering on a gauge ! :)I intend firstly to have a look at what Roman did - I'm not quite sure what he is talking about at this stage because (logically to me),anything we do should/must involve re-doing the altimeter bitmaps for metric use.Barry

Share this post


Link to post
Share on other sites

>Ken and Barry, >>I read your posts yesterday and pondered it.. It WOULD take >alot of work making a new MB number strip (painting) and >then calibration would come into play too.. I took Barry's >suggestion to make a toggleable display but used a >string to display MBs. The toggle to switch between the 2 is >directly over the MB/HG window. It's a comprimise, but it >works. Only took 40 minutes to modify. :-) The KISS >principle.. :-) >>The complete XML is attached. With Notes showing what/where >changes where made.. It should work as is even with the >notes still in the XML. Roman You are one very clever fellow!!! :)Your code works beautifully!! This is what I think is the beauty of these new XML gauges -- they are open source and allow all kinds of innovation!I doubt that I will ever be able to come up with code like that because , basicaly I am no programmer . But I have been able to make small modifications to code to do small things that I want.Could you please explain for me this line . I understand what "if-else" statements are and how they control the selection of two things.(G:Var1) 1 == if{ 0 (>G:Var1) } els{ 1 (>G:Var1) }I can see that it is basically saying that if one click condition exists then do the inches gauge - or else if the other click condition exists do the other gauge . I can also see that it relates to the lines like (G:Var1) 0 == in each gauge condition But I can't really get my head around the specific syntax of this line of code. It is a LOT different to my old BASIC code that I used to use 20 years ago.Barry

Share this post


Link to post
Share on other sites
Guest

>Could you please explain for me this line . I understand >what "if-else" statements are and how they control the >selection of two things. >>(G:Var1) 1 == if{ 0 (>G:Var1) } els{ 1 >(>G:Var1) } Barry, you have to think backwards...You are used to this syntax:if (expression = condition) then (do this) else (do this instead)XML syntax is (using the same terms as above):(expression condition == if {do this} els {do this instead}

Share this post


Link to post
Share on other sites
Guest Peewee1

Thats right, same for me. A friend has also given me new code and suggested redoing the baro strip bitmap with mbars. However there are 102 mbar readings. The bitmap only shows selected readings for the inHg version, so to do a complete mbar one would involve an extremely long strip of figures. That in itself is no problem to do but I don't know if the coding will work to suit that, especially the rotate section where it says 720 degrees rotation. The mbar bitmap strip is twice as long, so does that mean 1420 degrees rotation?Maybe I am looking at it wrongly. Very possible It sounds as though you have redone the gauge with Romans code and liked it. I will try it today.

Share this post


Link to post
Share on other sites
Guest Peewee1

Hello again Bill,Thanks for your input. This stuff is quite addictive as Barry says.

Share this post


Link to post
Share on other sites

Hi Guys, Glad the coding I did worked for you. Maybe just an example how really not difficult it is. It does take time donot get me wrong. But to do XML over "C" type programming is so much more rewarding because the "dark" art of guage programming is now available to us "tinkerers" . ( Thanx MS ) "C" programming takes alot of time and effort, much more powerful, but can be very unrewarding because of errors not known unless proficient in it. As for your buddy's idea of doing a new bitmap.... Good Idea !! go for it !!! ( Still has the KISS principle ) But just a tip.. Donot worry 'bout the 720 rotation... That is just the knob... BTW MS put WAY TOO MUCH programming in it since it is hard to tell that the knob is even turning... It's all black in color anyways.... Go figure hey ????The part you need to deal with is the very 1st for the modification you want to deal with..As for changing the whole gauge to work with with MBs,,, it is NOT necessary... If you look at the statements it just increases or decreases the Kohlsman, be it MBs or HGs.. It doesn't care, either does the actual altitude as it automatically relates to the Kohlsman, MBs or HG, doesn't matter.. So the only thing you really need to worry about is the visual display of the Kohlsman as it relates to what you want to see be it MBs or HG... As for starting out with XML get a few things and read them... The panel SDK at the FS Insider site, & XMLgau01.zip ( Arne Bartels :-) ) here at the library. Use them as a reference exclusively.Also you may want to search the forum ( Panel & aircraft design ) for a keyword in the body of the message of " XML " and also click "search archives" as many of the tricks and lessons are from the very first days of FS2002. ( sept. 2001 and latter )Keep goin at it, if you need help just hollar :-) There are quite a few of us here to help you get through it. Regards,Roman[link:www.packers.com]GREEN BAY PACKERS][/i :-ukliam :-beerchug


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites

>if (expression = condition) then (do this) else (do this >instead) >>XML syntax is (using the same terms as above): >>(expression condition == if {do this} els {do this instead} Thanks Bill - well described!Now, in the case of this particular piece of coding , the {do this} bit is (>G:Var1) What does this mean ? I believe it is a kind of goto and do this kind of statement -- but once again, don't know the syntax.Barry

Share this post


Link to post
Share on other sites
Guest

>Thanks Bill - well described! >>Now, in the case of this particular piece of coding , the >{do this} bit is (>G:Var1) What does this mean ? I >believe it is a kind of goto and do this kind of statement >-- but once again, don't know the syntax. Nope... the precise {do this} consists of a value and command:(G:Var1) 1 == if{ 0 (>G:Var1) } els{ 1 (>G:Var1) }In this case, {do this} = { 0 (>G:Var1) }So, the action would be to "set GVar1 = 0"els "set GVar1 = 1"Syntactically, the > is like a "put command;" i.e., "Put the value (x) into the GlobalVariable #1"Remember, everything is backwards (actually, it's called "Reverse Polish Notation.)"In operation, this is simply a "toggle switch."If GVar1 is 1, then it is switched to 0If GVar1 is 0, then it is switched to 1Simple, yes? :)

Share this post


Link to post
Share on other sites

>>(G:Var1) 1 == if{ 0 (>G:Var1) } els{ 1 (>G:Var1) >} >>In this case, {do this} = { 0 (>G:Var1) } >>So, the action would be to "set GVar1 = 0" >els "set GVar1 = 1" >>Syntactically, the > is like a "put command;" i.e., "Put >the value (x) into the GlobalVariable #1" >>Remember, everything is backwards (actually, it's >called "Reverse Polish Notation.)" >>In operation, this is simply a "toggle switch." >If GVar1 is 1, then it is switched to 0 >If GVar1 is 0, then it is switched to 1 >>Simple, yes? :) Once again , Bill thank you for your "easy to understand" explanation .For an old fella like myself whose only exposure to programming over the last 30 years has been a 1 year course in 1971 (Computer Programming 101) using a language called ALGOL and punch cards on a mainframe and then some BASIC programming on a Commodore 64, 10 years ago -- I have a LOT of catching up to do!!!!!! :)My son is a professional computer programmer and is VERY good -- but the trouble is he doesn't speak English . Well, actually English is his native language - but whenever I ask hime to explain some programming related matter to me , he doesn't speak English to me! :)So the above line equates to If (the variable) GVar1 =1 then GVar1=0 else Gvar1=1I believe that I could probably get my head around the Reverse Polish Notation aspect of this language -- but what about the syntax itself? Where could I learn that { 0 (>G:Var1) } means "set the variable G:Var1 to 0"Thanks for any further info?PS Do you ever sleep or do anything other than FS2002 stuff?? :)Barry

Share this post


Link to post
Share on other sites
Guest Peewee1

Roman, what a guy you are! Thanks for your input.I will alter the Altimeter strip bmp just for the practise. Then I'll put it into the gauge and see what happens. I can see that the workings will be the same no matter what.Don't worry, I have the original safely backed up!! Ihave the panel SDK and Arne's tutorial. Gradually some things in them are now becoming clearer. Listen out for my hollar Cheers.

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