Sign in to follow this  
Guest Robert Sanderson

Help Needed with XML Syntax!

Recommended Posts

I am trying to implement an "Autoswitch" using the (new) Time of Day variable. While I have no trouble displaying a string, I'm having difficult with the exact command syntax to TOGGLE_BEACON_LIGHTS, which I'm going to use to switch on/off .fx cockpit lighting.Here's what I have so far. Perhaps some XML experts can fill in the missing blanks. The two strings simply display the actual values for Time of Day and Beacon Lights for testing purposes... :)%((E:Time of Day, enum))%!1d!%%((A:Light Beacon, bool))%!1d!%(A:Light Beacon, bool) 0 == (E:Time of Day, enum) 3 || && if{ (K:TOGGLE_BEACON_LIGHTS) ! (>K:TOGGLE_BEACON_LIGHTS) } Basically, I want the lights ON if Time of Day is NOT EQUAL to 3...Dawn/Day/Dusk = ONNight = OFF

Share this post


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

Hi Bill, I'm certainly no expert on XML gauges for flightsim, but I'm beginning to wonder if the Time Of Day variable is working in FS9.For example, I can turn the panel lights on/off with the following:(A:ENG1 MANIFOLD PRESSURE, boost psi) 3 > if{ (>K:PANEL_LIGHTS_ON) } els{ (>K:PANEL_LIGHTS_OFF) }And it works with any other A variable I've tried (SIM ON GROUND etc.), but as soon as I write:(E:Time Of Day, enum) 1 if{ (>K:PANEL_LIGHTS_ON) } els{ (>K:PANEL_LIGHTS_OFF) }it only executes the first line of code in brackets, just as it would if you removed the (E:Time Of Day, enum) 1 variable.I checked and Time Of Day is present in the FS9 Main.dll file, along with the other sim global data listed in the parameters SDK.I was really looking forward to brightening up my VC automatically during the day, at certain sun angles the canopy framing and tubing turns black and the cockpit sidewalls are in deep shadow. I hope I'm doing something wrong here, since this is the first time I've used enumerated values or E: variables, although they seem to be pretty simple stuff. I tried the gauge code you posted with the same results, the beacon lights stayed on at all times. Your string data was displayed, just no automatic light switching based on time of day.Wish we could just ask the MS development team if TIME OF DAY actually works! LOL Robert

Share this post


Link to post
Share on other sites

>Hi Bill, >>I'm certainly no expert on XML gauges for flightsim, but I'm>beginning to wonder if the Time Of Day variable is working in>FS9.>I tried the gauge code you posted with the same results, the>beacon lights stayed on at all times. Your string data was>displayed, just no automatic light switching based on time of>day.I watched the string reporting the expected value at various times during the day. In fact, using the on panel clock, I stepped through an entire 24 hour cycle and the value changed at the appropriate times!So, the variable is DEFINITELY return the correct values!I'm at a loss to explain why it isn't working...I use the same XML "Time of Day" variable in the model's embedded code, and it works perfectly!

Share this post


Link to post
Share on other sites

I'm about to give up on this for the time being, I just tried your autoswitch again and now the lights are off at all times!!!!When it starts to get this weird I know its time to quit for a while.BTW, I'm only seeing values of 1 and 3 for your first string, 1 for day, and 3 for dawn, dusk and night. Is this correct, of may I assume it should be 1=Day, 2=dawn/dusk and 3=night per the sdk?Robert

Share this post


Link to post
Share on other sites

>I'm about to give up on this for the time being, I just tried>your autoswitch again and now the lights are off at all>times!!!!>>When it starts to get this weird I know its time to quit for a>while.>>BTW, I'm only seeing values of 1 and 3 for your first string,>1 for day, and 3 for dawn, dusk and night. Is this correct, of>may I assume it should be 1=Day, 2=dawn/dusk and 3=night per>the sdk?I'm about at the same point, myself. I *know* the "old" sun-angle/time/lat/lon code works (mostly), so I'll probably just go with that for the time being... Stepping through the day, hour by hour, I've seen the returned value change from 3 (night), to 0 (??), to 2 (dawn), to 1 (day), to 2 (dusk), and finally, back to 3 (night).Where the heck the ZERO came from is anyone's guess! Nevertheless, all I'm needing is ANY VALUE LESS THAN 3... which it certainld DOES do!That's the reason for the two "string" displays: that way I can see the Time of Day value as well as the Beacon Lights variable (which is the bus I want to use)...

Share this post


Link to post
Share on other sites

Well I found out why the beacon lights were suddenly inop. As a test, I had changed the K events TOGGLE_BEACON_LIGHTS to PANEL_LIGHTS_ON and PANEL_LIGHTS_OFF!Changed it back, and as you would expect everything returned to the original state, beacon lights on all the time. I'm still seeing only 1 and 3 in the first string, and I didn't mess with the strings so that's probably not the result of me meddling with it. Haven't seen a zero Bill, that's REALLY weird!As I mentioned before, I can turn the panel lights on/off with many other variables, but all of those are about as useful as a sledgehammer is to a watchmaker. I don't have a pressing need for the panel lights to illuminate on touchdown or at a specific power setting.I'm through for today, when you can't remember what you did 20 minutes ago you've had enough XML fun!!Take care,Robert

Share this post


Link to post
Share on other sites

Hi Bill,Dawn=0Day=1Dusk=2Night=3So the code you want:(E:Time of Day, enum) 3 ==if{ (A:Light Beacon, bool) if{ (>K:TOGGLE_BEACON_LIGHTS) } }els{ (A:Light Beacon, bool) ! if{ (>K:TOGGLE_BEACON_LIGHTS) } }I did some testing, but the TimeOfDay variable is only properly "synchronised" with setting in menu Time setting in the WINTER (januari) season.Set the Season to WINTER.Now select a DAWN time and observe FS. The variable is 0, and it is actually getting lighter. And when is is fully light, the variable goes to 1 (and if you check the menu Time FS says DAY).Now do this in SUMMER.Now the variable is NOT synchronised with the menu Time anymore; FS might say: DUSK (and the scenery IS dusk), but the variable allready is 3.I can;t conclude anything else than that this is a bug (or it works in another misterious way I can't understand yet :-) But if I set date to Januari it works as expected (and defined above); in other season the value of TimeOfDay is simply not correctly synchronised with what FS says in the menu WOrld-TimeAndSeaon ....E.g. in August the TimeofDay variable goes from 1 (day) to 2(dusk) about 55 min. BEFORE the menu World-TimeAndSeason says it becomes dusk.Maybe a summertime/wintertime (daylight saving) bug ??Looks like it :-)Cheers, Rob

Share this post


Link to post
Share on other sites

>Hi Bill,>>Dawn=0>Day=1>Dusk=2>Night=3In that case, the Panel SDK is in error:TIME OF DAY General time of day (enum: 1=Day, 2=Dusk/Dawn, 3=Night)If they cannot even get the SDK correct, there's no great hope that the code is accurate either... :(Thanks. In that case, I may as well use the original code that takes into account the lat/lon, season, time of day, sun-angle, etc..I can't very well tell a paying customer that they can only fly in January! :)

Share this post


Link to post
Share on other sites

Bill,I added some more to my previous post:""But if I set date to Januari it works as expected (anddefined above); in other season the value of TimeOfDay issimply not correctly synchronised with what FS says in themenu WOrld-TimeAndSeaon ....E.g. in August the TimeofDay variable goes from 1 (day) to2(dusk) about 55 min. BEFORE the menu World-TimeAndSeasonsays it becomes dusk.Maybe a summertime/wintertime (daylight saving) bug ??Looks like it :-)""Cheers, Rob

Share this post


Link to post
Share on other sites

Did some more testing..No, Not a Daylight Saving bug :-)What I did: Start out at the end of DAY and observe when the TimeOfDay variable goes from 1 to 2 (from Day to Dusk).Date in FS:1 jan 2004: Perfect sync.1 febr 2004: change is 30 min too late1 march 2004: change is 1 hr. 8 min too late1 april 2004: change is 1 hr. 12 min too late1 may 2004: change is 25 min too EARLY 1 june 2004: change is 1 hr. 38 min too EARLY.Bug or not :-) ???Cheers, Rob

Share this post


Link to post
Share on other sites

Well, the SDK did say "general time of day," which implies that it is "sort of accurate," but "not precisely..." :)I'd still call it a bug! :)

Share this post


Link to post
Share on other sites

Ah I see, if it seems too good to be true, it probably is! :-roll Nice detective work, thanks Rob. January is not my favorite time of year FS scenery-wise, so I guess I'll do without this one and either live with the shadowy cockpit or turn the darned lights on myself!Winter Wonderland, Winter Wonderland, Winter Wonderland, Winter Wonderland...Robert:D

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