• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

XML Airspeed bug mouse functions

Messages
24
Country
us-pennsylvania
Hi

I have made an airspeed guage that seems to be set and funtioning correctly. I have also included 3 speed marking bugs which seem to be positioned and set properly around the airspeed guage circumfrence. However, I would like to somehow move, grab and set the speed marking bugs with the computer mouse but do not know how. If possible, I would appreciate it, if someone can please give an example XML mouse code that will allow to do what I have indicated above with the bugs. The partcial airspeed code for the speed marking bug is as the following:

Code:
<Element id="Element_BugOneWide">
                <FloatPosition>123.000,118.000</FloatPosition>
                <Select id="Select_BugOneWide">
                    <Expression id="Expression">
                        <Minimum>0.000</Minimum>
                        <Maximum>2.000</Maximum>
                        <Script>(L:L_BACKLIGHT_ON,bool)</Script>
                    </Expression>
                    <Case id="Case_0">
                        <ExpressionResult>0.000</ExpressionResult>
                        <Image id="MD83IasMarkBugOne.bmp" Name="MD83IasMarkBugOne.bmp">
                            <Transparent>True</Transparent>
                            <Axis>8.000,114.000</Axis>
                            <Bright>True</Bright>
                        </Image>
                    </Case>
                    <Case id="Case_1">
                        <ExpressionResult>1.000</ExpressionResult>
                        <Image id="MD83IasMarkBugOneWideBlank.bmp" Name="MD83IasMarkBugOneWideBlank.bmp">
                            <Transparent>True</Transparent>
                            <Axis>8.000,120.000</Axis>
                            <Luminous>True</Luminous>
                        </Image>
                    </Case>
                    <Case id="Case_2">
                        <ExpressionResult>2.000</ExpressionResult>
                        <Image id="MD83IasMarkBugOne.bmp" Name="MD83IasMarkBugOne.bmp">
                            <Transparent>True</Transparent>
                            <Axis>8.000,120.000</Axis>
                            <Bright>True</Bright>
                        </Image>
                    </Case>
                </Select>
                <Rotation id="Rotation_BugOneWide">
                    <PointsTo>NORTH</PointsTo>
                    <Expression id="Expression">
                        <Minimum>0.000</Minimum>
                        <Maximum>450.000</Maximum>
                        <Script>(L:BUG_ONE_WIDE_POS, position) 4 *</Script>
                    </Expression>
                    <FailureTable id="FailureTable">
                        <Failure id="Failure">
                            <Fail_Key>GAUGE_AIRSPEED</Fail_Key>
                            <Fail_Action>Freeze</Fail_Action>
                        </Failure>
                    </FailureTable>
                    <Delay id="Delay">
                        <DelayValue>90.000</DelayValue>
                    </Delay>
                    <NonlinearityTable id="NonlinearityTable_BugOneWide">
                        <NonlinearityEntry id="NonlinearityEntry_0">
                            <ExpressionResult>0.000</ExpressionResult>
                            <FloatPosition>113.000,23.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_60">
                            <ExpressionResult>60.000</ExpressionResult>
                            <FloatPosition>139.000,25.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_80">
                            <ExpressionResult>80.000</ExpressionResult>
                            <FloatPosition>158.000,31.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_100">
                            <ExpressionResult>100.000</ExpressionResult>
                            <FloatPosition>194.000,54.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_120">
                            <ExpressionResult>120.000</ExpressionResult>
                            <FloatPosition>216.000,89.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_140">
                            <ExpressionResult>140.000</ExpressionResult>
                            <FloatPosition>220.000,129.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_160">
                            <ExpressionResult>160.000</ExpressionResult>
                            <FloatPosition>205.000,167.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_180">
                            <ExpressionResult>180.000</ExpressionResult>
                            <FloatPosition>176.000,194.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_200">
                            <ExpressionResult>200.000</ExpressionResult>
                            <FloatPosition>138.000,208.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_220">
                            <ExpressionResult>220.000</ExpressionResult>
                            <FloatPosition>97.000,205.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_240">
                            <ExpressionResult>240.000</ExpressionResult>
                            <FloatPosition>61.000,185.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_250">
                            <ExpressionResult>250.000</ExpressionResult>
                            <FloatPosition>46.000,169.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_300">
                            <ExpressionResult>300.000</ExpressionResult>
                            <FloatPosition>31.000,141.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_350">
                            <ExpressionResult>350.000</ExpressionResult>
                            <FloatPosition>28.000,108.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_400">
                            <ExpressionResult>400.000</ExpressionResult>
                            <FloatPosition>36.000,77.000</FloatPosition>
                        </NonlinearityEntry>
                        <NonlinearityEntry id="NonlinearityEntry_450">
                            <ExpressionResult>450.000</ExpressionResult>
                            <FloatPosition>54.000,51.000</FloatPosition>
                        </NonlinearityEntry>
                    </NonlinearityTable>
                </Rotation>
            </Element>
            <Element id="Element_BugTwo">
                            <Element id="Element_BugThree">

I have a general idea of what the mouse code should resemble, but just do not know what to put into the blanks in according to the bugs that I have.
First speed marking bug:

<MouseArea id="MouseArea">
<FloatPosition> ? </FloatPosition>
<Size> ? </Size>
<MouseArea id="MouseArea_BugOneWide">
<FloatPosition> ? </FloatPosition>
<Size> ? </Size>
<CursorType> ? </CursorType>
<Tooltip id="Tooltip">
<MetricId>TOOLTIPTEXT_AIRSPEED_KNOTS</MetricId>
<EnglishId>TOOLTIPTEXT_AIRSPEED_KNOTS</EnglishId>
<DefaultScript>% ? %</DefaultScript>
</Tooltip>
<MouseClick id="MouseClick">
<Script> ? </Script>
<ClickType> ? </ClickType>
<ClickRepeat>True</ClickRepeat>
</MouseClick>
</MouseArea>
</MouseArea>

Recency
 
Last edited:
Thanks IGrant. I have your advice implemented and working.
Code:
        <MouseArea id="MouseArea">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>250,240</Size>
            <MouseArea id="MouseArea_BugOneWide">
                <FloatPosition>113.000,23.000</FloatPosition>
                <Size>15,24</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script> (M:Event) &apos;LeftSingle&apos; scmp 0 == if{ (L:BUG_ONE_WIDE_POS, position) 1 +  (&gt;L:BUG_ONE_WIDE_POS, position) }
 (M:Event) &apos;RightSingle&apos; scmp 0 == if{ (L:BUG_ONE_WIDE_POS, position) 1 -  (&gt;L:BUG_ONE_WIDE_POS, position) }
</Script>
                    <ClickType>LeftSingle+LeftDrag+LeftRelease+RightSingle+RighttDrag+RightRelease</ClickType>
                    <ClickRepeat>True</ClickRepeat>
                </MouseClick>
                <Tooltip id="Tooltip">
                    <DefaultId>%((L:BUG_ONE_WIDE_POS, position))%!d!</DefaultId>
                    <DefaultScript>%((L:BUG_ONE_WIDE_POS, position))%!d!</DefaultScript>
                </Tooltip>
            </MouseArea>
        </MouseArea>

However, I have a New Problem.
Whenever, I move and release the speedBugMarking, I have to position the mouse hand back to the prior float and size postion where the original speedBugMarking started although the speedBugMarking is actually in another position or location from being moved.
So, it seems that I need to SomeHow change the size or float postion after I move and release the speedBugMarking.

But HOW is the question?

I think the script should start out like the following:
(M:Event) 'RightRelease' scmp 0 == if{ }

But what kind of script could or should I insert in to the curly brackets so that the size and float postion change along with movement of speedBugMarking?

Please any help would be surley appreciated.

Recency.
 
I work with FS9 schema almost exclusively so I am not entirely familiar with FSX schema but I *think* there is a 'left script' and a 'top script' which will allow you to dynamically change the location of items or objects which may or may not include click spots. I am not sure if anyone has handled bug settings like this before. Typically you will see one static click spot and a corresponding bug that moves in response to input at that click spot. For example: If one had three white bugs, there might be three areas arranged across the very top of the gauge, left right and center, each controlling its own bug via +/- clicks or the mouse wheel. If you are really set on using the click and drag method, you might experiment with the moving mouse area via the left and top script or possibly making the entire gauge a mouse area and using different kinds of clicks to move the different bugs such as left click for one and right click for another, though that is some what unconventional and may prove confusing. Perhaps some one more familiar with FSX XML can step in here with better advice on the left and top scripts and their limitations. Best of luck either way, I really wish I had more to give you on this.
 
Hi IGrant:
First, Thank You for responding. For now, I have set tipical static click spots for the speed marking bugs. I do know how to create scripts for knobs with the -/+, so I may do that instead.

I know its possible to code an "action script" that will change the x and y cordinates with the mouse. But using this code with fsx's script would seem not to work.

Nonetheless, I am happy with what I have.

So again, many, many thanks.

Recency
 
Back
Top