Jump to content
The simFlight Network Forums

Turbulence loppoing sound


Recommended Posts

Hi Peter,

I am using this script with FSX in my 737 cockpit but sometimes I am getting the turb.wav sound running while on the ground...so what should I need to change in this script to only sounds this turb.wav after take off?

Regards,

Carlos

Edited by carlos hermida
Link to comment
Share on other sites

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

I am using this script with FSX in my 737 cockpit but sometimes I am getting the turb.wav sound running while on the ground...so what should I need to change in this script to only sounds this turb.wav after take off?

What script?

Why not simply test the "on ground" flag at offset 0366?

Pete

Link to comment
Share on other sites

This one's from cellular55, please see the link below if needed...

http://forum.simflig...io-chatter-lua/

So, where should I include this "on ground" flag in that script ? Do you matter to point me because I am not good programming...

Looks like it already checks the ground flag before it starts playing the turbulence wave. It simply doesn't check for ground afterwards, so if you land and there's still turbulence on the ground, it will still play. Is that what you are getting?

I'm afraid I'm away now until Monday, so apologies for any delay in further answers.

Pete

Link to comment
Share on other sites

1319755153[/url]' post='432867']

Looks like it already checks the ground flag before it starts playing the turbulence wave. It simply doesn't check for ground afterwards, so if you land and there's still turbulence on the ground, it will still play. Is that what you are getting?

I'm afraid I'm away now until Monday, so apologies for any delay in further answers.

Pete

No problem Peter take you time to reply!

Correct, I have noted that it plays on the ground after landing as you mention, anything posible to correct or update with it?

Carloa

Link to comment
Share on other sites

Correct, I have noted that it plays on the ground after landing as you mention, anything posible to correct or update with it?

Of course, just test the on ground flag via an event, and stop the sound if it is playing. Add this to the code:

ref = 0 

near the top , where the other variables are set, and this at the end:

function onground(off, val)
   if  val ~= 0 and sndflg ~= 0 then
   	sound.stop(ref)
   	sndflg=0
   end
end

event.offset(0x0366, "UW", "onground")

Regards

Pete

Link to comment
Share on other sites

1320058777[/url]' post='432969']

Of course, just test the on ground flag via an event, and stop the sound if it is playing. Add this to the code:

ref = 0 

near the top , where the other variables are set, and this at the end:

function onground(off, val)
   if  val ~= 0 and sndflg ~= 0 then
   	sound.stop(ref)
   	sndflg=0
   end
end

event.offset(0x0366, "UW", "onground")

Regards

Pete

Hi Pete,

Many thanks ! I will test it this week when back home and I will report you how it goes !

Regards,

Carlos

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

I don't know. I'll take a look when I get time -- maybe next week. i have a lot of catching up to do after my holiday and I'm away this weekend too.

Regards

Pete

Hi Pete,

I know you are very busy, i just hope you havent forget this.

Thanks.

Regards

Marco

Link to comment
Share on other sites

I know you are very busy, i just hope you havent forget this.

Sorry, i have. What was it about? I've scanned the thread a bit but I can't quite make out what it was you wanted now. Your quote from me is about 6 weeks old.

Sadly, it is not a good time to remind me of anything -- I have only a couple of days before going away for Christmas and New Year. I suggest you remind me, preferably with details in a new thread, when I'm back -- January 6th 2012.

[LATER]

Looking more carefully, I think it is these offsets, currently only for FSUIPC4, you want in FSUIPC3 also?

0E84 1 byte Cloud type, 1-10, if the aircraft is in a cloud layer. Otherwise 0

0E85 1 byte Cloud coverage, 0 - 8 "Oktas" or eighths of the sky.

0E86 2 bytes Cloud icing level 0-4

0E88 2 bytes Cloud turbulence level, 0-255 (as for older offsets 0EFC etc).

0E94 2 bytes Wind gusting value (max speed in knots, or 0 if no gusts)

0E96 2 bytes Wind directional variation -- degrees in the same units as wind directions

0E98 2 bytes Wind turbulence value, 0-255, just like offset 0ED2, etc.

I'll check later today.

Regards

Pete

Link to comment
Share on other sites

I'll check later today.

Okay. It wasn't too hard. In the process of working out what to do I also found that the facilities for those offsets in FSUIPC4 only worked for the lower three wind and cloud layers, owing to the way they are linked to the old FS98 facilities.

Versions FSUIPC 3.998p and FSUIPC 4.752 both include full support for offsets 0E84-0E88 for cloud data and 0E94-0E98 for wind data "at aircraft" no matter how many layers there are. Get the updates from the Download Links subforum.

Regards

Pete

Link to comment
Share on other sites

Okay. It wasn't too hard. In the process of working out what to do I also found that the facilities for those offsets in FSUIPC4 only worked for the lower three wind and cloud layers, owing to the way they are linked to the old FS98 facilities.

Versions FSUIPC 3.998p and FSUIPC 4.752 both include full support for offsets 0E84-0E88 for cloud data and 0E94-0E98 for wind data "at aircraft" no matter how many layers there are. Get the updates from the Download Links subforum.

Regards

Pete

Thank you very very much for your time and support Pete, you are Santa :razz:

Wish you relaxing and happy Christmas and new year.

Regards

Marco

Link to comment
Share on other sites

  • 4 months later...

Okay. It wasn't too hard. In the process of working out what to do I also found that the facilities for those offsets in FSUIPC4 only worked for the lower three wind and cloud layers, owing to the way they are linked to the old FS98 facilities.

Versions FSUIPC 3.998p and FSUIPC 4.752 both include full support for offsets 0E84-0E88 for cloud data and 0E94-0E98 for wind data "at aircraft" no matter how many layers there are. Get the updates from the Download Links subforum.

Regards

Pete

Hi Pete, do 3.999 still have these offsets. I cant get sound out?

Regards

Marco

Link to comment
Share on other sites

Ok, so it cant be offsets, i have something totally wrong.

Well, I don't know about that, but please just use the logging facilities to check? I can't really help without information. Surely you can understand that? I certainly haven't changed anything in this area in any recent updates, that's all i can say. Maybe some new bug has crept in somehow? Please just check what is going on and let me know. There are surely enough tools you can use to check this? If you don't know how to use the Logging or FSInterrogate, let me know.

Regards

Pete

Link to comment
Share on other sites

Pete, i got it working, but sound still goes on and on (on ground). So i have try to add the script you write here earlier, but get always errors. This is my first time to trying with LUA-script, so am new of this. Is it possible to correct that script on Users Contributions to get it work like it should. Thank you.

Regards

Marco

Link to comment
Share on other sites

Pete, i got it working, but sound still goes on and on (on ground). So i have try to add the script you write here earlier, but get always errors. This is my first time to trying with LUA-script, so am new of this. Is it possible to correct that script on Users Contributions to get it work like it should. Thank you.

Sorry, I've no idea. You'll need to post your Lua program here and explain what it is you want to do.

Regards

Pete

Link to comment
Share on other sites

Pete, this is the script i try to add.

Of course, just test the on ground flag via an event, and stop the sound if it is playing. Add this to the code:

ref = 0 

near the top , where the other variables are set, and this at the end:

function onground(off, val)
   if  val ~= 0 and sndflg ~= 0 then
   	sound.stop(ref)
   	sndflg=0
   end
end

event.offset(0x0366, "UW", "onground")

Regards

Pete

....and here is the lua, where that script goes. Turbulence sound dont stop, it continue even landed already. Can you please show how it should looks like. Sorry Pete but I dont get it right?

http://forum.simflight.com/topic/66922-turbulence-sound-atc-radio-chatter-lua/

Link to comment
Share on other sites

Pete, this is the script i try to add.

Please can you simply paste in the Lua script you are trying to use? I want to look at what YOU are using! I don't want references to other things and instructions! I need to see exactly what you are running!

Pete

Link to comment
Share on other sites

Please can you simply paste in the Lua script you are trying to use? I want to look at what YOU are using! I don't want references to other things and instructions! I need to see exactly what you are running!

Pete

Ok, here it is.

------------------------------------------------------------------------------

-- Turbulence looping sound -- Seat Belts Messages -- ATC Radio Chatter

-- Initializing flags --

sndflg=0 -- turbulence sound flag

seatfl=0 -- seat belt flag

ref=0 -- onground

-- Function to play sound if and until turbulence is detected --

function turbulence(offset,value)

ground=ipc.readUW(0x0366)

if (value > 0) and (sndflg == 0) and (ground == 0) then

ref=sound.playloop("C:\\WideClient\\Sounds\\Turbulence.wav")

sndflg=1

ipc.sleep(1000)

if (seatfl == 2) or (seatfl == 4) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

end

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

end

if (value == 0) and (sndflg == 1) then

sound.stop(ref)

sndflg=0

if (seatfl == 2) or (seatfl ==4) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

end

end

function onground(offset,value)

if value ~=0 and sndflg ~=0 then

sound.stop(ref)

sndflg=0

end

end

end

-- Function to manage messages when seat belts sign changes - welcome on board -- descent --- on cruise ---- parked at the arrival gate

function seatbelt(offset,value)

if (value == 1) and (seatfl == 0) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\welcomeonboard.wav")

seatfl=1

end

if (value == 1) and (seatfl == 2) then

sound.play("C:\\Documents and Settings\\Delli\\Työpöytä\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\descent.wav")

seatfl=3

end

if (value == 0) and (seatfl == 1) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\levelautobelt.wav")

seatfl=2

end

if (value == 0) and (seatfl == 3) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\atgate.wav")

seatfl=4

end

end

-- Function to play ATC chatter - COM2 freqs 118.10 and 118.20 - 70 wavs for each freq - y var to make the frequency of chat random - x var to make the messages random

function ATC_Radio()

-- Radio squelch if a valid freq is selected

n = ipc.readUW(0x3118)

if (n == 0x1810) or (n == 0x1820) then

if (n1 ~= n) then

sound.play("C:\\WideClient\\Sounds\\Radio.wav")

n1=n

end

end

-- Radio chatter play routine

y= math.random(1,5)

if (y == 2) or (y == 4) then

if (n == 0x1810) then

x=math.random (1,70)

suono = "C:\\WideClient\\Sounds\\chatter1.wav"

sound.play(suono)

end

if (n == 0x1820) then

x=math.random (1,70)

suono = "C:\\WideClient\\Sounds\\chatter2.wav"

sound.play(suono)

end

end

end

-- FSUIPC LUA calls for the different events -- timer to exec the ATC function every 1 min

event.offset(0x0E88,"UW","turbulence")

event.offset(0x0E98,"UW","turbulence")

event.offset(0x341D,"UB","seatbelt")

event.timer(60000,"ATC_Radio")

event.offset(0x0366,"UW","onground")

------------------------------------------------------------------------

Link to comment
Share on other sites

Ok, here it is.

Er ... and you run this, and everything works except that the turbulence sound does not stop after you land?

I don't see how, because it has errors in it which will stop it loading. You appear to have placed the routine called "function onground" in the wrong place!

Didn't you bother to look at the log? This would have told you what was wrong and in which line.

You now need an "end" inserted before the line

function onground(offset,value)

and you need to delete the extra unwanted end at the end of that function.

Then at least it will load and have a chance of working!!

Pete

Link to comment
Share on other sites

Original script work, except turbulence sound still play even after landing. I have try to fix it and result is this, yes i got errors. I keep on trying.

Why haven't you posted the script you are using which doesn't work, instead of posting a script you cannot possibly use because of editing errors?.

This is utterly frustrating!! If you want help you have to be more forthcoming. If a Lua script gets errors it won't work -- at al! The script you just pasted here will not load, therefore it will not work AT ALL -- it isn't a looping problem, it's a simple mess you made when adding the changes!

I just told you how to fix it. Instead of "keep on trying" why not just do as I said? I don't understand why you ask for help then ignore it!!!

:sad:

Pete

Link to comment
Share on other sites

I KNOW I HAVE MESS IT, thats why i have ask help, becouse am totally new with LUA, i never havent write it before. Here is the script what dosent give errors. I just have add ref=0 , below of seatfl=0 -- seat belt flag , nothing else.

Looping sound stop now before landing.

------------------------------------------------------------------------------

-- Turbulence looping sound -- Seat Belts Messages -- ATC Radio Chatter

-- Initializing flags --

sndflg=0 -- turbulence sound flag

seatfl=0 -- seat belt flag

ref=0

-- Function to play sound if and until turbulence is detected --

function turbulence(offset,value)

ground=ipc.readUW(0x0366)

if (value > 0) and (sndflg == 0) and (ground == 0) then

ref=sound.playloop("C:\\WideClient\\Sounds\\Turbulence.wav")

sndflg=1

ipc.sleep(1000)

if (seatfl == 2) or (seatfl == 4) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

end

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

end

if (value == 0) and (sndflg == 1) then

sound.stop(ref)

sndflg=0

if (seatfl == 2) or (seatfl ==4) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

end

end

end

-- Function to manage messages when seat belts sign changes - welcome on board -- descent --- on cruise ---- parked at the arrival gate

function seatbelt(offset,value)

if (value == 1) and (seatfl == 0) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\welcomeonboard.wav")

seatfl=1

end

if (value == 1) and (seatfl == 2) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\descent.wav")

seatfl=3

end

if (value == 0) and (seatfl == 1) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\levelautobelt.wav")

seatfl=2

end

if (value == 0) and (seatfl == 3) then

sound.play("C:\\WideClient\\Sounds\\nattend.wav")

ipc.sleep(1000)

sound.play("C:\\WideClient\\Sounds\\atgate.wav")

seatfl=4

end

end

-- Function to play ATC chatter - COM2 freqs 118.10 and 118.20 - 70 wavs for each freq - y var to make the frequency of chat random - x var to make the messages random

function ATC_Radio()

-- Radio squelch if a valid freq is selected

n = ipc.readUW(0x3118)

if (n == 0x1810) or (n == 0x1820) then

if (n1 ~= n) then

sound.play("C:\\WideClient\\Sounds\\Radio.wav")

n1=n

end

end

-- Radio chatter play routine

y= math.random(1,5)

if (y == 2) or (y == 4) then

if (n == 0x1810) then

x=math.random (1,70)

suono = "C:\\WideClient\\Sounds\\chatter1.wav"

sound.play(suono)

end

if (n == 0x1820) then

x=math.random (1,70)

suono = "C:\\WideClient\\Sounds\\chatter2.wav"

sound.play(suono)

end

end

end

-- FSUIPC LUA calls for the different events -- timer to exec the ATC function every 1 min

event.offset(0x0E88,"UW","turbulence")

event.offset(0x0E98,"UW","turbulence")

event.offset(0x341D,"UB","seatbelt")

event.timer(60000,"ATC_Radio")

------------------------------------------------------------------------

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.