FS2004 multi screens gauge

Hi everybody,

I am developing a new gauge with multi screens. So far, I managed to create each one of them and to "link" them to differend buttons, as you can see in "Mouse" area of my code. According to this code I can switch on and off each screen, but... when <!--ENGINE_SCREEN--> area is activated by clicking on it and then <!--FLAPS_SCREEN--> is activated by clicking on it accordingly, if I want to switch back to <!--ENGINE_SCREEN--> area I have to switch off <!--FLAPS_SCREEN-->...:confused: is there any way to manage that tricky thing? I mean each time I press the according button to have the correct screen appeared?
PHP:
<Mouse>

<!--ENGINE_SCREEN-->
    <Area Left="168" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon02, bool) ! (>L:Dynon02, bool) (L:Dynon_EMS-D10_ENG,bool) ! (>L:Dynon_EMS-D10_ENG,bool)</Click>
      </Area>

<!--FLAPS_SCREEN-->
    <Area Left="292" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon03, bool) ! (>L:Dynon03, bool) (L:Dynon_EMS-D10_FLAPS,bool) ! (>L:Dynon_EMS-D10_FLAPS,bool)</Click>
      </Area>

<!--FUEL_SCREEN-->
    <Area Left="417" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon04, bool) ! (>L:Dynon04, bool) (L:Dynon_EMS-D10_FUEL,bool) ! (>L:Dynon_EMS-D10_FUEL,bool)</Click>
      </Area>

<!--HSI_SCREEN-->
    <Area Left="541" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon05, bool) ! (>L:Dynon05, bool) (L:Dynon_EMS-D10_HSI,bool) ! (>L:Dynon_EMS-D10_HSI,bool)</Click>
      </Area>

</Mouse>
thank you in advance
 

n4gix

Resource contributor
You have four pages and four L:Variables. You really only need one L:Variable with four pages!

Code:
(L:Dynon,enum)
Each mouse "button" when clicked will set the page number desired:

0 = ENGINE
1 = FLAPS
2 = FUEL
3 = HSI

Code:
<!--ENGINE_SCREEN--> 
    <Area Left="168" Top="564" Width="95" Height="85"> 
        <Cursor Type="Hand"/>  
        <Click Repeat="No">0 (>L:Dynon, enum)</Click> 
     </Area>

<!--FLAPS_SCREEN--> 
    <Area Left="292" Top="564" Width="95" Height="85"> 
       <Cursor Type="Hand"/>  
       <Click Repeat="No">1 (>L:Dynon, enum)</Click> 
    </Area>

et cetera...
For each of your page displays, you need only use this one variable for a <Visible> condition:

Code:
<Visible>(L:Dynon,enum) 0 ==</Visible>

<Visible>(L:Dynon,enum) 1 ==</Visible>

et cetera...
By doing it this way, the four buttons can only call for one page at a time.
 
:)... ok Bill, I got it!

...code has been changed to:
PHP:
<!--ENGINE_SCREEN-->
    <Area Left="168" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon02, bool) ! (>L:Dynon02, bool) 0 (>L:Dynon_EMS-D10,enum)</Click>
      </Area>

<!--FLAPS_SCREEN-->
    <Area Left="292" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon03, bool) ! (>L:Dynon03, bool) 1 (>L:Dynon_EMS-D10,enum)</Click>
      </Area>

<!--FUEL_SCREEN-->
    <Area Left="417" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon04, bool) ! (>L:Dynon04, bool) 2 (>L:Dynon_EMS-D10,enum)</Click>
      </Area>
<!--HSI_SCREEN-->
    <Area Left="541" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon05, bool) ! (>L:Dynon05, bool) 3 (>L:Dynon_EMS-D10,enum)</Click>
      </Area>
...and everything now is working like a charme!!!

thank you very much
 

n4gix

Resource contributor
You are most welcome. What is the purpose of these commands?
Code:
(L:Dynon02, bool) ! (>L:Dynon02, bool)
You are using them to control the actual button's animation?
 

n4gix

Resource contributor
Yes, this is to simulate button pressing... :blackcat:
Okay, the reason why I was asking is that normally such buttons don't remain in the "depressed" position. They move in and then pop back out. Otherwise, after awhile all of the buttons will be pushed in...

There's a very simple method to have them automatically pop back out after depression by using the mouse flags:

Code:
<Click Kind="LeftSingle+LeftRelease+LeftDrag">
        (* depress button *)
        (M:Event) 'LeftSingle' scmp 0 == 
              if{ 1 (>L:Button1,bool) }

        (* auto-release button *)
        (M:Event) 'LeftRelease' scmp 0 == 
        (M:Event) 'LeftDrag' scmp 0 == or 
              if{ 0 (>L:Button1,bool) }
</Click>
The script above will depress the button with a left-click. If the button is released, or the cursor moves "off the button", the button will be released automatically. :cool:
 
Yes... I understand what you mean and thank you for the idea, this piece of code will be very useful for a button that someone would like to keep it pressed for a short or longer time, but I just want a button that can be pressed/released instantly like a honda's car engine starter...

PHP:
<!--BUTTONS-->
	<Element>
		<Position X="44" Y="564"/>
		<Select>
		<Value>(L:Dynon01, bool)</Value>
		<Case Value="0">
			<Image Name="Dynon_OUT.bmp" ImageSizes="95,85"/>
		</Case>
		<Case Value="1">
			<Image Name="Dynon_IN.bmp" ImageSizes="95,85"/>
		</Case>
		</Select>
	</Element>

	<Element>
		<Select>
		<Value>(L:Dynon01, bool) 1 == if{ 0 (>L:Dynon01,bool) }</Value>
		</Select>
	</Element>

<Mouse>

    <Area Left="44" Top="564" Width="95" Height="85">
	<Cursor Type="Hand"/> 
	<Click Repeat="Yes">(L:Dynon01, bool) ! (>L:Dynon01, bool)</Click>
      </Area>
</Mouse>
 

tgibson

Resource contributor
Bill's code does work like a car starter button - press it and it depresses, then release the mouse button and it comes back up. Just like your finger on the car starter button.
 

n4gix

Resource contributor
Yes... I understand what you mean and thank you for the idea, this piece of code will be very useful for a button that someone would like to keep it pressed for a short or longer time, but I just want a button that can be pressed/released instantly like a honda's car engine starter...
But, that is exactly what I just gave you, a button that is just like "a Honda's car engine starter..."

That script is written to have the button "pop back out" as soon as you let go of it.

The script you are using will NOT do that. It is a binary toggle button. Click once and the button will press in; click again to release it.

That is why you had to add this bit of script to force the button to be released. While it works, the method I gave you is much simpler since it doesn't need this bit of script:
Code:
    <Element> 
        <Select> 
        <Value>(L:Dynon01, bool) 1 == if{ 0 (>L:Dynon01,bool) }</Value> 
        </Select> 
    </Element>
Also, rather than having so many <Element><Select><Value> sections, why not just use one <Update> section and put all of your logic in one place? It's much more tidy and organized that way, and you won't have to write so many unnecessary lines of script...

...plus you only have to look in one spot for your "logic". :)
 
Last edited:
of course Bill... it was just in front of my eyes... sometimes we see the tree and we loose the forest... as we use to say in Greece in such a kind of cases...:eek:

thanks once again for your accurate and fast help
 
Top