• 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

Messages
92
Country
poland
Hi!

I wanted to ask is there a way of creating new (custom) tooltips and variables similar to how
an animation can be added to modeldef.xml file?

Thanks for any tips.
 
Sure.

3D model code:
Code:
<MouseRect>
<Cursor>...</Cursor>
<TooltipText>Ejection Seat: %((L:Ejection Seat Arming, bool))%{if}READY!%{else}Locked!</TooltipText>
<CallbackCode>
...
</CallbackCode>
</MouseRect>

2D gauge code FS9 Syntax:
Code:
<Area Left="0" Right="20" Top="0" Bottom="20">
  <Cursor Type="Hand"/>
  <Click Repeat="Yes">
 ...   
  </Click>
  <Tooltip>This is a tooltip</Tooltip>
  </Area>

2D gauge code FSX syntax:
Code:
<MouseArea>
<FloatPosition>0.000,0.000</FloatPosition>
<Size>20,20</Size>
<CursorType>Hand</CursorType>
<MouseClick>
<Script>
...
</Script>
<ClickType>LeftSingle</ClickType>
</MouseClick>
<Tooltip>This is a tooltip</Tooltip>
</MouseArea>
 
Thanks, tooltips are working!

One additional question - Is there a way of settings the initial value for this "Ejection Seat Arming" (or whatever I named my variable).
 
The initial value of any custom variable is always "0". You can set the variable to a certain value though if you use an initialization routine which is executed whenever the aircraft is (re)loaded.

Code:
<Code>
(L:ExecuteOnStartup,bool) !
if{

5561496 (>L:My Custom Variable, number)

1 (>L:ExecuteOnStartup,bool) 
}
</Code>
 
Ok, thank you so much!

Hopefully last question on the subject:
How to create an event for a custom variable (one that is used in <EventID>)?
 
What kind of thing do you want this custom variable to do?
 
Here is everything I want to achieve in connection with that variable:

I have unfolding binoculars on the aircraft I'm creating.
I want to have an animation (200 frames) controlled both by clicking on a lever (jump form 0 % to 100 % and reverse) and be able to pull that lever to set value in the range between 0% and 100%.

I have part of that animation ready:
"
<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, percent) 2 *</Code>
</Parameter>
</Animation>
<MouseRect>
<TooltipText>Binoculars are %((L:Binoculars Open, percent) d 0 ==)%{if}%!d!folded%{else}%(d 100 ==)%{if}%!d!unfolded%{else}unfolding</TooltipText>
</MouseRect>
</PartInfo>
"

As you can see I lack part in <MouseRect> that would actually control the variable movement.
I tried several methods but for now I wasn't able to work it out.
 
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>
</Parameter>
<Lag>50</Lag>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>Binoculars are %((L:Binoculars Open, bool))%{if}unfolded%{else}folded</TooltipText>
<CallbackCode>
(L:Binoculars Open, bool) ! (>L:Binoculars Open, bool)
</CallbackCode>
</MouseRect>
</PartInfo>

"Lag" determines animation length. Number of keyframes divided by "lag" value = animation length in seconds.

For such a simple thing, a toggle logic for the mouse rectangle is the easiest method to use.
 
Thanks for your help but it doesn't work:

1) All parts connected to that animation stay still when I click, or drag the lever to with I added mouse rect attachpoint tag.
2) The tooltip stays the same: "Binoculars are 0folded" (that 0 is I presume the value of variable).
 
I think the tooltip needs to be:
Code:
<TooltipText>Binoculars are %((L:Binoculars Open, bool))%{if}unfolded%{else}folded%{end}</TooltipText>

but if the object never moves then the tooltip will never change. I don't see anything else obviously wrong. I assume the unfolding works fine in your 3D CAD program. Do you get the hand cursor in the Mouse Rectangle?
 
The 0 is still there.
And the cursor stays the same shape as before (Normal Select: http://www.anicursor.com/allcursors.jpg).

Additional info (I don't know if it's relevant):
I can click that lever not in normal virtual cockpit, but in another cockpit (second seat position). Here is it's code from aircraft.cfg:
"
[CameraDefinition.0]
Title=Tylne siedzenie
Guid={7a91803e-898b-435a-8391-725be6a48203}
Origin=Virtual Cockpit
MomentumEffect=Yes
SnapPbhAdjust=Swivel
SnapPbhReturn=False
PanPbhAdjust=Swivel
PanPbhReturn=False
Track=None
ShowAxis=YES
AllowZoom=TRUE
InitialZoom=.75
SmoothZoomTime=2.0
ZoomPanScalar=1.0
ShowWeather=Yes
XyzAdjust=TRUE
ShowLensFlare=FALSE
Category=Cockpit
PitchPanRate=20
HeadingPanRate=60
InitialXyz=0.0, 0, -1.05
InitialPbh=0, 0, 0
"
 
I haven't tested the code at all, so chances are that it doesn't work. Check it against working code, especially in terms of syntax and make corrections to it if necessary.


I think the tooltip needs to be:
Code:
<TooltipText>Binoculars are %((L:Binoculars Open, bool))%{if}unfolded%{else}folded%{end}</TooltipText>

Not really. You only need the %{end} tag if you have any follow-up strings or multiple if-then-constructs in the tooltip.
 
Well, there's been progress:
First thing that (I thing) was wrong, was parameter type letter. I was using L:Binoculars Open, which would be a local parameter.
I changed it to C: for custom parameter and I have following results:
the cursor now changes to hand over the lever, and the "0" from the tooltip disappeared.

Clicking on it stil does nothing (tooltip stays the same, so it's not animation on 3d model related problem).
 
Are you getting the "Binoculars Open" variable from a C++ gauge? If not, you should stick to "L:".

If you can't click anything from a certain view, check if said view is accidentially stuck in geometry, like a headrest or something. Try moving the view forward or up or left or right and check again if your clickspot works.

You can also try to reset the scale of the part that can't be clicked ("Reset Scale" button in Gmax).
 
Well, there's been progress:
First thing that (I thing) was wrong, was parameter type letter. I was using L:Binoculars Open, which would be a local parameter.
Nope. C: indicates that it is a simulator variable. L: does not mean "local" but are instead "custom XML variables." Local variables are G: type.

I'll allow that the letters and purpose of all three types are not intuitive, and certainly should have been handled better. But then again, programmers are not known to be too "common sense friendly..." :rotfl:
 
Ok, it's not problem with other camera view - I created a switch in main virtual cockpit view the same way and it doesn't work as well.
I tried both with C: and L:, same effect: tooltip is ok, cursor changes the right way but there is no effect when I click (in the tooltip too).
I'm not using Gmax, but Blender and Blender2FSX addon, but still I reset scale to 1 on all model parts - no effect.
Im re posting my code in it's current form:
"
<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>
"

Any other ideas?
 
I'm sure it's not necessary but try adding a space between the * and the < in the line:

<Code>(L:Binoculars Open, bool) 200 *</Code>

to become:

<Code>(L:Binoculars Open, bool) 200 * </Code>
 
I think you should first write:

Code:
<Code>1 (>L:Binoculars Open, bool) 1 200 *</Code>

And check whether "Binoculars are unfolded" tooltip shows.

If it shows, then something related to <CallBackCode> is wrong.

If it doesn't (still "unfolded" word) then check that the part has moved from initial position.

If it has, then problem is in <MouseRect> and below.

It it hasn't then problem is probably in the entire <PartInfo>

Tom

EDIT: C: (Custom) variables are not supported in modelfef file.
 
<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>1 (>L:Binoculars Open, bool) 1 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>

All animations are in open position (switch too), tooltip says unfolded, so it looks like it's <CallBackCode> that is wrong, but I don't know in what way.
Any ideas?
 
Did you check that 0 (>L:Binoculars Open, bool) is not being assigned in other part of your code, or in any other gauge?

Tom
 
Back
Top