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

FSX Adding Tooltips and variables

This animation is only place where L:Binoculars Open exists and as you can see there is only one (>L:Binoculars Open, bool) in there.
 
It worked (kind of):
"
<Animation name="Vanship_Binoculars" guid="bd6edd22-18fd-4b78-cdcd-8dd58c494af1" type="Sim" typeParam="AutoPlay" length="200" typeParam2="Vanship_Binoculars" />

<PartInfo>
<Name>Vanship_Binoculars</Name>
<AnimLength>200</AnimLength>
<Animation>
<Parameter>
<Code>(L:Binoculars Open, bool) 200 *</Code>
</Parameter>
<Lag>50</Lag>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Binoculars are %((L:Binoculars Open, bool))%{if}unfolded%{else}folded%{end}</TooltipText>
<CallbackCode>(L:Binoculars Open, bool) ! (>L:Binoculars Open, bool)
</CallbackCode>
</MouseRect>
</PartInfo>
"
I don't know what was the problem, but when I returned <Code>(L:Binoculars Open, bool) 200 *</Code>

But now there's no animation - the <lag> toes nothing, change in animation is instant.
Any ideas on that?
 
Reduce the animation length to 100 keyframes or less (20?) and adapt the code accordingly. Maybe FSX doesn't like such long animations.
 
200 keyframes is nothing. I often use 360 for some situations.
 
But now there's no animation - the <lag> toes nothing, change in animation is instant.
Any ideas on that?
Your <Lag> is in the wrong position. It must come immediately after the </Code> tag:
Code:
<Animation>
    <Parameter>
       <Code>(L:Binoculars Open, bool) 200 *</Code>
       <Lag>50</Lag>
    </Parameter>
</Animation>
And for pity's sake, please use the Code tags to make it easier to read!
 
OMG It's working!

Thanks all of you for your support!

I'm reposting a working version of my animation:
Code:
<Animation name="Vanship_Binoculars" guid="bd6edd22-18fd-4b78-cdcd-8dd58c494af1" type="Sim" typeParam="AutoPlay" length="200" typeParam2="Vanship_Binoculars" />

<PartInfo>
    <Name>Vanship_Binoculars</Name>
    <AnimLength>200</AnimLength>
    <Animation>
        <Parameter>
            <Code>(L:Binoculars Open, bool) 200 *</Code>
            <Lag>50</Lag>
        </Parameter>
    </Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>Binoculars are %((L:Binoculars Open, bool))%{if}unfolded%{else}folded%{end}</TooltipText>
        <CallbackCode>(L:Binoculars Open, bool) ! (>L:Binoculars Open, bool)
        </CallbackCode>
    </MouseRect>
</PartInfo>

Edit: sorry for that code boxes
 
Last edited:
Hooray! Unfortunately you still did NOT use the Code Box. Open the Code Box and copy/paste your XML script in the box. This will preserve the formatting and also separate it from the rest of the message.

mlQOr.png
 
(In my defense, I've created the original code from the top of my head, so the misplaced <Lag> tag was not due to fundamental incompetence.)
 
Don't worry about that.
You tried to help and eventually it worked.

Now I suppose last part of my original question:

How to create an event for a custom variable (one that is used in <EventID>)?

To be more precise I want to create lever, that would not simply have bool variable (open/close), but procent one, that I would be able to use to set any value in it's range (like throttle lever, but with custom variable).
 
Hex events can only be used in C++ gauges as far as I know.
 
No you can still use L vars. You have to use a bit of a different script though in your CallbackCode section.

Code:
<MouseFlags>LeftDrag+LeftSingle</MouseFlags>
<CallbackCode>
(M:Event) &apos;LeftSingle&apos;  scmi 0 == if{ (M:X) (&gt;L:ClickStart)  }
(M:Event) &apos;LeftDrag&apos;    scmi 0 == if{ (M:X) (L:ClickStart) - 0.1 * 0 max 100 min (&gt;L:LeverPosition, enum) }
</CallbackCode>
 
To make sure I understand basics:
The variable's name here is "LeverPosition" and its unit is enum - one of miscellaneous units.
0 max and 100 min are start and end of variable's range.
First line after <CallbackCode> is responsible for single click (not dragging) and the second line is responsible for dragging.

Is that correct thinking?
 
To make sure I understand basics:
The variable's name here is "LeverPosition" and its unit is enum - one of miscellaneous units.
0 max and 100 min are start and end of variable's range.
First line after <CallbackCode> is responsible for single click (not dragging) and the second line is responsible for dragging.

Is that correct thinking?
Yes, and the (>L:Clickstart,enum) in the first line is initializing the mouse cursor's current x coordinate value.

The actual "unit name" is pretty much irrelevant in this case. You could use (>L:LeverPosition, percent) instead and it would work the same.
 
... or any other unit form miscellaneous units list.

Any way:
Thanks to anyone who tried to help.
I really glad!
 
Well...
Another question:
Is there a way to assign a keyboard key/mouse/joystick to change a custom variable?

eg.: I have a custom variable, that controls binoculars (look above) when you click on something in virtual cockpit, but I also want to fold/unfold those binoculars by clicking B key on keyboard.
 
Well...
Another question:
Is there a way to assign a keyboard key/mouse/joystick to change a custom variable?

eg.: I have a custom variable, that controls binoculars (look above) when you click on something in virtual cockpit, but I also want to fold/unfold those binoculars by clicking B key on keyboard.

http://www.fsdeveloper.com/wiki/index.php?title=XML:_Key_Traps

Example gauge:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<Gauge Name="Control Spoilers By Key" Version="1.0">
  <Keys>
  <On Key="374">
  <!-- Shift + F7 = extend by increment of 5 -->
  (A:SPOILERS ARMED,bool)
  if{ (>K:SPOILERS_ARM_TOGGLE) }
  (A:SPOILERS HANDLE POSITION,percent) 5 + 100 min 163.83 * (>K:SPOILERS_SET)
  </On>
  </Keys>
</Gauge>


Make sure to find a key combination that is not used by default.
 
Add it to a gauge xml file and put it into a VCockpit section of the panel.cfg file.
 
Back
Top