Jump to content
Sign in to follow this  

What's wrong with this function?

Recommended Posts

Hi all,

Me again... Would anyone be so kind as to tell me why this doesn't work?

I have taken the joystick and button number straight from the 'buttons + switches ' tab in FSUIPC. The code is straight out of the Lua Library doc. The sound file is in FSX/sound. The code is in the aircraft user file.

function LibUserTimer1Hz()

function set8000 ()
x = ipc.testbutton(0, 11)
if x == TRUE

event.timer(1000, "set8000")

What dum mistake have I made this time?

Thanks in advance!

Share this post

Link to post
Share on other sites

There are a few basic programming errors. The LibUserTimer1Hz() is called by the core LINDA LUA code. Inside this you have defined another function set8000() which calls itself with the event.timer() function. This will cause a never-ending loop if were not for the fact it is never called.

Delete the function set8000() and end lines and the event.timer line. It might then work. If you set VERBOSE logging and add a _loggg("calling sound") line, you can see whether it is called on the Console.

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post

Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online

  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
  • Create New...