Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20

Thread: XML 3 position switch

  1. #1

    Default RE: XML 3 position switch

    First, you will need a variable for your switch, such as L:OMISens,enum
    This switch will have three positions: 0 - 1 - 2

    Since the normal position will be LO, therefore a value of 1, you will need to initialize your variable to a value of 1, rather than the default value of 0:

    <Update>

    (L:Init,bool) 0 == if{
    1 (>L:OMISens,enum)
    1 (>L:Init,bool) }
    </Update>

    Next, you will need to code your <Element> section to display the bitmaps based on the "case" model.

    Finally, you will need to code two mouse rectangles:

    1. To swap the value of your L:OMISens,enum variable between 1 and 2

    2. A mouse rectangle that will use the mouse left click event to set your L:OMISens,enum variable to 0, and will reset the value to 1 on the mouse release event.
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - 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...

  2. #2

    Default RE: XML 3 position switch

    In your update section where would the L:Init be placed :EDIT:"would the L:Init be placed under the <Select> as another <Value>"?would the code need to look something like this? I am new to XML so pardon my lack of knowledge. Thank you very much for your help.
    <Element>
    <Position X="X" Y="Y"/>
    <Select>
    <Value>(L:OMISens,enum)
    <Case Value="0">
    <Image Name="Switch_up.bmp" Bright="No"/>
    </Case>
    <Case Value="1">
    <Image Name="Switch_Mid.bmp" Bright="No"/>
    </Case>
    <Case Value="2">
    <Image Name="Switch_down.bmp" Bright="No/>
    </Case>
    <Update>

    (L:Init,bool) 0 == if{
    1 (>L:OMISens,enum)
    1 (>L:Init,bool) }
    </Update>
    </Select>
    </Element>

  3. #3

    Default RE: XML 3 position switch

    re reading the code I made, should the Test (down) position have the case value 0 or is it fine as a 2? Also is it possible to make the test position light the marker beacon lights? Thank you again for your help. Just in case your wondering, here is the KMA 26 that I am trying to reproduce. http://us.st11.yimg.com/us.st.yimg.c..._1971_15000774

  4. #4

    Default RE: XML 3 position switch

    >In your update section where would the L:Init be placed
    >:EDIT:"would the L:Init be placed under the
    ><Select> as another <Value>"?would the code
    >need to look something like this? I am new to XML so pardon my
    >lack of knowledge. Thank you very much for your help.

    XML script will execute sequentially from the first line, meaning that everything must be structured so that what happens first - comes first... :)

    In the case of drawn bitmap <Element> sections, you need to "layer" them from the bottom to the top.

    In this case, the <Update> section is only run once, so for practical purposes it really doesn't make a lot of difference, but it's always best to remain consistent when writing code - or in this case a script. Now there's a subtle distinction!

    <Update>

    (L:Init,bool) 0 == if{
    1 (>L:OMISens,enum)
    1 (>L:Init,bool) }
    </Update>

    <Element>
    <Position X="X" Y="Y"/>
    <Select>
    <Value>(L:OMISens,enum)
    <Case Value="0">
    <Image Name="Switch_up.bmp" Bright="No"/>
    </Case>
    <Case Value="1">
    <Image Name="Switch_Mid.bmp" Bright="No"/>
    </Case>
    <Case Value="2">
    <Image Name="Switch_down.bmp" Bright="No/>
    </Case>
    </Select>
    </Element>

    You have the <Case....> structured just fine!
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - 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...

  5. #5

    Default RE: XML 3 position switch

    >re reading the code I made, should the Test (down) position
    >have the case value 0 or is it fine as a 2? Also is it
    >possible to make the test position light the marker beacon
    >lights? Thank you again for your help. Just in case your
    >wondering, here is the KMA 26 that I am trying to reproduce.
    >http://us.st11.yimg.com/us.st.yimg.c..._1971_15000774

    The order of the <Case> makes no real difference, as long as YOU remember which is which... ;)

    Yes, I've programmed that same KMA26 in both C and XML myself.

    Yes, you can easily add a condition that will allow the OMI lights to illuminate if the switch is in the test position.

    In pseudo code:

    if ((outer marker valid) OR (test valid)) show lighted bitmap
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - 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...

  6. #6

    Default RE: XML 3 position switch

    Thank you very much for your generous help. I am moving on to the OMI switch now and then on to the com selector knob. For the 2 areas, what should they look like becuase the only ones Ive dealt with look like
    <Area Left="X" Right="X1" Top="Y" Bottom="Y1">
    <Click Event="COM2_TRANSMIT_SELECT"/>
    <Cursor Type="Hand"/>
    </Area>
    So somewhere in the button code would have to be a:
    <Click>
    <Click Kind="LeftSingle+Leave"/>
    for the test position.
    so maybe
    <Area Left="X" Right="X1" Top="Y" Bottom="Y1">
    <Click Kind="LeftSingle+Leave">(L:OMISens)'LeftSingle' (L:Init)'Leave'
    <Cursor Type="Hand"/>
    </Area>
    Im not sure what would go after (L:OMISens) in the click kind.
    For the Test light illumination
    if((L:OMIsens )) ==2
    <Image Name="OMI_Tst.bmp" Bright="Yes"/>
    Im not sure about the formatting for the whole if then for the image display.
    and i am using indentation but the forum wont show it. Thank you again.
    EDIT:I will also need help to make a functional marker mute button. i think that would involve forcing a <Element>
    <Position X="X" Y="Y"/>
    <Select>
    <Value>(A:MARKER SOUND,bool)</Value>
    <Case Value="1">
    <Image Name="Marker_on.bmp" Bright="Yes"/>
    </Case>
    </Select>
    </Element>
    case value from 1 to 0 because the mkr ident still has to be on but the mute button just stops the beeping for that instance.

  7. #7

    Default RE: XML 3 position switch

    For the lower mouse rectangle (SENS) you would want to use the M:Event scheme:


    <Click Kind="LeftSingle+Leave">
    (M:Event) 'LeftSingle' scmp 0 ==
    2 (>L:OMISens,enum }
    (M:Event) 'Leave' scmp 0 ==
    0 (>L:OMISens,enum }
    </Click>

    This will set the value of L:OMISens,enum = 2 whenever the left mouse button is held down, then reset the value of L:OMISens,enum = 0 whenever the mouse button is released (Leave). :)

    BTW, to preserve the line indents, put a check mark in the "Message Format" line in the editor to save as "plain text."

    As for the "marker sound," unfortunately there is only one command for it: K:MARKER_SOUND_TOGGLE

    Click once to turn it on, click again to turn it off...

    ...so, in order to keep the MKR button illuminated, you will need to use a custom variable flag to control the MKR button's light:

    For the MKR button -

    (L:MKR_ButtonLight,bool) !
    if{
    (>K:MARKER_SOUND_TOGGLE)
    1 (>L:MKR_ButtonLight,bool)
    }
    els{
    (>K:MARKER_SOUND_TOGGLE)
    0 (>L:MKR_ButtonLight,bool)
    }

    For the MUTE button -

    (L:MKR_ButtonLight,bool)
    if{
    (L:MUTE_ButtonLight,bool) !
    if{
    (>K:MARKER_SOUND_TOGGLE)
    1 (>L:MUTE_ButtonLight,bool)
    }
    els{
    (>K:MARKER_SOUND_TOGGLE)
    0 (>L:MUTE_ButtonLight,bool)
    }
    }

    I haven't tested the above, but - if my logic is right - the MUTE button won't do anything at all UNLESS the MKR button is lighted.
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - 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...

  8. #8

    Default RE: XML 3 position switch

    Thank you so much! I just got home after being evacuated due to the Socal Fires. All is well, safe and sound. Just a couple questions.

    1) what is scmp
    2) for (M:Event) do i need to put anything in place of "event"

  9. #9

    Default RE: XML 3 position switch

    Also, do i need to make a new element for these variables? after being away for 4 days I lost my train of thought. T
    Here is what i just put in
    <Element>
    <Position X="X" Y="Y"/>
    <Select>
    <Value>(L:MKR_buttonLight,bool) !
    if{
    (>K:MARKER_SOUND_TOGGLE)
    1 (L:MKR_ButtonLight,bool)
    }
    els{
    (>K:MARKER_SOUND_TOGGLE)
    0 (>L:MKR_ButtonLight,bool)
    }
    </Value>
    </Select>
    </Element>
    <Element>
    <Position X="X" Y="Y"/>
    <Select>
    <Value>(L:MKR_ButtonLight,bool)
    if{
    (L:MUTE_ButtonLight,bool) !
    if{
    (>K:MARKER_SOUND_TOGGLE)
    1 (>L:MUTE_ButtonLight,bool)
    }
    els{
    (>K:MARKER_SOUND_TOGGLE)
    0 (>L:MUTE_Button_Light,bool)
    }
    }
    </Select>
    </Element>
    hen with the Click spot all I have to do is
    plug in
    <Area Left="X" Right="X1" Top="Y" Botton="Y1"/>
    <Click Event="MARKER_SOUND_TOGGLE/>
    <Cursor Type="Hand"/>
    </Area>
    Like I said, I lost my train of thought so im a bit in the dark again.

  10. #10

    Default RE: XML 3 position switch

    >Thank you so much! I just got home after being evacuated due
    >to the Socal Fires. All is well, safe and sound. Just a couple
    >questions.
    >
    >1) what is scmp
    >2) for (M:Event) do i need to put anything in place of
    >"event"

    1) It's a "compare operator". In essence, it is saying:

    "If the Mouse:Event equals "LeftSingle" then Set L:OMISens = 2"
    "If the Mouse:Event equals "Release (Leave)" then Set L:OMISens = 0"

    2) You use it precisely as I wrote it:

    <Click Kind="LeftSingle+Leave">
    (M:Event) 'LeftSingle' scmp 0 ==
    2 (>L:OMISens,enum }
    (M:Event) 'Leave' scmp 0 ==
    0 (>L:OMISens,enum }
    </Click>
    Bill Leaming
    Gauge Programming - 3d Modeling Eaglesoft & Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - GeForce GTX550Ti 1GB - 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...

Similar Threads

  1. VOR position
    By jp_langer in forum Panel & Gauge Design
    Replies: 8
    Last Post: 08-19-2007, 04:33 AM
  2. Wet and in position
    By pilatus96 in forum MSFS Screen Shot Forum
    Replies: 7
    Last Post: 01-27-2006, 08:58 AM
  3. Master Switch - Avionics Switch
    By Sunny9850 in forum FS2004
    Replies: 4
    Last Post: 03-06-2004, 11:09 AM
  4. Replies: 0
    Last Post: 09-11-2003, 09:42 PM
  5. Position
    By Fitzwilliam in forum FS2002
    Replies: 4
    Last Post: 02-05-2003, 08:16 AM

Posting Permissions

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