Jump to content
Sign in to follow this  
VeryBumpy

Converting LINDA Lua script to FSUIPC script?

Recommended Posts

I'm as useful at coding as an eye dropper at a forest fire.

I'm trying to perform a simple toggle: Toggle open/close the front door

Note:the default FSX door toggle key command map does not work in this plane and I do not want to use a mouse for this

 

Is anyone good at Lua coding FSUIPC that can help please?

The LINDA code below works with a button within LINDA but I want to map a keyboard press within FSUIPC.

function DC6_ExitFwd_open ()

    ipc.writeLvar("dc6_446_obj", 1)
    DspShow ("Frnt", "open")
end

function DC6_ExitFwd_close ()

    ipc.writeLvar("dc6_446_obj", 0)
    DspShow ("Frnt", "clse")
end

function DC6_ExitFwd_toggle ()
	if _tl("dc6_446_obj", 0) then
       DC6_ExitFwd_open ()
	else
       DC6_ExitFwd_close ()
	end
end

 

Edited by VeryBumpy
syntax

Share this post


Link to post
Share on other sites

For info sake to others....after much, much research and suggestions from John Dowson, this is a working answer:

function DC6_ExitFwd_open ()
    ipc.writeLvar("dc6_446_obj", 1)
    ipc.display("Front door OPEN")
    ipc.sleep(4000)
end

function DC6_ExitFwd_close ()
    ipc.writeLvar("dc6_446_obj", 0)
    ipc.display("Front door CLOSED")
    ipc.sleep(4000)
end

function DC6_ExitFwd_toggle ()
    if ipc.readLvar("dc6_446_obj") == 0 then
       DC6_ExitFwd_open ()
    else
       DC6_ExitFwd_close ()
    end
end
 

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...