Results 1 to 3 of 3
  1. #1
    New Member
    Join Date
    Aug 2010
    Location
    Barcelona, Spain
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    problem with sound script

    Several weeks ago I began a simple script with sounds, but I committed a mistaque that I'm not able to find from then on:
    when the aircraft speed is higher than 135Knt, I want to sound (only one time!) an alarm, but sadly this sound repits again and again, very quickly. This alarm only stops when the speed is slower than 135Knt.
    I don't undertand, I thought that Var0702 was enough to stop the sound.
    This is the script:

    Var 0701, Link SOUND // Sound on
    Var 0702, Link SOUND, Type S // Sound off

    Var 1224
    Var 1220, Link FSUIPC_IN, Offset $02BC, Length 4 // IAS in knots * 128
    {
    V1224 = V1220 / 128 // IAS
    IF V1224 > 135 // if IAS higher than 135Knt...
    {
    V0701 = 3 // the alarm file in sioc.ini
    V0701 = 0
    }
    ELSE
    {
    V0702 = 3
    V0702 = 0
    }
    }


    Please, I need your advice.
    Greetings from Barcelona, Spain.

  2. #2
    500+ This must be a daytime job
    Join Date
    Jul 2013
    Posts
    948
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: problem with sound script

    With your code the sound is triggered when the speed reaches more than 135 knots AND ABOVE. So the sound will play at over 135 knots and it will repeat until the speed drops below 135 knots. This because the code attached to variable 1220 will run every time the value of var 1220 changes ie for 135.1, 135.2, 135.3 knots etc etc. There are probably a number of ways to recode. You could create a variable called "IAS-over_135" and set this to 1 when you first go over 135 knots. Then insert a line to test if the IAS_over_135 variable is 1 before playing the sound. You will also need to add a line to reset the IAS_over_135 variable to zero after the sound has played once

    Others may know a simpler way to solve this

    David
    Edited to correct logic !!

  3. #3
    New Member
    Join Date
    Aug 2010
    Location
    Barcelona, Spain
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: problem with sound script

    dear friend David,
    thanks a lot for your help.

    Your suggestion has given me some ideas to modify the script. I have to think about it.

    Greetings, Mike.

Similar Threads

  1. Sioc trim sound problem
    By themax222 in forum OpenCockpits General Discussion
    Replies: 13
    Last Post: 05-03-2010, 02:33 PM
  2. X-Plane Thunder Sound addon sound pack
    By Padraig in forum General X-Plane (Laminar Research)
    Replies: 4
    Last Post: 12-12-2009, 07:24 AM
  3. Sound problem in FSX
    By GDR in forum FSX Sound Discussions
    Replies: 0
    Last Post: 07-01-2009, 03:54 AM
  4. FSX Sound Problem
    By airwolfe in forum Cockpit Sounds
    Replies: 6
    Last Post: 02-12-2009, 01:44 PM
  5. SIOC SOUND: How to make a looping sound?
    By stabell in forum OpenCockpits General Discussion
    Replies: 3
    Last Post: 10-29-2008, 08:27 PM