Hello Pete,
First off thanks for a great program. Secondly, you've enspired me to actually code my own little projects with FSUIPC. (I am a audio mixer/recordist/musican with no programming experience whatsoever).
I've created a little lua file to play .wavs of a captain's initial announcement.
Starting with "Good Morning" or "Good Afternoon" or "Evening depending on the time of the local hour, and then give information about the departure. Clear, Rain, Snow, windy...etc.
please see my example:
======================================================
Lua File
--Captain Announcement
time = ipc.readUB(0x0238) -- TIME OF DAY LOCAL HOUR (0-23)
weather = ipc.readUB(0x04CC) -- WEATHER 0=No rain 1=Rain 2= Snow
if time <= 10 then
sound.play("f:\\fsv_crew\\captain\\morning.wav")
end
if (time >= 11) and (time <= 15) then
sound.play("f:\\fsv_crew\\captain\\afternoon.wav")
end
if time >= 16 then
sound.play("f:\\fsv_crew\\captain\\evening.wav")
end
ipc.sleep(3000) == Each file is 3 seconds long
if (weather == 0) then
sound.play("f:\\fsv_crew\\captain\\clearsky.wav")
end
if (weather == 1) then
sound.play("f:\\fsv_crew\\captain\\rain.wav")
end
if (weather == 2) then
sound.play("f:\\fsv_crew\\captain\\snow.wav")
end
==================================================
And it works great! Except for using the ipc.sleep command to link the two files.
I've tried using the sound.query( ) command every which way with no results
I thought I could code it like this:
=================================================
if (sound.query("f:\\fsv_crew\\captain\\morning.wav")) and (sound.query("f:\\fsv_crew\\captain\\afternoon.wav")) and (sound.query("f:\\fsv_crew\\captain\\evening.wav")) == false then
if (weather == 0) then
sound.play("f:\\fsv_crew\\captain\\clearsky.wav")
end
if (weather == 1) then
sound.play("f:\\fsv_crew\\captain\\rain.wav")
end
if (weather == 2) then
sound.play("f:\\fsv_crew\\captain\\snow.wav")
end
end
==================================================
But, it just plays the first file (time) .
Am I thinking of the sound.query() command correctly? I hope you can enlighten me as to what I am doing wrong.
If it's not possible, I am still content with using the sleep command. I just have to be diligent about the length of the files.
Thanks in advance.
Jim