Jump to content

Recommended Posts

Guest Eugen

Hi,I wonder if there is a XOR Operator ^ in xml gauges ?BrgdsEugen

Share this post


Link to post
Share on other sites
Guest

>Hi,>>I wonder if there is a XOR Operator ^ in xml gauges ?Not that I'm aware of. The only two "or" operators are:|| (logical OR)| (bitwise OR)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://mtco.com/~rsam/fartslogo.jpg

Share this post


Link to post
Share on other sites
Guest bartels

Please have a look in the MS Panel SDK. That's what it's for.Logical operators are: AND && OR || NOT !Bitwise Operators are: AND & OR | XOR ^ NOT ~ shift right >> shift left <

Share this post


Link to post
Share on other sites
Guest

>Please have a look in the MS Panel SDK. That's what it's>for.You are absolutely right, Arne! The XOR '^' is listed on page 81 of the SDK. I'm so used to going to your treatise on the subject that I frequently forget that there is more information (even though very obtuse) in the SDK.You seem to have omitted the XOR from that source, so I (incorrectly) assumed that it didn't exist... :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://mtco.com/~rsam/fartslogo.jpg

Share this post


Link to post
Share on other sites
Guest Eugen

Thanks !You are rightBrgdsEugen

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

Hey Arne.What is the difference between Bitwise and Logical? Apologies for my ignorance :D

Share this post


Link to post
Share on other sites
Guest bartels

It isn't in xmlgau01.zip because I wrote it before the SDK came out. None of the default gauges used it so I didn't recognize it. If I'd had much use of it I might have found it also since it is so "C"-like, but I didn't.Arne Bartels

Share this post


Link to post
Share on other sites
Guest bartels

Oh, must I?Logical means that you work with values 1 (true) and 0 (false), I think you know the meaning of AND and OR there. As a speciality of C and XML-Gauges any number not 0 is treated as true, and zeros as false.Bitwise operations make all operations for every bit in a number. E.g. "4 1 |" means:"4" is in bit representation 0100, "1" is 0001, "|" is that for each bit in both numbers an OR is done. => 1000|0001=1001 => 5. I wrote only four bits out of lazyness, but you can have more of course. The maximum usable bits are dependent on the used type for C gauges (don't know the limit in XML). E.g. a UINT32 has 32 bits setable.You can "stuff" much more information in a bitwise treated variable then in a "normal" boolean, with the drawback that the result is also more complex to interpret. Arne Bartels

Share this post


Link to post
Share on other sites
Guest Eugen

Hi again,The last q&a sound as a good one for the the FAQ.Btw I saw that the FAQ had more than 1000 views and a 5 star rating.Great job Arne and all others contributing !Eugen

Share this post


Link to post
Share on other sites
Guest

A "cute" way of getting bitwise booleans to work is when you are stuck with switch graphics that influence oneanother. I.e. three switches packed so closely together that when switching #1, it will cast a shadow onto switch #2 and #3. So instead of setting the state of each switch independatly, you read a 3-bit value where each bit indicates the state of one switch. Three bits gives 1+2+4 possible values, so to represent each possible state you'll need as much as 7 graphic files.Here is a gauge example that uses this:(L:DumpSwitch,enum)Pull To Dump From Left Engine Knob(L:DumpSwitch,enum) 4 ^ (>L:DumpSwitch,enum)Pull To Dump From Right Engine Knob(L:DumpSwitch,enum) 1 ^ (>L:DumpSwitch,enum)Emergency Oxygen System Knob(L:DumpSwitch,enum) 2 ^ (>L:DumpSwitch,enum) (L:DumpSwitch,enum) 2 & if{ 1 (>L:Oxygen Knob,bool) (P:Absolute Time,seconds) 1 + (>L:Oxygen Timer,seconds) (*initiate timer*) } els{ 0 (>L:Oxygen Knob,bool) }Edit: Hmm, the endtag shows up differently when viewing the message than when I wrote/edit this message.Anyway, another possible example is to "save" a few L:Variables,bool to an A:Variable,enum that is not used by the actual aircraft. I know I need to delay an initialization gauge for about one second before all the variables are correct in the sim (i.e. ambient temperature is wrong immediately after aircraft load). Just be sure to put the info in a variable that is saved with the aircraft :)

Share this post


Link to post
Share on other sites

Karl,Just tested your above code.It works of course, but what is the meaning?The movements, i use a switch with 7 different positions, are a little bit unpredictable.Do you have an example or, better, a picture?JanNot so "Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

Hey Jan.If I understand your question correctl, the meaning is to basically see if when changing the image of a switch you clicked on, if the image of the adjacent switches needs to be updated. In this case, Karl's example was three close switches that may cast a shadow onto each other. SO if you move switch one, not only the image of this switch will need to be changed, but also of the switch next to it, with a new image (albeit in the samw switch position) with a different shadow cast over it.

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

Thanks Karl, great example.

Share this post


Link to post
Share on other sites
Guest Fabio Miguez

Hey Arne.Thanks for the explanation, I understand it much better now.

Share this post


Link to post
Share on other sites

Fabio,Thanks.So it is more a matter of graphics than function.Sure i can use this one.PS.2 years ago i did a Night-VFR T&G at KDAB.Jan"Procul Negotiis"

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