Sign in to follow this  
Guest Cacoman

My first XML for the 737-200

Recommended Posts

Ok I am working with the Hydraulic pressure switches.I have made the following based on other freeware xml gauges for the switch and it works:(L:HSA1, bool) 33685504 (>K:ADF2_COMPLETE_SET) (L:HSA1, bool) ! (>L:HSA1, bool)After analizing this script, this is what I understood:1. The value (L:HSA1, bool) is a variable I defined to work through the whole panel and it is a boolean with a value of 1 or 0.2. The is for the different values that L:HSA1 will get. So this will be the bitmaps for each case of the value of this variable.3. it triggers with >K:ADF2_COMPLETE_SET and somehow with the (L:HSA1, bool) ! (>L:HSA1, bool) it stores the value of HSA1.I really don

Share this post


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

>The thing is how I can make a relation so that if the engine1>is running but the switch is at the off position the Low PRESS>light still is ON. And if the switch is at the ON position>but the engine is not running it will remain lit. And the>only condition that the light will go out is with the engine>running and the switch at the ON position.>>(L:HSA1, bool) && (A:ENG1 HYDRAULIC>PRESSURE,psi) 2000 >The thing to remember is that when dealing with a stack-based syntax, comparative operators aren't placed between arguments, but after them:you got the 200 > part right, but the && (should be written as && or simply 'and' for 2004+) needs to be placed AFTER the two arguments you're testing:First of all, a boolean should represent an 'on' condition when its value is 1. So it's confusing to see and "on" bitmap being tied to a boolean value of 0. The following assumes you invert the (L:HSA1, bool) variable to represent ON (switch is on) when set.Since the only condition that will cause the light to go OFF is if the engine is running and the switch is ON, we should test for that condition since all other conditions will be false and need to cause the light to come on.(L:HSA1, bool) (*swtich is on*) (A:ENG1 HYDRAULIC PRESSURE,psi) 2000 > and ! (*are the previous conditions NOT true*)--Jon

Share this post


Link to post
Share on other sites

Jon, thanks a lot. At least it is not so dissapointing to see I am not totally out of the path.I used to program in Basic, Fortran and Turbo Pascal in those good old days where windows wasn

Share this post


Link to post
Share on other sites

Hi,No A:Var for APU!You have to make one yourself with L:Var's.33685504 (>K:ADF2_COMPLETE_SET)Is from an older sound gauge of Doug Dawson.Forget this and go and try the new one!Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

One little thing that I don't think has been mentioned so far:You wrote:*********3. it triggers with >K:ADF2_COMPLETE_SET and somehow with the (L:HSA1, bool) ! (>L:HSA1, bool) it stores the value of HSA1.I really don

Share this post


Link to post
Share on other sites

Ok Scott, now let me see if I got it straight.(L:HSA1, bool) ! (>L:HSA1, bool)From the case values =1 or =0 the first part will read:(L:HSA1, bool) has a value stored of 1.xxx or bigger or 0. Let

Share this post


Link to post
Share on other sites

Ok,About a month ago I was at the same place you are now. You'd be amazed at the learning curve around here!Many of your questions, and questions you haven't even run into yet, will be answered by doing the two following things:1) Seek out Nick Pike's tutorials and read all four parts of them. He did a fantastic job of explaining this stuff in a way that makes sense to someone who knows absolutely nothing about it to start with.2) Seek out Arnie Bartels guide and read it end to end... but don't even try to understand it all in your first day with it. It's the kind of thing that you go back and re-read every 2 to 3 days until you finally understand it all. Each time you re-read it, a little more of it will make sense to you than the time before.****Then (1.5) "!" not (>L:HSA1, bool) will convert that 1.5 to 0 and then trigger L:HSA1, bool to "0".****Not quite... the 1.5 should (*I believe*) be considered a logical true because it's not a zero value. It will be evaluated as being true, then what it is not will be put into L:HSA1 ... since it is evaluated to be true, the next instruction will change it to false.****The viceversa will be if L:HSA1,bool has a value of "0" then "!" not will trigger L:HSA1 to "1".****Yes, that's correct... but it's not simply the ! that does it. The machine takes L:HSA1 and, since there is no condition that it is being compared to, checks to see if it's true or false.With a 1.5, it will say true. So it puts a 1 on the stack.Then it see the ! , so it knows to place the logical opposite of whatever is on the top of the stack in the place of what is currently on the stack.It sees a 1 there, so it replaces that with a 0. If we stop there, nothing happens. The 0 sits there and stares at us like we're stupid. Read on for the rest...****I suppose that you can asign a value to a variable like this: (L:VAR, num) 56****No.To assign a value we use > which is the same as > ... the forum will only display > if I set my post to show in plain text, which can be hard on the eyes. But for you to see this properly, I had to do it here.To set a value into a var, we use (>L:MyVar,number) . You can use number, bool, enum, etc. etc.To place 56 in there, we use:"56 (>L:MyVar,number)" .Look at this again:(L:HSA1, bool) ! (>L:HSA1, bool)That should now make more sense to you. It does the following:1a) (L:HSA1, bool) evaluates L:HSA1 to see if it's true.2b) Places true or false on the stack according to the above check.2) The ! inverts whatever just went on the stack.3) (>L:HSA1, bool) places that value into L:HSA1Take the weekend to read those guides... by Monday, you will be so happy that you did!Scott / Vorlin

Share this post


Link to post
Share on other sites

Hi,Just to add a note on how "!" affects a number in the stack(ANY number integer/fractional) >= 1 ! gives 0(ANY number integer/fractional) <= -1 ! gives 0(ANY other number) ! gives 1Examples:455.5666 ! ---> 0 is placed on the stack1.5 ! ---> 0 is placed on the stack-56 ! ---> 0 is placed on the stack0.99934 ! ---> 1 is placed on the stack-0.4567 ! ---> 1 is placed on the stackAnd of course, 1 ! -> 0 and 0 ! -> 1 :-)****Then (1.5) "!" not (>L:HSA1, bool) willconvert that 1.5 to 0 and then trigger L:HSA1, bool to"0".****Yes, this is correct. But we don't speak of "trigger" here but rather "assign" a value to a variable. In this step, the value is removed from the stack and the var adquires it for further comparisons.Hope this helps.TomEDIT: I forgot to clarify this:*******************************1a) (L:HSA1, bool) evaluates L:HSA1 to see if it's true.2b) Places true or false on the stack according to the abovecheck.******************************************************There aint no evaluation here. Simply the var current value is placed on the stack (0 or 1) and then "!" inverts it.

Share this post


Link to post
Share on other sites

Ok, getting the grip of it thanks to all of you, hope as Scott said I wil be helping some other people too.I have recieved so many from the freeware, that I want to return something with quality.I will look forward for the documents and read them through the week end. it is true that at first I was in oblivion, but after working with your help and by trial at least I have done some simple things to the panel. But they are working!There are things that are still in the mist but hope to get through soon.I will keep you informed.Thank you to all of you.Another thing that I am dealing with is with the if else statements. Still can

Share this post


Link to post
Share on other sites

Tom,Thanks for the clarification! I'm a little confused though because you once said that non-zero values were treated as true... it was in response to a question about using a number or enum rather than a bool in a boolean test... and I thought that would imply that there was an evaluation somwhere.If L:Var,enum is set to 7, then "(L:Var,enum) if{ " will trigger the code in the if statement because the 7 is treated as a true condition. That I do understand. What I don't get is how the determination is made that 7 is true without evaluating it before performing any other operations, such as a !The learning never ends...Thanks for any insight,Scott / Vorlin

Share this post


Link to post
Share on other sites

****************************Human Language:if (L:VAR1) = (L:VAR2) then (L:VAR3 = 4) else (L:VAR5 = 5)My poor XLMif {(L:VAR1,number) (L:VAR2,number) == (>L:VAR3,number) 4} els{>L:VAR5,number) 5****************************Remember that RPN puts the operator(s) at the end of each construction:Then, A + B should be written A B +A - B ---> A B -A * (B + 5) ---> A B 5 + * or B 5 + A * etcSo, in if{ example:(LVar1) (LVar2) == if{ 4 (>LVar3) } els{ 5 (>LVar5) }Note that assignment of values to variables seems to conflict with RPN logic, ( "(>L:VAR5,number) 5" sounds RPN logical ) but in fact what really happens is an assignment (> ) extracts the last stack value and "transfers" it to the variable, if one does exist. Weird as RPN is....:-roll *********************************Now other thing I have been wondering is if the L variables remain with the last values through the whole panel or only for the gauges in the CAB file.**********************LVars maintain their values through the whole set of gauges in a panel. Tom

Share this post


Link to post
Share on other sites

Scott,******************What I don't get is how the determination is made that 7 is true without evaluating it before performing any other operations, such as a !********************We use to talk of "true" or "false" but actually I think it's handled in a different way. I am not expert on low level byte operations, but I guess it is a matter of bits manipulation. Values in stack are recognized as group of bytes (FLOAT64 I think), and ! operation (same as "if{" ) does some kind of bit reversing to find the proper result, a 0/1 binary value that will be placed on the stack ("!") or used to make a jump into another stack's memory area ("if/els" ).Tom

Share this post


Link to post
Share on other sites

Ok, thanks Tom. I know that we're getting into an area where to go deeper would probably be to overcomplicate things without a good reason and a good understanding of what ! actually results in is a lot more important than understand how it goes about doing it.One other general question:The coding that's done inside of formatted text, with the % and {case} or {loop}, etc.... what is that format /syntax / scripting method called? I've been going crazy for 4 days trying to find an answer to that question so that I can start to study it in depth but I can't do a Google search for SDK's or tutorials because I don't know what that way of doing things is called.I don't mind doing my research and reading the manuals... but I have to know what manuals I'm looking for to start with! (smile)Thanks for all the help, in every topic.Scott / Vorlin

Share this post


Link to post
Share on other sites

Scott,*************The coding that's done inside of formatted text, with the % and {case} or {loop}, etc.... what is that format /syntax / scripting method called?*************I don't remember of seeing it fully documented in any SDK, but rather a bunch of guys in this forum posted almost all the secrets of constructions after what I believe was a though testing time.In fact, structures maintain a big similarity with C types for strings. As the compiler to assembled code is written in C, I guess MS figured out a shortcut for easy string handling inside XML gauges, without messing with the stack's byte only model, which is very fast but too elemental to deal with complex strings.Tom

Share this post


Link to post
Share on other sites

Thank you for your enlightment Tom.I wil be trying the if, else statement soon.About the L variables, so if I assign let

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