Jump to content
Sign in to follow this  
Guest Tomcattwo

Despairing with 'invisible' XML gauges...

Recommended Posts

Guest Schindi

Hello everybody!After some specialisation in repinting and a first stint at 3D-modelling I now also want to learn something about the programming of gauges.I just started editing and creating xml-gauges for FS2004 and am already at a point where I have no idea how to go on without loosing my sanity...My big question: Why do my gauges sometimes show on the panel and sometimes not?!? I realise this must be a synthax issue (yep, I read the FAQ), but I checked my xml-files thoroughly and can't see what's wrong with them.OK, so what I want to create is a realistic looking UpFrontControl-gauge for a Pilatus PC-21, containing several areas where com, nav, adf, transponder and similar would be displayed and changed.After creating a new file and defining my first text-element showing the COM1 Active Frequency all works perfectly and I got what I want where I want it.Then I copy this element, paste it below the first one and adapt it to show NAV1 Active Frequency at a different position: Still works!Now I repeat the process and add another element for COM2 Active Frequency - but strangely the gauge refuses to show itself in FS2004!I've now experimented a whole evening, sometimes in Morphon-XML-editor, sometimes in notepad, sometimes in Panel Studio, and occasionally even have some success (got 6 or so elements working right now - see attachment), but so far I haven't been able to discern when adding another element works and when not, or what the reasons for that are.I tried playing around with the position values (in one case 24,170 works but 24,171 doesn't...), the sequence of the elements, whether line-breaks between elements matter, and so on - but still no luck.And now I decided to ask here for help! Let me shoot some direct questions (in addition to the tear-filled "why can't I see my gauge?!? *snif*"...): :D1) What are typical synthax errors people often make? How can I avoid them?2) What editors do you recommend for working with xml-files?3) A basic one: does the sequence of Text-elements matter? Is there a maximum number of 'allowed' elements?Well, I'm very much looking forward to any inputs you might have! ;)With kind regards,Markus

Share this post


Link to post
Share on other sites

Hmmm... I'm not an expert by any stretch of the imagination, but I have to wonder why the "abs" in your statements? It is totally unnecessary...Also, it is best to sandwich EVERY element of a with the percent sign (%), like this:%COM2: %((A:COM2 ACTIVE FREQUENCY,MHz))%!6.2f!%


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

Markus,I loaded up your gauge with a replacement image of a simple grey background with the same dimentions, and It worked fine. But looking back at your post you did say the version you posted WAS working for you, so why don't you post the code that's not working. It's a little bit easier to diagnose the problem if we're starting with something that's broken:)To answer a couple of your questions:1) I've never hit a ceiling on the number of elements, nested or otherwise, and I've seen upwards of a hundred within one code block. oI doubt if that's an issue. I have run into ceilings on the number of if{ els{ blocks within a single element, but obviously that's not your problem.2) Line breaks before or after structures are ignored, they're just for readability, so you can have as few or as many as you like.3) The most common reason for a gauge not to load is a syntax error within constructs. Forgetting a %, {, or ( for example will cause the gauge not to load.4) The most common cause of a gauge actually crashing FlightSim is with a bad definition.5) I use a very simple freeware editor called Bonfire Studio. Others should work just as well if not better. I do not use schemas. The only reason I use it is I'm confortable with it. If you're not locked into one, I'd suggest something more powerful, perhaps with the ability to catch missing closing parens like a C editor.--Jon

Share this post


Link to post
Share on other sites
Guest Schindi

Thanks Bill and Jon for your inputs! They sure clarified some things for me! :)@Bill: I'll try out the % thing and ommit the 'abs' and see what happens.. The 'abs' was in a gauge I used as a reference, so I figured it MUST be there...@Jon: This was actually the problematic code that wasn't working yesterday! I checked it out again this morning and it indeed worked! Can it be FS2004 simply gets "cranky" and ignores my gauge when I constantly continue reloading the plane to see my changes? Must have done that about 50 times when I was experimenting yesterday...Hm, maybe I should try creating the code for a whole gauge, then try everything out at once, not simply add one element, try it out, change another one, try it again,...Hm, it appears that the codes are not case-sensitive, yes? So it doesn't matter whether I use "COM1 ACTIVE FREQUENCY" or "Com1 active frequency". Or does it?Thanks a lot again!Cheers,

Share this post


Link to post
Share on other sites

<1) What are typical synthax errors people often make? How can I avoid them?<2) What editors do you recommend for working with xml-files?<3) A basic one: does the sequence of Text-elements matter? Is there a maximum number of 'allowed' elements?1) All sorts. When you have a group of nested if{} els{} statements, it's easy to get the number of {} pairs wrong. Also getting the matching number of . I've had this problem in the past, and it's been down to what I would call bad text. Even copying text can sometime fluff-up. If you out sections and test and find the corrupted text, and do some retyping.2) I've tried fancy XML editors, and always come back to an enhanced version of notepad.3) There is a limit to the element content, but it'e plenty big enough. I had to split a gauge up into a number of elements because of this. I have done some gauges with a stack of element sections, and have not yet found a limit.If you are learning XML, we are running a tutorial course on XML gauges and hoping to release each part weekly. It's in the early stages at the moment, but will grow, with a third chapter due immenently. We also have an area for students gauges, and time permitting, we will attempt to help out.nick

Share this post


Link to post
Share on other sites

Are you reloading the entire simulation for testing your gauge? If so, you should know that you can simply reload the panel while in the sim. It generally just takes a matter of a second or so and you can see your changes immediately. From your last post it sounded like you might not be doing that.The only caveat is that you need to reload the panel once BEFORE you tab out and start making changes, or else the file will be locked and changes won't save.Just make a button someplace on your panel, either in the gauge you're working on or a separate gauge (preferable) and have it perform a (>K:RELOAD_PANELS) event.--Jon

Share this post


Link to post
Share on other sites

Here is what I use. Place it anywhere you like, but I usually place it in the top left corner of the screen.After loading your panel, click on the "R" once to "reload and unlock" the XML gauges so you can save your updated XML code.After making a code change and saving, click the "R" button once to see your changes... INSTANTLY! ;)http://forums.avsim.net/user_files/119678.jpgBTW, a shorter way to "comment out" stuff is this:


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
Guest Schindi

Thanks to everybody for your help! I really appreciate it and it sure saved me from a lot of frustration!@Nickpike: Your tutorial is outstanding! Exactly what a beginner needs!@n4gix: Thanks for the reload gauge! That's also a keeper...I have now been able to get my UFC gauge going in the direction I want, and I also almost finished with an Standby ADI for my PC-21. There's always something unexpected happening, but I'm learning a lot! I also have some other questions, but they'll go into a new thread probably so as not to confuse people...

Share this post


Link to post
Share on other sites
Guest Tomcattwo

Markus,I see the same behavior you describe: while working on .xml gauges, I'll do a fix, re-cab the files, paste the new .cab into the panel folder, and reload the panel from within MSFS (using a RELOAD_PANEL button as described above or just by AltSelect Aircraft and select the aircraft again). Sometimes the gauges in the new .cab show up when I reload and sometimes they don't. Sometimes after a reload, my reload panels button doesn't function any more (until I exit the sim and restart it). If a gauge doean't show up after a reload, I have to Exit MSFS and restart it. I've chalked it up to MSFS just being flakey when reloading panels. Maybe it has to do with some of the timers and variables I'm using, but I do see the same behavior you described - so you aren't seeing things :) . It's just something I've learned to live with.And like you I want to offer a HUGE round of thanks to Arne Bartles, Nick Pike and Don Kuhn (FS2D.com) for their outstanding tutorials!Nick, when I get my current freeware aircraft done, I'll offer up some of my gauges to your website for Freeware use. Thanks for taking the time to explain what's going on so very clearly. Arne, we would be lost without your work in figuring out the callback syntax. Thanks to all for sharing.R/TC2

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