Jerry Carroll Posted December 23, 2014 Report Share Posted December 23, 2014 Trying to set up a lua to play a wav when a button is pressed. Created a file in FSX Modules folder named BingoFuel.lua. Contents of file: Sound.play("BingoFuel",2) The sound I'm attempting to play is BingoFuel.wav located in FSX Sound folder. I'm using a registered copy of FSUIPC 4.937. In the button section of FSUIPC I assigned a button to "lua Playbingofuel". I'm not getting the wav to play. In the Linda console I see an error message of: [E] *** LUA Error: C:\FSX\Modules\playbingofuel.lua:1: attempt to index global 'Sound' (a nil value) I know this is pretty basic stuff for most of you but I'm stuck. Thanks in advance, Jerry Link to comment Share on other sites More sharing options...
Pete Dowson Posted December 23, 2014 Report Share Posted December 23, 2014 Try using "sound" instead of "Sound". Lua, like many programming languages, is sensitive to both case and spelling and "Sound" is not the name of the "sound" library. If you refer to the Library documentation you will see them all shown correctly. Pete Link to comment Share on other sites More sharing options...
Jerry Carroll Posted December 23, 2014 Author Report Share Posted December 23, 2014 That was it exactly. Thanks, Pete. Link to comment Share on other sites More sharing options...
Jerry Carroll Posted December 24, 2014 Author Report Share Posted December 24, 2014 Pete, another question for you, if you will. This lua plays a sound on server pc when joystick button is pressed. Joystick is connected to server pc. Is it possible for the button press to play a sound on a client pc? Thanks, Jerry Link to comment Share on other sites More sharing options...
Pete Dowson Posted December 24, 2014 Report Share Posted December 24, 2014 Pete, another question for you, if you will. This lua plays a sound on server pc when joystick button is pressed. Joystick is connected to server pc. Is it possible for the button press to play a sound on a client pc? You'd need to have your Lua on the Client. If your button is on a device on the server, in the client Lua just act on the relevant button bit (offsets 03C0 - 03FF). Use event.offsetmask. Pete Link to comment Share on other sites More sharing options...
Jerry Carroll Posted December 24, 2014 Author Report Share Posted December 24, 2014 Thanks for the response Pete and I apologize for wasting your time. That was WAY over my head. You put that in college level terms and I'm a 1st grader. I read the LUA Library documentation but could not comprehend event.offsets and such. I do appreciate your reply and thanks for the work you do with FSUIPC. Jerry Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now