Sign in to follow this  
Guest flying_eddie

A tiny tutorial from one line of code

Recommended Posts

Hello folks,my head is starting to burst, since I try to learn more and more about XML. I understand the samples from Arne's Manual, but if it comes to Variables I get really lost.So maybe there is someone out there who can explain one line of code the way Arne did in his manual. How about this line: (A:Trailing edge flaps0 left percent,percent) d (G:Var1) - r (>G:Var1) 0 != 4 * (G:Var2) max -- 0 max d (>G:Var2) 0 != It's a line of the flaps gauge from the Baron. It would be great to see how the details work in this line and what exactly happens to the stack.I'm looking forward to learn more and more every day.Greetings and thanks for listening.Gerhard

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Gerhard,Firstly, you should know of course what each operation does.Like: d = duplicate stackentryr = swap last stackentry.Secondly (I may sound dumm, but it isn't), the simplest way of understanding this type of stackprocessing is to use a stack of paper sheets (on which you write the result of each stackentry after each operatation, with the topsheet being the "current" stack entry)(A:Trailing edge flaps0 left percent,percent) d (G:Var1) - r (>G:Var1) 0 != 4 * (G:Var2) max -- 0 max d (>G:Var2) 0 != In your example:- After (A:Trailing edge flaps0 left percent,percent)Stack+1: Flaps percentage- After dStack+2: Flaps percentageStack+1: Flaps percentage- After (G:Var1)Stack+3: Contents of Var1Stack+2: Flaps percentageStack+1: Flaps percentage- After - Stack+2: (Flaps percentage - Var1)Stack+1: Flaps percentage- AFter rStack+2: Flaps percentageStack+1: (Flaps percentage - Var1)- After (>G:Var1)Stack+1: (Flaps percentage - Var1)Var1-new = (Flaps percentage - Var1-old)etc etc ..Cheers, Rob

Share this post


Link to post
Share on other sites

Hi Rob,thank you for your answer.What the operators are doing is very well described in Arnes manual. My point this time is the G:VarX kind of stuff. From where comes the value for a variable in the very beginning. Also the difference between (G:Var1) and (>G:Var1).Right before I was looking at the files from the Baron and 747 again. I guess there are variables used for "fake" gauges, I mean there was no real input.I think there is very much to learn and I need patience. Just a week ago I had really no clue when I was reading xml gauge files. Now there are popping up ideas in my mind what it could be. The problem is really to write or generate the code from scratch.But therefore I love your training with the paper stack. You are definitely right, it's simple to do.My real headaches are the if..else stuff and the differences of the syntax in lines or . It's really hard to figure.Thanx and cheersGerhard

Share this post


Link to post
Share on other sites

Hi Rob,I don't wanna bother, but I found a good short code and of course have some questions.- - - (G:Var1) if{ (A:Circuit general panel on, bool) (A:Eng4 N2 RPM, percent) 50 < && if{ 0 (>K:TOGGLE_STARTER4) } els{ (G:Var1) -- (>G:Var1) } } (G:Var1) 0 != (A:General eng4 starter, bool) || - - - - 5 (>G:Var1)As far as I understand gives the click the value 5 to Var1. If I start now with the line, I assume I need to put 5 on the stack. So far so good I hope. Next is "if". Do I still need to put things on the same stack or means "if" to build a new stack? It's getting even worse. There is another "if" within the first "if". How to deal with that? Another stack maybe??? And then there is only one "else" even there are two "if". Close to the end is a "=" after the operator "!". Since equal is "==" I have no idea what it means. Hmmm. Enigma and brainbug...I think the stack thing is kinda logical if you use the paperstack to imagine. To know how things are related and what they exactly mean is a bit more difficult I think. I would be very happy to get a little help with this things.GreetingsGerhard

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