Jump to content
Sign in to follow this  
Guest Vorlin

Understanding element and select

Recommended Posts

Guest depot_haldol

First of all, Rob, Scott, Doug, Bill, and others--you guys are great. I'm really appreciating what a good resource this forum is. By searching the web countless times I've become convinced that this forum here represents the biggest collection of MSFS xml knowledge in any one place.My question of the day: In formal language, what do the and tags mean? I'm not sure when they have to be used and when they don't and the tutorials I've found are a little vague. One time I solved a problem by throwing around a block of code, but I'm not sure why I did it. It worked, but I felt like an idiot.---Will (learning rapidly)

Share this post


Link to post
Share on other sites

The tags are used in conjunction with the tags to either display a conditional bitmap, or as a container for processing.For bitmap display:(A:LIGHT STROBE,bool)Note that the construct can only be used for the display of images, but there are other ways to use case as below...For code execution: (L:SIMPLE, enum) ++ (>L:SIMPLE, enum) (A:LIGHT LAND, bool) ! if{ (>K:TOGGLE LANDING LIGHTS) } 32 16 8 4 2 1 6 (L:SIMPLE, enum) case (>L:EXAMPLE, enum) Code within tags will be run through once per gauge cycle unless it contains a loop in which case the loop will be itterated over before execution of the rest of the gauge resumes (I believe)Instead of using , one can use , however there can be only one section per gauge.--Jon

Share this post


Link to post
Share on other sites
Guest Vorlin

Well, the short, simple version is that we use those tags because that's the way MS setup the parser. I know that doesn't help, but when I read your question I wonder if you're trying to dive into all this without understanding the basic structure of xml itself.XML is really nothing more than a very basic way to organize information... that's really all. The rules state that things are grouped and how they are grouped is represented in the way the tags are structured and organized.Let's say you want a paycheck... well, you'll need a job. But before you can have a job, you need an employer. But then again,an employer can't run a business without an income, some operating capital (money) and paying taxes.Now, think about this a second. Can you pay taxes wihtout an employee? Sure you can. Can you have an income without writing a paycheck? Absolutely... but then again, you can't have an income without paying taxes. We now have the beginnings of an xml structure:<Business><Finance&gt<Capital><Income><taxes /></Income><Profit or Loss/></Capital></Finance&gt<expenses><Operations>&ltWork Hours><Employee Name="Employee1"><paycheck /></Employee><Employee Name="Employee2"><paycheck /></Employee>&lt/Work Hours></Operations></expenses></Business>We use the tags that MS designated for flight sim... but the basic rules of XML still apply.Check around the net for info on the basics of XML. Don't bog yourself down in how it interacts with SQL or MSAccess, don't worry about DOM's too much but you can learn a lot from knowing what each line of the DTD really means.Happy learning!Scott / Vorlin

Share this post


Link to post
Share on other sites
Guest depot_haldol

So it's a rule that must be enclosed within ? That would explain the problem I mentioned in my first post.---Will

Share this post


Link to post
Share on other sites
Guest Vorlin

Yes, and that is shown in a good dtd (of which there are very few known for this... I'm working on my own).By learning how to read a dtd, you can learn the rules for what's required when, including which attributes must be used with each tag and which are optional.Scott

Share this post


Link to post
Share on other sites
Guest depot_haldol

Scott, I've found that type of information before but it's always scared me off, because the tags are so different from what I see in gauge files. And on non-FS9 sites there's always much fewer words like VISIBLE, CLICK, MOUSE, and IMAGE than are used in FS9 gauges, so I felt like I was trying to learn a whole bunch of manipulations that I would never use. But I hear what you're saying and I'm happy to go search for some introductory material.---Will

Share this post


Link to post
Share on other sites
Guest pwdodds

>So it's a rule that must be enclosed within ?> That would explain the problem I mentioned in my first post.>---WillNo it's not, actually - just to confuse even further. The following use of is also valid. (A:Com active frequency:1,Megahertz) flr I "think" that select is used when you want to operate on an element in an XML file which contains several elements. In the code above, I don't want to do anything, I just want to display something (a rotating index mark on a frequency selection knob, in fact).PeterVery much still a beginner so don't take my word as gospel.

Share this post


Link to post
Share on other sites

""I "think" that select is used when you want tooperate on an element in an XML file which contains severalelements.""Actually is originally intended to be used with and , just to display bitmap(s), the same as is intended to produce a rotation of the element, to shift it and so on.All these structures make use of the stack's space existent between and . What does is extract the last stack's value and make it available for the parent structure (,,etc) to produce the effect desired (a bitmap shown, a rotation, a shift, etc). If the stack is empty ( for example) a zero is passed.However, there might be situations where the stack carries over a value left in a preceding element, and this is what will be passed if the stack's space of the current element is empty. Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

Tom's the man when you want to know exactly what's really going on... but I think the original poster is going to need some fundamental understanding of the tag structure first (grin)A value tag needs to be in something... be it select, rotate, shift, etc. As Tom said, it's purpose is to calculate a value and then pass it on to it's parent tag so that the parent tag can use it in some way.element - select - value - case1 - case2 - case3 .... calculates a value to be used in the selection of cases.rotate - value ... calculates a value to rotate by.shift - value ... I'll give you three guesses...In a dtd, you will see where a tag could be used in several circumstances. When and how will depend on many factors.When you have these basics down, start searching for some of Tom's explainations of what is really happening in the stack and you'll begin to understand why RPN is actually a good way to code this stuff... jsut keep a fire extingusher handy because the first 2 or 3 times you really get into the great things Tom is able to explain, your brain may begin to smoke or even catch fire!Scott / Vorlin

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