Results 1 to 8 of 8

Thread: XML code question

  1. #1
    Join Date
    Apr 2010
    Location
    Edmond, Oklahoma USA
    Posts
    68

    Default XML code question

    I want to initialize the NAV and Panel lights to "off" when I load a Cessna in FSX. Both lights are controlled by the same switch. I also need to cut the throttle.

    In the FSX SDK, I found an EventID to turn off the panel lights. But I could only find a "toggle" command for the Nav lights. Sooo, I thought I could simply test to see if the Nav lights were on, and if they were then toggle them.

    Well, the throttle cuts, and the panel lights turn off. But not the Nav lights.

    Evidently I've not coded this right, as it doesn't work. I'm out of ideas, can someone please help?
    Here's my initialization code:


    Code:
     <Update>
       (L:AircraftInitialize,bool) 0 == if{
    	(>K:PANEL_Lights_Off)
    	(A:LIGHT_NAV_On,bool) 1 == if{ (>K:TOGGLE_NAV_LIGHTS) }
    	(>K:THROTTLE_CUT)
    	1 (>L:AircraftInitialize,bool) } 
       </Update>
    Thank you for considering my problem. Bob

  2. #2
    Join Date
    Jan 2007
    Location
    Imlay City, Michigan
    Posts
    8,278

    Default

    Try this:

    Code:
    <Update>
    (L:AircraftInitialize,bool) !  if{
         (>K:PANEL_Lights_Off)
         (A:LIGHT NAV,bool)  if{ (>K:TOGGLE_NAV_LIGHTS) }
         (>K:THROTTLE_CUT)
      1 (>L:AircraftInitialize,bool) } 
    </Update>

    I couldn't find "LIGHT_NAV_On" in the SDK variables.

    Save a little typing, for boolean entities you don't need to use X ==. "0 ==" is the same as !(not), and "1 ==" requires nothing after the closing parenthesis...Don
    Last edited by fxsttcb; 02-22-2012 at 07:34 AM.
    HAF 932 Adv, PC P&C 950w, ASUS R4E, i7-3820 5.0GHz(MCR320-XP 6 fans wet), HD 7970
    64GB Vengeance @ 1666MHz, 128GB SAMSUNG 830(Win 7 Ult x64), 512GB SAMSUNG 840 Pro(FSX P3D FS9)
    WD 1TB Black(FS98, CFS2&3, ROF, etc.), WD 2TB Black-(Storage/Backup)

  3. #3
    Join Date
    Apr 2010
    Location
    Edmond, Oklahoma USA
    Posts
    68

    Default

    Thank you for the fix, the tip and the explanation.
    I LIKE your explanation, and the code is nice and simple.
    Thank you much, Don, and happy Weds.
    Bob

  4. #4
    Join Date
    Apr 2010
    Location
    Edmond, Oklahoma USA
    Posts
    68

    Default

    Don, I tried your code and it worked like a charm. I knew it would.
    I found "Light_Nav_On" in "Token Variables" located in the SimObjectCreation folder of the SDK. I really don't know how to use that.
    But, thanks to you, I now know to use, "Event IDs" and "Simulation Variables" instead.
    Cool beans, and mille grazzie. Bob

  5. #5
    Join Date
    Jan 2007
    Location
    Imlay City, Michigan
    Posts
    8,278

    Default

    Benvenuti! I took a gander at the SDK again, and lots of "Token Variables" aren't in the Variables listings. I would think Token Variables should work though. Odd.

    I copied the gauge related sections of the SDK into a spreadsheet so I could add my own usage and examples for the oddities I've found.
    No Token Variables page! That's why I didn't find "LIGHT_NAV_On". I'm adding a page now, for reference.
    Try just changing that in the known good code. It may have been spacing(Important) or another little thing that stopped your original from working.
    If it doesn't work, we'll know to keep a keen eye on the Token Variables we try. I'm learning too...Don
    HAF 932 Adv, PC P&C 950w, ASUS R4E, i7-3820 5.0GHz(MCR320-XP 6 fans wet), HD 7970
    64GB Vengeance @ 1666MHz, 128GB SAMSUNG 830(Win 7 Ult x64), 512GB SAMSUNG 840 Pro(FSX P3D FS9)
    WD 1TB Black(FS98, CFS2&3, ROF, etc.), WD 2TB Black-(Storage/Backup)

  6. #6

    Default

    Quote Originally Posted by fxsttcb View Post
    Benvenuti! I took a gander at the SDK again, and lots of "Token Variables" aren't in the Variables listings. I would think Token Variables should work though. Odd.
    There's nothing "odd" about it. The "Token Variables" list in the FSX SDK is a list of C type variables. It has nothing at all to do with XML variables...

    XML variable entries are found in the Core Utilities Kit/Variables/Simulation Variables list.
    XML commands are found in the Core Utilities Kit/Variables/Event IDs list. In this document the left column are the C commands, center column are the XML K: commands, right column is the description.
    Last edited by n4gix; 02-24-2012 at 11:46 AM.
    Bill Leaming
    Gauge Programming - 3d Modeling Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  7. #7
    Join Date
    Jan 2007
    Location
    Imlay City, Michigan
    Posts
    8,278

    Default

    Goodness! I guess it would have behooved us to read the first line on the SDK "Token Variables" page! Instant understanding...Don
    HAF 932 Adv, PC P&C 950w, ASUS R4E, i7-3820 5.0GHz(MCR320-XP 6 fans wet), HD 7970
    64GB Vengeance @ 1666MHz, 128GB SAMSUNG 830(Win 7 Ult x64), 512GB SAMSUNG 840 Pro(FSX P3D FS9)
    WD 1TB Black(FS98, CFS2&3, ROF, etc.), WD 2TB Black-(Storage/Backup)

  8. #8
    Join Date
    Apr 2010
    Location
    Edmond, Oklahoma USA
    Posts
    68

    Default

    Bill, thank you so much for explaining what Microsoft did not.

    I recall, too, from another thread where you explained that variables are what the simulator sends to the gauge, and key commands are what the gauge sends to the sim.

    All your tips, Don's too, help me sort through the obscure (to a novice) nomenclature. Cool beans.

Similar Threads

  1. Code Samples: XML Decode Macros
    By Admin in forum Main
    Replies: 0
    Last Post: 08-15-2009, 03:50 PM
  2. Replies: 0
    Last Post: 01-30-2009, 06:19 PM
  3. XML: Macros-Set Transponder Code
    By Admin in forum Main
    Replies: 0
    Last Post: 09-16-2008, 03:32 PM
  4. XML code help
    By tintin in forum Panel & Gauge Design
    Replies: 1
    Last Post: 02-19-2007, 10:56 AM
  5. Anti Piracy Gauge Code Question
    By kennez in forum DreamFleet General Discussion Forum
    Replies: 2
    Last Post: 06-26-2003, 12:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •