- Messages
- 465
- Country

I am trying to add click sounds to all the switches and knobs in the VC of my current project using Doug's sound gauge but I'm having problems with getting the sounds working for switches operated by custom L:Vars. I've got the sounds working for any stock functions that use K:Vars.
The problem I have is that I can either get the sound to play once only on the initial operation of the switch or it repeats endlessly whether the switch is clicked or not.
I am using a 2D xml gauge to trigger the sounds with my code in the 'Update' section which is the way I did it on another project and that worked fine for canopy and door sounds but it doesn't appear to be working as well this time.
Here is the code I am trying to use at the moment, this is for one switch that I am using as a test example and once I can get the syntax/operation correct I plan to adapt it to the dozens of other custom switches in the VC.
'L:Boxcar_ht_zone_1_switch' is the Lvar from my modeldef.xml file and the one used on the model part
'L:Boxcar_ht_zone_1_SND' is the Lvar in the 2D gauge to monitor the sound
'L:Toggle_SW_SND' is the Lvar in the 'dsd_fsx_xml_sound.ini' file used to play the sound file
This code triggers the switch click on the initial activation but fails to work again after that. I need it to play the sound when the toggle switch is clicked ON and clicked OFF.
Can anyone see where I am going wrong as I am at a loss now as coding really isn't one of my better features!
Thanks.
The problem I have is that I can either get the sound to play once only on the initial operation of the switch or it repeats endlessly whether the switch is clicked or not.
I am using a 2D xml gauge to trigger the sounds with my code in the 'Update' section which is the way I did it on another project and that worked fine for canopy and door sounds but it doesn't appear to be working as well this time.
Here is the code I am trying to use at the moment, this is for one switch that I am using as a test example and once I can get the syntax/operation correct I plan to adapt it to the dozens of other custom switches in the VC.
'L:Boxcar_ht_zone_1_switch' is the Lvar from my modeldef.xml file and the one used on the model part
'L:Boxcar_ht_zone_1_SND' is the Lvar in the 2D gauge to monitor the sound
'L:Toggle_SW_SND' is the Lvar in the 'dsd_fsx_xml_sound.ini' file used to play the sound file
Code:
(L:Boxcar_ht_zone_1_switch,bool) 0 >
(L:Boxcar_ht_zone_1_SND,bool) 0 == and
if{
1 (>L:Toggle_SW_SND,number)
1 (>L:Boxcar_ht_zone_1_SND,bool)
}
This code triggers the switch click on the initial activation but fails to work again after that. I need it to play the sound when the toggle switch is clicked ON and clicked OFF.
Can anyone see where I am going wrong as I am at a loss now as coding really isn't one of my better features!
Thanks.


) while a couple of others required the addition of the line of code to the modeldef file and then a re-export (or several) as they wouldn't work via the 2D gauge due to the complexity of the code for those parts.