Jump to content

Custom Gauge Case Value Help


dehman137

Recommended Posts

Hey Everyone-

 

I'm new to gauge scripting and honestly don't have much of an idea what I'm doing and could use some help. I'm trying to make a basic scroll gauge for a list of images, however I cant seem to get the case value number to work properly. The scrolling works just fine, however it only displays the first two images. After hours of looking on microsofts xml gauge page and skimming through other default script examples from other in game aircraft, I still can't figure out what I'm missing. Can anyone help me out? Here's my script:

 

(L:LAND_ALT:1, bool) 1 > (L:LAND_ALT:1, bool)

(L:LAND_ALT:1, bool) ! (>L:LAND_ALT:1, bool) Repeat="Yes

(L:LAND_ALT:1, bool) ! (>L:LAND_ALT:1, bool) Repeat="Yes

 

Thanks,

 

dEHmAN137

Link to comment
Share on other sites

To begin with, bool is a binary state, 1 or 0, true or false, yes or no, in or out.

 

So using bool for your gauge is error #1, not that it really matters.

 

(L:LAND_ALT:1, bool) 1 > (L:LAND_ALT:1, bool) 

 

Not sure what you want here. What this says is...

 

Is the L:Var greater than one?, which will return a 1 if true or a 0 if false.

 

Then it asks, what is the L:Var? The answer would be 1 or 0.

 

Try...

 

(L:LAND_ALT:1, enum)

 

Now we can look at your code.

 

(L:LAND_ALT:1, bool) ! (>L:LAND_ALT:1, bool) Repeat="Yes

 

You see this a lot on 2 position switches. It basically says if the L:Var is 0, change it to 1, if it is 1, change it to 0.

 

Not appropriate for what you want.

 

Try...

(L:LAND_ALT:1, enum) 1 - (>L:LAND_ALT:1, enum) Repeat="Yes

 

...and...

 

(L:LAND_ALT:1, enum) 1 + (>L:LAND_ALT:1, enum) Repeat="Yes

 

This will get you started, and introduce a new problem.

 

For tonight, this is the best I can do. It is late and I need to get to bed.

 

peace,

the Bean

WWOD---What Would Opa Do? Farewell, my freind (sp)

 

Never argue with idiots.

They drag you down to their level and beat you with experience

Link to comment
Share on other sites

That got the scrolling to work! However now there is no limit to the scrolling, after it passes through the images the scroll just keeps going. Anyway to set limits of the case values 0-9?

 

You could try this code .

 

(M:Event) 'LeftSingle' scmp 0 == if{ (L:APdisplay mode,enum) ++ 6 % (>L:APdisplay mode,enum) }

(M:Event) 'RightSingle' scmp 0 == if{ (L:APdisplay mode,enum) -- d 0 L:APdisplay mode,enum) }

Page Toggle +/-

 

The above is one button , extract as follows ,

 

Button 1.

(L:APdisplay mode,enum) ++ 6 % (>L:APdisplay mode,enum)

 

Button 2.

(L:APdisplay mode,enum) -- d 0 L:APdisplay mode,enum)

 

Where 6 appears , replace it with the number of lines applicable to your instrument.

 

These will scroll in a continuous loop either forward or backwards ,

ie;

once you get to the last line , the next click will take you to the first line.

 

Cheers

Karol

Link to comment
Share on other sites

 

This will get you started, and introduce a new problem.

 

...now there is no limit to the scrolling, after it passes through the images the scroll just keeps going.

You found it!

 

Try Karol's code.

 

I do see a couple things.

 

You could try this code .

 

(M:Event) 'LeftSingle' scmp 0 == if{ (L:APdisplay mode,enum) ++ 6 % (>L:APdisplay mode,enum) }

(M:Event) 'RightSingle' scmp 0 == if{ (L:APdisplay mode,enum) -- d 0 L:APdisplay mode,enum) }

Page Toggle +/-

 

It appears he borrowed this from another gauge and I question the size of it.

 

You did not assign any size to your gauge, other than the bitmap sizes. So it reads like you click on one half of the bitmap, as seen in the sim, to scroll up and click on the other half to scroll down.

 

Karol's code gives you one click zone and you left click to scroll up and right click to scroll down.

 

As I see it you need to change that line to...

 

 

Try that and let us know how it goes.

 

If you want to learn more about XML gauge coding, look at the tutorials here- http://www.fs2x.com/Tutorials.htm

 

peace,

the Bean

WWOD---What Would Opa Do? Farewell, my freind (sp)

 

Never argue with idiots.

They drag you down to their level and beat you with experience

Link to comment
Share on other sites

The Bean is correct .

 

My code was only an Example copied from my Autopilot Mini MFD which has 6 pages of information , that are scrolled -Forward by left click , and -Backwards by right click.

 

Below my code I detailed buttons 1 and 2 for use in the OP's instrument , obviously my post created some confusion , if it did , sorry about that .

 

******

To clarify do the following changes to the code in the initial post ;

 

From : original.

 

(L:LAND_ALT:1, bool) ! (>L:LAND_ALT:1, bool) Repeat="Yes

(L:LAND_ALT:1, bool) ! (>L:LAND_ALT:1, bool) Repeat="Yes

 

To : change to.

 

(L:LAND_ALT:1, bool) ++ 10 % (>L:LAND_ALT:1, bool) Repeat="Yes

(L:LAND_ALT:1, bool) -- d 0 L:LAND_ALT:1, bool) Repeat="Yes

 

******

 

The " 10 " will cover the " case values 0-9 "

 

You will now have closed loops that will scroll through all 10 case values , then repeat as often as desired in either a forward direction or backwards direction .

 

I use this style of code in several instruments in my panel , including in my multi mode radar .

 

It really is the Bees knees !

 

Try it and report back here.

 

Cheers

Karol

 

EDIT ;

The above replacement gives you 2 click zones , left side and right side , exactly as you had in your original post code.

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