Sign in to follow this  
Guest

Help with XML 'center return' toggle

Recommended Posts

I need to construct a toggle switch for flaps control with 'center return' in XML.I've constructed the Flaps Indicator and it works splendidly! Now I need the toggle for it.I have no problem figuring out most of what I need to do, but there are no examples of this type switch to study! :)I suppose that the "mouse action" will require some sort of if, els statement, but I don't have a clue about construction and syntax.Can anyone help?

Share this post


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

Bill, How did the problem with "cabbing" go ?? I made a light switch a few days ago as Dim/Brite/Test, on test would return to dim. Here's an example modified a bit for a return on up/down.. Not tested. (*********** Bitmaps in the 3 switch positions *************) (G:Var1)(*********** The reset to neutral, G:var1=0. It does this if the switch is either up or down, G:var1=1/2, "AND" the delay timer runs out. ( G:Var2 less than clock )***********) (G:Var2) (P:Local Time, seconds) < (G:Var1) 0 == ! & if{ 0 (>G:Var1) }(****** While mouse is clicked or held, G:var1 will go either 1 or 2 (up/down), The flaps will do their thing, and 0.33 seconds are added to the clock for the timer, G:var2 *****************) (P:Local Time, seconds) 0.33 + (>G:Var2) + 1 (>G:Var1) + (>K:Do the flap thing up)(P:Local Time, seconds) 0.33 + (>G:Var2) + 2 (>G:Var1) + (>K:Do the flap thing down) The problem with this little timer is that it doesn't work when paused or the actual FS time is greater than 23:59:59.66.. (Not really a problem there) :-) There are I am sure other ways to do this,, I just had this handy.Hope it helps.Regards, Roman(KGRB)Project 737-400

Share this post


Link to post
Share on other sites

>Bill, >> How did the problem with "cabbing" go ?? I made a light >switch a few days ago as Dim/Brite/Test, on test would >return to dim. Here's an example modified a bit for a return >on up/down.. Not tested. Wow! I never expected such a quick reply! Thanks... Now, I'll have to stay up and try it out quickly... :)Arne suggested the probable cause of the disappearing gauges. It seems that you can't mix 'single size bitmap gauges' in the same .CAB with 'dual size bitmap gauges.'IOW, if there is a 1024 subdirectory in the .CAB, gauges that use only one set of bitmaps in the 640 subdirectory will cause grief...I 'worked around' the problem by simply declaring the same bitmaps for both sizes and put a set in each of the two subdirectories.I *love* working with XML (mostly) because it's so easy to test your changes... click, save, load FS and test! :)Thanks again, I'll let you know how it worked out. My next project should be a bit easier: a set of vertical scale gauges for oil pressure, l & r fuel gauges, and engine temperature.Then a set of engine lights for the top of the Socata TB20GT panel.

Share this post


Link to post
Share on other sites

Bill,""I *love* working with XML (mostly) because it's so easy to test your changes... click, save, load FS and test! "" Yes indeed, in almost no other FS designing can you see the results so fast.. If you donot know already you may try whats in the following message in this forum. Speeds it up even more :-) It works for me... http://ftp.avsim.com/cgi-bin/dcforum/dcboa...orum=DCForumID9RomanProject 737-400

Share this post


Link to post
Share on other sites

>Bill, >Yes indeed, in almost no other FS designing can you see the >results so fast.. If you donot know already you may try >whats in the following message in this forum. Speeds it up >even more :-) It works for me... Thanks for the link to the message, I'll go look.XML Notepad is barfing on line 28:(G:Var2) (P:Local Time, seconds) :)Thanks again.

Share this post


Link to post
Share on other sites

>XML Notepad is barfing on line 28: >>(G:Var2) (P:Local Time, seconds) < (G:Var1) 0 == ! >&if;{ 0 > ^ no white space >allowed >>So, I'm going to read the referal and then call it quits for >the evening... I'm getting groggy and can't think clearly... >:) >>Thanks again. Bill, Me too ending the night, sorry should have mentioned ---Note, the way it looks here on the forum is different since HTML has processed it. On paper the " < " would be " & l t ; " , the " > " would be " & g t ; " and the " & " would be " & a m p ; ". All without the quotes and remove spaces between characters. So from the code above and that you are using now, remove the & and replace it with "ampersand"amp; ( Using the spelling of ampersand otherwise it will convert to html, but it would look like &am"p""semi-colon" ). Apply to the < and > symbols too.. I hope this doesn't confuse you..Tested it quickly and that should resolve the " hurling chunks" from XMLNotepad. :-erks :-lol Thats not saying there is a problem in the code where it prevents it from working properly.. :-hmmm Just an example.EDIT -- attached is a text doc that has the code pure,, the copying and pasting from the forum into an XML also seems to remove spaces too,, thats a no no.. And I did test it this time.. Does work. ( why have an example that doesn't ? :-) ) You will just have to provide bitmaps if you want to test this code directly. Also there may be a single flutter of the switch if held instead of just clicked. ( that is the time between FS realizes that the click is actually a hold ) to get rid of that you may have to increase the timer from 0.33 to 0.75 . Regards,RomanProject 737-400

Share this post


Link to post
Share on other sites

>EDIT -- attached is a text doc that has the code pure,, the >copying and pasting from the forum into an XML also seems to >remove spaces too,, thats a no no.. And I did test it this >time.. Does work. ( why have an example that doesn't ? :-) >) You will just have to provide bitmaps if you want to test >this code directly. Also there may be a single flutter of >the switch if held instead of just clicked. ( that is the >time between FS realizes that the click is actually a hold ) >to get rid of that you may have to increase the timer from >0.33 to 0.75 . Thanks... I just noticed now that you'd included a 'pure text' attachment. I compared it with what I'd manually parsed from your instructions, and it tracks perfectly.Of course, I had to make adjustments to the 'mouse rectangles' as well as the location of the switch on the bitmap, but that was easy.Thanks also for the "Reset XML" code! Boy, what a groundbreaking discovery! It works a treat... Especially since I can now have the XML Notepad open on the second monitor while FS is running on the primary screen. I made a 20x20 bitmap in bright yellow with a single pixel red border, and a great bit red R in the middle. There's no way to miss that! :)I'll have to check the timing variable, since the toggle doesn't always 'flip' or 'flop' with each mouse click... but, otherwise it's great.Thanks again for the great help. I know I probably won't be much help to you, but at least I'm learning so that I can eventually 'pass it on' to someone else down the road. :-beerchug

Share this post


Link to post
Share on other sites

>>Thanks... I just noticed now that you'd included a 'pure >text' attachment. I compared it with what I'd manually >parsed from your instructions, and it tracks perfectly. -- You're welcome.. I had just made a similar switch a few days ago..>Thanks also for the "Reset XML" code! Boy, what a >groundbreaking discovery! It works a treat... Especially >since I can now have the XML Notepad open on the second >monitor while FS is running on the primary screen. I made a >20x20 bitmap in bright yellow with a single pixel red >border, and a great bit red R in the middle. There's no way >to miss that! :) 2nd monitor, yess .... And??? if you're networked to another as I ( for wideFS ) you could have FS , notepad and a bitmap editor goin all at once. An XML gauge factory !! :-LOL >I'll have to check the timing variable, since the toggle >doesn't always 'flip' or 'flop' with each mouse click... >but, otherwise it's great. The gauges I assume get read 6 times per second, that "may" vary on PC load / frame rates too so the timing may have to be changed. >Thanks again for the great help. I know I probably won't be >much help to you, but at least I'm learning so that I can >eventually 'pass it on' to someone else down the road. >:-beerchug Again, quite welcome. Glad to help. :-beerchug to you too !! :-)Gotta thank MS for making gauge programming mucho easier.. :-)RomanProject 737-400

Share this post


Link to post
Share on other sites

>2nd monitor, yess .... And??? if you're networked to another >as I ( for wideFS ) you could have FS , notepad and a bitmap >editor goin all at once. An XML gauge factory !! :-LOL :-LOL Indeed! You'd be amazed. Here at St. Gregory House (where I'm the Superior General), we have a total of nine 'flight stations' set up, all networked together, with a tenth 'console' set up for our 'in house ATC controler.'Eight of the 'flight stations' are for general use by my Brothers, but the ninth is in my office and set up as a 'development station.' I have 2 monitors on the host 'puter and three 'puters linked via Wideview or WideFS for various other displays... ;)Lest you think this a bit 'over the top,' when not being used for simming, these computers are used in our AV Studio for production purposes! ;)>Again, quite welcome. Glad to help. :-beerchug to you too >!! :-) FS2002 Miscelaneous

Share this post


Link to post
Share on other sites

>:-LOL Indeed! You'd be amazed. Here at St. Gregory House >(where I'm the Superior General), we have a total of nine >'flight stations' set up, all networked together, with a >tenth 'console' set up for our 'in house ATC controler.' >>Eight of the 'flight stations' are for general use by my >Brothers, but the ninth is in my office and set up as a >'development station.' I have 2 monitors on the host 'puter >and three 'puters linked via Wideview or WideFS for various >other displays... ;) > when not being >used for simming, these computers are used in our AV Studio >for production purposes! ;) >WOW!! When you gentlemen get together at once it must be treat !!!>Lest you think this a bit 'over the top,'NEVER..... > when not being >used for simming, these computers are used in our AV Studio >for production purposes! ;) After work, there must be play.... A computer with no purpose is nothing more than an expensive paper weight.. :-LOLTook a look see at the socata panel... Sweet !! RomanProject 737-400

Share this post


Link to post
Share on other sites

>After work, there must be play.... A computer with no >purpose is nothing more than an expensive paper weight.. >:-LOL >>Took a look see at the socata panel... Sweet !! Thanks, Roman. That means a lot. I'm having a bit of 'fun' now building the new Engine Cluster. I still haven't quite gotten my teeth wrapped around the X,Y coordinates yet, so it's a bit of hit and miss (emphasis on the miss!) getting the little needle to display in the right place.Since Warren is a bit backed up, I'm using an image cropped from a photo for the bitmap at the moment.The 'beta version' currently available uses FS Pro default gauges mostly, along with some from a TB10 package that's bundled with the a/c I'm using for testing purposes. I'm slowly building all custom gauges in XML to replace them, as they are not 100% accurate for the actual a/c the gentleman owns who requested this panel...I have made a concious choice to NOT bother learning the 'old' C++ method of gauge construction, because I've got a hunch that they will NOT be supported in the next iteration of FS.Eventually, Warren and I will finish this, and then move on to the actual GMAX model of the a/c itself.I assume that you also looked at the "Preview" pictures as well. I've got to take some new ones soon, as much more has been done since last week...

Share this post


Link to post
Share on other sites

I'm happy to hear you're getting along with xml. I don't think support for C will be abandoned before the _complete_ set of events and variables are completely supported within the xml system. For a first attempt, the current xml system is quite good, but there are so many things left out to totally replace C style gauges. I think Microsoft introduced xml to encourage both new designers and designers that have come to a halt on their project. These can now just check the builtin gauges code or addon code directly, as the code is all out in the open. This again, should lead to more addons. I recently found what could be a bug in the G:Var variables. See other post on this.The SDK is lacking a lot of information on what the different things are supposed to do, but I hope a more comprehensive SDK arrives with the next version. Developing with this SDK includes way too much trial and error - especially error - requering the need for monitoring gauges - slowing down the release :) I understand that a lot is gained from experience, but Microsoft should learn how to do SDK's better. They are getting better, but there is still quite some distance to go.If you have Photoshop or another decent paint software, getting values for positions, nonlinearity tables, axis offsets and so on, is a breeze. Crop out the instrument, and read values from the info tab or similar.I'm not fortunate enough to have a multimonitor setup, but it's not a problem having all programs up and running at the same time. Just not run MSFS maximized. Of course the taskbar looks like a real mess though :D

Share this post


Link to post
Share on other sites

>I recently found what could be a bug in the G:Var >variables. See other post on this. I'll make it a point to look for that...>The SDK is lacking a lot of information on what the >different things are supposed to do, but I hope a more >comprehensive SDK arrives with the next version. No kidding! It seems the 'art of documentation' has been lost, along with the printed manuals... ;)>If you have Photoshop or another decent paint software, >getting values for positions, nonlinearity tables, axis >offsets and so on, is a breeze. Crop out the instrument, and >read values from the info tab or similar. I have Adobe Photoshop (full edition), Serif PhotoPlus 8, and ULead Photo Impact. I did manage to compete a complete set of engine gauges (vertical, linear type) in about two hours today, but for some reason the x,y coordinates in Adobe didn't match too well with reality... :)I know what you mean about 'trial and error,' that seems to be my experience. Part of the problem I've encountered is that some of the tags, such as ENG1 OIL PRESSURE are listed in the SDK with the incorrect units... The SDK lists this as Pounds per Sq Foot, when it is actually PSI!!! ???

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