Jump to content
Sign in to follow this  
Guest Vorlin

XML odd problem..... Nick? Arnie? Gurus? HELP!

Recommended Posts

Scott,You might try this:(remove this line! <?xml version="1.0" encoding="UTF-8"?> ) 1 (>G:Var1) (G:Var1)%('Hello World')%!s!Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

Tom, I got it to work and posted a new message about it because the solution lead to more questions. For unknown reasons, the topic has not posted and I tried it twice.I set G:Var to 1 in one element, then had 2 text elements, one visible if true and the other visible if false. That failed, as usual.However, I then put the element that sets G:Var to 1 UNDER both text elements and suddenly it worked!!!!!**pounds head on desk**I always thought that we have to set the variable before calling it for use, especially in a script that starts itself over from scratch 6 times per second. There is obviously a persistency involved with the variables but I can't even pretend to understand it.Any insight on why this happens is appreciated... it could help myself and others to avoid similar issues in the future.Thanks,Scott / Vorlin

Share this post


Link to post
Share on other sites

Scott,Maybe you could copy and paste the code (as to avoid typos) and I might give it a test.Regards,Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

Tom,The top line is still in there. This was tested before I saw what was said about that. I have to get to work, so I did find / replace for < and > to post this.This works:*****************************<?xml version="1.0" encoding="UTF-8"?> (G:Var1) 0 == %('Tested False')%!s! (G:Var1) 1 == %('Tested True')%!s!1 (>G:Var1) ***************************This fails:***************************<?xml version="1.0" encoding="UTF-8"?>1 (>G:Var1) (G:Var1) 0 == %('Tested False')%!s! (G:Var1) 1 == %('Tested True')%!s!***************************The ONLY difference is that the one element has been moved by a cut & paste operation. 15 minutes to shower and hit the road... it was nice having yesterday off!Scott / Vorlin

Share this post


Link to post
Share on other sites

Scott,In the first example, "Tested False" is shown briefly and "Tested True" is then printed and keeps on showing.This happens because GVar1 is 0 at first pass of the code, making (G:Var1) 0 == equals 1 (true) and the string visible. On the other hand, in the second element (G:Var1) 1 == returns 0 (false) then teh string will NOT be visible. In the last element, GVar is changed to 1 and the consequence is the condition of each string is inverted.In the second example, "Tested False" is hidden fron init, because GVar1 is set to 1 before."Tested True" is printed always.So far tested. I don't know what you mean when you say "failed" , is that none of the strings is displayed?Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

Whan I say "fails", I mean a blank gauge / no output at all.I have a nasty feeling that it has to do with the fact that I updated msxml.msi, updated XP to SP2 and added MS's Visual Web Developer 2005 Express Edition in one sitting, trying to make sure I was totally up to speed.Immediately after this, the parser seems to be rather fragile in ways that it wasn't before, but all gauges that worked before still work so that's a good thing.I've been playing with macros.... very nice. Never again will I have problems with IF statement syntax LOL.Tom, I see many ways to set numeric values into variables (many types) but are there no string types at all for variables? I find it very odd that I can't find any mention of it anywhere.Scott / Vorlin

Share this post


Link to post
Share on other sites

>>Tom, I see many ways to set numeric values into variables>(many types) but are there no string types at all for>variables? I find it very odd that I can't find any mention of>it anywhere.>Unfortunately there is no way to save strings into LVars. Hope that MS would be kind enough to fix this for FSX.However, within a gauge's visibility, you can save strings to registers for use in different parts of the gauge.For example (stack) 'My String' sp30 ...%( l30 )%!s! Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

How on earth do you know the things you know? ROFLOk, I've started "playing" with an experimental gauge file just to see what I can get it to do with macros and other such things. One last question before I go experiment for a few hours:That's a lot to have listed about a hundred times in any file... I notice that you seem to use a lot in your examples. Is there a way to assign a default set of attributes so that will be treated as if it has all the attributes of the longer version above and, if so, how do we tell the parser when there are exceptions... as in but we still want all the other attributes to stay the same?Thanks for all your help! So far, I have been able to find ways to do almost anything I could want to do and, with your help, it's all happening faster and the code is more clean and understandable with each hour that goes by!Scott / Vorlin

Share this post


Link to post
Share on other sites

>How on earth do you know the things you know? ROFLThese are the steps that worked for me:1) Analyze MS's basic XML gauges 1) Discover this forum2) Digest the pinned threads3) Read Arne's and Nick's tutorials and MS SDK3) Do basic programming4) Search the forum looking for advanced programming hints.5) Learn from advanced solutions posted - there are very talented people here.6) Start your own tests for complex situations.7) Feedback the forum with what you've learnt to help other people choose the best solutions, like they helped you choosing your own's. >Is there a way to assign a default set of attributes so that will be treated as if it has all the attributes of the >longer version aboveUnfortunately no.Tom

Share this post


Link to post
Share on other sites
Guest Vorlin

Tom,Yea, I know what you mean. I get the same feeling when I'm explaining how to make FSInn work for the 100th time. It's easy to forget that sometimes someone is trying to RTFM, but can't find the manual or their searches become so buried in scattered returns that they drown in too much information that isn't addressing the questions they have at that moment.This is where I am in the learning curve...1) Analyze MS's basic XML gauges -Done 1) Discover this forum -Done 2) Digest the pinned threads -In Progress (it's a lot to digest!) 3) Read Arne's and Nick's tutorials and MS SDK -Done and re-reading them often!3) Do basic programming -Done and continuing4) Search the forum looking for advanced programming hints. -In Progress 5) Learn from advanced solutions posted - there are very talented people here. -In Progress (you have all been great help!)6) Start your own tests for complex situations. -In Progress 7) Feedback the forum with what you've learnt to help other people choose the best solutions, like they helped you choosing your own's.#7 is one that I try to do when I can but, at this point, I don't feel qualified to do much more than mention basic ideas for how to approach a problem. As I grow, I will gain the confidence to improve at this... I'm already doing this in other areas, but not yet in XML. In time... in time...Thanks,Scott

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