Jump to content

Can Someone help - gauge for FSX


sticks

Recommended Posts

Hi all, I struggle with xml (that will be obvious shortly).

 

I thought I had a simple problem to solve. I have a variable number working rolling down from 10 to -10 in floating format for display and I would like to set it to zero the moment 0.050 is reached and beyond.

 

I wrote this:

 

(L:DP,number) 0.050 L: DP,number) }

 

Pretty simplistic but well beyond me to achieve an outcome of a constant 0.000 after the count down 0.050 is reached, negative values and all.

 

That statement does not bomb out the xml but the "less than" is not activating as the negative numbers continue to show in debugging.

 

If anyone could help I would delighted.

 

Thanks

Link to comment
Share on other sites

I find it hard to follow what you are trying to do. So I'm just thinking out loud. I will take out the comma's to make it easyer for me to write.

 

I'm thinking. If you want something to display zero when X smaller then 5, you can't make the display show X.

 

The display will have to show Y. And you must make Y display value of X, unless X is smaller then 5, at which time Y must show zero instead.

 

-----

another way is to use only one variable, and to make it round down. So, X lower then 5 output becomes zero.

Problem there is if X is lower then 10, output becomes 5. Etc.

 

----

I hope that made sense. There may well be other (better) solutions. (i'm still a beginner with xml myself.)

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

That first option I mentioned. What I mean in semi-code is:

 

x = calculation. With value as result.

(just like it is now.)

 

IF X larger then 5 then Y=X

ELSE

Y=zero

 

Y is the output you then continue working with. And use as input in your:

"If y=zero, then do what I want", step.

[sIGPIC][/sIGPIC]
Link to comment
Share on other sites

  • 1 month later...
I'm pretty darn new at gauge programming, but I'm wondering if the problem is as simple as your L: DP variable being "replaced" by your countdown code soon after you set it to zero (you said it was counting down from 10 to -10). Perhaps you need a different variable to actually set and display the value you want shown, and leave your L: DP variable to continue its countdown?

FSX Acceleration with FreeMeshX, SceneryTech, FTX Global Base + Vector, FTX AUS NZNI NZSI

Dell Precision M4400 laptop (Intel Core2Duo @ 3GHz; 4GB RAM; nVidia FX770M)

Saitek AV8R-01 joystick; 64-bit Win7 Ultimate; FSEconomy (as fun as it gets!)

Link to comment
Share on other sites

I use this code,

((L:Target_Distance, number) 1.59 )%{else}%((L:Target_Distance, number))%!4.1f!\{dpl=nm}%{end}%

 

It gives the distance in feet if distance is less than 1.59 nm

or

distance in nm if distance is greater than 1.6 nm .

 

for your case try ,

((L: DP,number)  0.051 >)%{if}%((L: DP,number))%!6.3f!%((L: DP,number)  0.050 L: DP,number))%!06.3f!%{end}%

 

Cheers

Karol

Link to comment
Share on other sites

Did some testing , the following works ,

 

((L: DP,number)  0.051 >)%{if}%((L: DP,number))%!6.3f!%((L: DP,number)  0.050 

 

however it will read , ( .0.000 instead of 0.000 )

 

I was not able to remove the preceding full stop .

 

Cheers

Karol

Link to comment
Share on other sites

Hi,

 

Try %{else} 0.000 (remove the extra % and the period). You do not use a % when you are going to display a static number.

 

Hi Tom

 

Thanks for that one .

It solves a problem that I've had for a few years .

 

Cheers

Karol

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...