Jump to content
Sign in to follow this  
Alba

Three Position Switch

Recommended Posts

Hi Folks. I am really struggling to get to grips with trying to code a switch with three bmp's. I have used three of the default aileron trim switch bmp's. The idea is that the OFF position is at 12 o'clock, bmp 0. A mouse click will show bmp 1 and a further click will show bmp 2.I have tried, with some help to code it in XML but am not really following the code. I am a complete beginner.I then tried EasyGauge but the section for using an Icon does not work either. Here are the lines of code from the user manual that I am trying.Ifswitchpos=0thenswitchpos=1Ifswitchpos=1thenswitchpos=2Ifswitchpos=2thenswitchpos=0The gauge compiles ok but does not work in the sim. Is the code wrong? I am not sure of the logic behind it. I know that it is simple and baby stuff but I am just not seeing it.Could someone help me please?Regards...Ken

Share this post


Link to post
Share on other sites

Your logic implies an "else" statement at the beginning of the second and third lines. With computers, you cannot imply anything...I think this syntax is correct:(L:switchpos, enum) 0 == if{ 1 (>L:switchpos, enum)}els{ (L:switchpos, enum) 1 == if{ 2 (>L:switchpos, enum)}els{ (L:switchpos, enum) 2 == if{ 0 (>L:switchpos, enum)}}}In any event, doing this kind of thing with xml or with hand coded C is fairly straightforward. Doing multi level "if" statements like this with EasyGauge is a whole lot more challenging...Doug

Share this post


Link to post
Share on other sites

Hi Doug, thanks for coming in. I am reading about L variables in a tut, so ok there. switchpos is my variable name. Could you explain the enum and the == part a bit further please. The tutorial I am using does not mention these bits.Perhaps this XML is going to be too much for me. I find it really difficult to follow the wording and the symbols used. Could you advise a tutorial that explains the symbols for a beginner? I have a book on XML but I think that a lot of these symbols are peculiar to the flight sim.If I could just grasp the meaning of some of the lines of code it would be great!!Regards...Ken

Share this post


Link to post
Share on other sites

Set that aside for the moment, and go here:http://fs2x.com/Tutorials.htmand work through the XML tutorials found there.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

And try to use an xml editor - for me that was the breakthrough to successful programming. My choice: Peter Reynolds freeware PXE version 1.1.1 available at: www.iol.ie/~pxeThen load some of the default gauges to see how their code is (FS9 are best, PXE has some problems to open the new FS-X type xml gauges)In case you don't own FS9, download some of the numerous freeware panels with xml gauges.Herbert

Share this post


Link to post
Share on other sites

Hello again Bill, Hi Herbert. Thanks also for coming in and helping out. Herbert, I now have the Editor you recommended, thanks for that. I am sure that it will make following the code a lot easier. Bill, I am working through the tutorials on the site that you suggested. I saw it in an earlier reply of yours to another post. I can basically follow through the train of thought in the main Body part of the tut. It is the mouse click area that is confusing me. The area part is ok but I get confused regarding the numbers that are assigned to the L:Var and their relationship to the bmp's.I have an idea where folks like yourself post a snippet or two of XML code and then explain in simple terms what it does. I have Arne's tutorial downloaded and have read through the sticky post at the top of the Forum. However, for me it is information overload. It would be helpful if a post was started for beginners in plain English. No offence intended. I tried to code my three bmp gauge as per the tutorial. I thought that I had it correct but I was several steps behind the level of knowledge. For me, it assumed a prior knowledge of XML. It is difficult for a knowledgable person to keep information simple. I speak as a knowledgable person in my own field. I slip easily into words and phrases that beginners do not follow.I will try making my gauge again following through with the tut. I just can't think now of the bits that I did not understand but perhaps I could post again if it does not work.Regards...Ken

Share this post


Link to post
Share on other sites
Guest FelixFFDS

>I have an idea where folks like yourself post a snippet or two>of XML code and then explain in simple terms what it does.>>Regards...KenKen, Fr. Bill (and others) do that from time to time.At Freeflight Design Shop there are several posts (especially in the tutorials and working XML code boards) where people like the good Friar post XML code and explanations.Whle I have yet to dare venture in custom XML coding, at least I have become dangerous.Caveat... while there are some interesting codes and explanation at the FFDS Boards, this AVSIM board as (in my opinion) this is the best forum for XML coding .

Share this post


Link to post
Share on other sites

>Caveat... while there are some interesting codes and>explanation at the FFDS Boards, this AVSIM board as (in my>opinion) this is the best forum for XML coding .That may well be true, but the forum software here just sucks, big time... :(I vastly prefer yaBB forum software, as it's much more "user friendly."


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Ken,We all started somewhere "near zero" and I agree, many tutorials aren't for absolute beginners. But it will only take some successfull created gauges, and you'll understand allmost everything they are dealing with.In case you are seriously willing to learn how to create XML gauges, I'd like to teach you the very basic things, like doing this 3 position switch. All I need is a valid mail adress and I'll send you back a working xml file with all explanations what the code does.Herbert

Share this post


Link to post
Share on other sites

Hello Herbert, thanks for the offer of help. Yes, I am serious about doing some gauges. I use EasyGauge to make some simple stuff for my own use and Panel Studio to manipulate panels and make new panel windows.The EasyGauge Forum is locked out at present and the general feeling is that the prog. development has come to halt.I would like to work with XML so I will mail you with my own address.Regards...Ken

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