FSXA sound off mouse click

#1
Thanks to everyone who helped me in my putting sounds with my annunciators. Struggled with some and went a different route. My struggle now is getting the sound to turn off with a mouse click. decided would like the sound continous until clicked, as it is in most equipment. Once again I really struggle with this learning curve, (Need someone to run the deck of your ship, Im good at that) and any help with this is greatly appreaciated.



<Gauge Name="annunciator_low_oil_left" Version="1.0">
<Size X="118" Y="59"/>
<Element>
<Select>
<Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) s0 30 &lt; s1 l0 100 &gt; l1 ||</Value>
<Failures>
<SYSTEM_ELECTRICAL_PANELS Action="0"/>
</Failures>
<Case Value="0">
<Image Name="Low_Oil_Off.bmp" UseTransparency="Yes"/>
</Case>
<Case Value="1">
<Image Name="Low_Oil_On.bmp" Bright="Yes" UseTransparency="Yes"/>
</Case>
</Select>
</Element>
<Element>
<Select>
<Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) 30 &lt; if{ 1 (&gt;L:dsd_fsx_sound_id_02,number) } els{ 0 }</Value>
</Select>
</Element>
<Mouse>
<Tooltip ID="Silence"/>
<Area>
<Cursor Type="Hand"/>
<Click>(L:StopSound,bool) 1 (&gt;L:dsd_fsx_sound_id_02,number) 0 (&gt;L:StopSound,bool)</Click>
</Area>
</Mouse>
</Gauge>
 
#3
What if it doesn't

Thanks Doug,
Tried it and wont shut it off. I know its something I have missed or done. Is there anything serious wrong with the code. Thanks again and for any assitance that can be provided.

<Gauge Name="annunciator_low_oil_left" Version="1.0">
<Size X="118" Y="59"/>
<Element>
<Select>
<Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) s0 30 &lt; s1 l0 100 &gt; l1 ||</Value>
<Failures>
<SYSTEM_ELECTRICAL_PANELS Action="0"/>
</Failures>
<Case Value="0">
<Image Name="Low_Oil_Off.bmp" UseTransparency="Yes"/>
</Case>
<Case Value="1">
<Image Name="Low_Oil_On.bmp" Bright="Yes" UseTransparency="Yes"/>
</Case>
</Select>
</Element>
<Element>
<Select>
<Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) 30 &lt; if{ 1 (&gt;L:dsd_fsx_sound_id_02,number) }</Value>
</Select>
</Element>
<Mouse>
<Area>
<Tooltip ID="Silence"/>
<Cursor Type="Hand"/>
<Click>0 (&gt;L:dsd_fsx_sound_id_02,number)</Click>
</Area>
</Mouse>
</Gauge>
 

ddawson

Resource contributor
#4
Sorry, I missed the calculation in the Value tag...

Code:
<Value Minimum="0" Maximum="100">
(A:Eng1 oil pressure,PSI) 30 &lt; 
(L:StopSound,bool) ! and
if{ 1 (&gt;L:dsd_fsx_sound_id_02,number) }
</Value>

<Click>
0 (&gt;L:dsd_fsx_sound_id_02,number)
1 (&gt;L:StopSound,bool)
</Click>
This doesn't do anything about resetting L:StopSound, presumably once you get the oil pressure under control.

Doug
 
#5
Thanks Doug

That worked, getting closer, now just figuring out the reset. Thanks for everything. I will post the final result once I have it figured
 
#7
heres where im at

Any ideas or suggestion or is completly wrong route

Code:
<Gauge Name="annunciator_low_oil_left" Version="1.0">
   <Size X="118" Y="59"/>
   <Update Hidden="Yes">(A:Eng1 oil pressure,PSI) 30 == (L:PlaySound,bool) 1 == and if{ 0 (&gt;L:PlaySound,bool) }</Update>
   <Element>
      <Select>
         <Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) s0 30 &lt; s1 l0 100 &gt; l1 ||</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
         </Failures>
         <Case Value="0">
            <Image Name="Low_Oil_Off.bmp" UseTransparency="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="Low_Oil_On.bmp" Bright="Yes" UseTransparency="Yes"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Select>
         <Value Minimum="0" Maximum="100">(A:Eng1 oil pressure,PSI) 30 &lt; (L:StopSound,bool) ! and if{ 1 

(&gt;L:dsd_fsx_sound_id_02,number) }</Value>
      </Select>
   </Element>
   <Mouse>
      <Area Left="0" Top="0" Width="118" Height="59">
         <Cursor Type="Hand"/>
         <Tooltip>Silence</Tooltip>
         <Click>0 (&gt;L:dsd_fsx_sound_id_02,number) 1 (&gt;L:StopSound,bool)</Click>
      </Area>
   </Mouse>
</Gauge>
 

ddawson

Resource contributor
#8
In your reset routine, you are comparing a volatile floating point value against against an integer value.
In practice, oil pressure will never be precisely equal to 30PSI, other than by shear chance.
It will vary by perhaps 0.002 on either side of the target value.
Not a whole lot, for sure, but to the computer, equal is equal. Close doesn't count.
You need to test oil pressure for greater than 30PSI, or whatever value you choose.

It's always a good idea to have a diagnostic gauge installed that you can configure to monitor the variables in question - just put the values in text strings. Sometimes the answer will jump right out at you.
At this particular moment in time, mine looks like this. Sorry, it's old enough that it still has Image Size references:

Code:
<Gauge Name="Test_String" Version="1.0">
	<Image Name="string_display.bmp" ImageSizes="272,108,136,54"/>
	<Element>
		<Select>
		</Select>
		<Position X="3" Y="1"/>
		<Text X="55" Y="7" Bright="No" Length="35" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>SpPar %((L:SpoilerParam, number))%!f!</String>
		</Text>
	</Element>
	<Element>
		<Select>
		</Select>
		<Position X="3" Y="12"/>
		<Text X="55" Y="7" Bright="No" Length="35" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>SpCur %((L:CurrentSpoilers, number))%!f!</String>
		</Text>
	</Element>
	<Element>
		<Select>
		</Select>
		<Position X="3" Y="24"/>
		<Text X="55" Y="7" Bright="No" Length="55" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>Cabin %((C:CABIN:PassengerComfort))%!d!</String>
		</Text>
	</Element>
	<Element>
		<Select>
		</Select>
		<Position X="3" Y="36"/>
		<Text X="55" Y="7" Bright="No" Length="55" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>FltA %((C:CABIN:FlightAttendants) )%!s!</String>
		</Text>
	</Element>


	<Element>
		<Select>
		</Select>
		<Position X="60" Y="1"/>
		<Text X="55" Y="7" Bright="No" Length="55" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>Temp %((C:CABIN:CabinTemperature) )%!d!</String>
		</Text>
	</Element>
	<Element>
		<Select>
		</Select>
		<Position X="60" Y="12"/>
		<Text X="55" Y="7" Bright="No" Length="55" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
		<String>lbs%( (A:FUEL WEIGHT PER GALLON, pounds) )%!4.2f! </String>
		</Text>
	</Element>
	<Element>
		<Position X="60" Y="24"/>
		<Text X="55" Y="7" Bright="No" Length="55" Font="Arial" Color="White" Adjust="Left" VerticalAdjust="Left" Multiline="No">
Doug
 
#9
Thanks Doug

Thanks for that, am continueing reading the SDK and taking your advice on the test guage. Why is there no simple reset procedure for this stuff. Thanks again

Greg
 
#10
Reset Code

Does anyone have any examples of code that resets a guage. Getting there but am missing something. when I silence the code it activates right away, so the sound plays continuosly. Thanks for any help.
 
#11
Why is it Backwards

Thanks again for all the help. Finally got back this and had a breakthrough with the reset function of the guage. Well most of them anyway. I have a Battery Fault annun, and although the sound works. its backwards. The annun light up when the switch is off and the sound plays when the switch is on> Any suggestions?

Code:
<Gauge Name="Battery Fault" Version="1.0">
<Update Hidden="Yes">(A:Electrical master battery,bool) 
1 &lt; (L:dsd_fsx_sound_id_24,number) ! and 
if{ 0 (&gt;L:StopSound24,bool) }</Update>
<Element>
<Select>
<Value>(A:Electrical master battery,bool) 1 ==</Value>
<Case Value="0">
<Image Name="bat_on.bmp" Bright="Yes"/>
</Case>
<Case Value="1">
<Image Name="bat_off.bmp" Bright="Yes"/>
</Case>
</Select>
</Element>
<Element>
<Select>
<Value>(A:Electrical master battery,bool) 0 &gt; 
(L:StopSound24,bool) ! and 
if{ 1 (&gt;L:dsd_fsx_sound_id_24,number) }</Value>
</Select>
</Element>
 <Mouse>
 <Area Left="0" Top="0" Width="118" Height="59">
 <Cursor Type="Hand"/>
 <Tooltip>Silence</Tooltip>
 <Click>0 (&gt;L:dsd_fsx_sound_id_24,number) 1 (&gt;L:StopSound24,bool)</Click>
</Area>
</Mouse>
</Gauge>
 
#12
Got it

Figured it out and here is the end result

Code:
<Gauge Name="Battery Fault" Version="1.0">
<Update Hidden="Yes">
(A:Electrical BATTERY BUS VOLTAGE,volts) 10 &gt; 
(L:dsd_fsx_sound_id_24,number) ! and 
if{ 0 (&gt;L:StopSound24,bool) }</Update>
<Element>
<Select>
<Value>(A:Electrical BATTERY BUS VOLTAGE,volts) 10 &lt;</Value>
<Case Value="0">
<Image Name="bat_off.bmp" Bright="Yes"/>
</Case>
<Case Value="1">
<Image Name="bat_on.bmp" Bright="Yes"/>
</Case>
</Select>
</Element>
<Element>
<Select>
<Value>(A:Electrical BATTERY BUS VOLTAGE,volts) 10 &lt; 
(L:StopSound24,bool) ! and 
if{ 1 (&gt;L:dsd_fsx_sound_id_24,number) }</Value>
</Select>
</Element>
<Mouse>
<Area Left="0" Top="0" Width="118" Height="59">
<Cursor Type="Hand"/>
<Tooltip>Silence</Tooltip>
<Click>0 (&gt;L:dsd_fsx_sound_id_24,number) 1 (&gt;L:StopSound24,bool)</Click>
</Area>
</Mouse>
</Gauge>
This alarms when a fault occurs, can be silenced with a mouse click, then resets itself after fault is corrected. Thanks again to everone that has helped me struggle through these annuniciators and sound guage. A special Thanks to Bill and Doug.

Cheers Greg
 
Top