Hello,
I need help with a problem since a week with a sound gauge (lua script).
In the 3D cockpit, on a fire test button, when I stay pressed with the left mouse button, the sound plays in a loop when I would like it to play only once, even if I stay pressed on the left button and release it.
In the xml file of the model :
In the xml file of the gauge sounds :
If you would be so kind as to help me.
Karmat
I need help with a problem since a week with a sound gauge (lua script).
In the 3D cockpit, on a fire test button, when I stay pressed with the left mouse button, the sound plays in a loop when I would like it to play only once, even if I stay pressed on the left button and release it.
In the xml file of the model :
XML:
<PartInfo>
<Name>custom_rec_Event_43</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<MouseFlags>LeftRelease+LeftSingle</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmi 0 == if{ 1 (>L:fire test button,bool) || }
(M:Event) 'LeftRelease' scmi 0 == if{ 0 (>L:fire test button,bool) }
</CallbackCode>
</MouseRect>
</PartInfo>
In the xml file of the gauge sounds :
XML:
<SimBase.Document Type="AceXML" version="1,0" id="radar_settings">
<Descr>AceXML Document</Descr>
<Filename>bk117sounds.xml</Filename>
<SimGauge.Gauge id="Gauge">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>10,10</Size>
<Update id="Update">
<Script>!lua
--buttonPressRelease
if varget("L:fire test button", "bool") ~= varget("L:sound_38", "bool") then
soundOneShot("gong.wav")
end
if varget("L:fire test button", "bool") ~= varget("L:sound_38", "bool") then
varset("L:sound_38", "bool", varget("L:fire test button", "bool"))
end
--
</Script>
</Update>
</SimGauge.Gauge>
</SimBase.Document>
If you would be so kind as to help me.
Karmat
