Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi friends!

Houston, I have a problem!

I made a simple code in LUA to transform a keypress in a Toggle for the APU Start, becase this entry don´t have a toggle option, and i need this in toggle. The code work´s fine if use a simple key like "H" in below exemple. This on and off the Apu Starter when the H key is pressed. But if i try send a keypress with Ctrl + H or Shift + H the code only run a single time, case the event key don´t release.

the code that works

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

apustr = 0

function start_apu(keycode, shifts)

if apustr == 0 then

apustr = 1

ipc.writeSB("0b58", 1)

ipc.display("apu on")

else

apustr = 0

ipc.writeSB("0b58", 0)

ipc.display("apu off")

end

end

event.key(72, 8, "start_apu")

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

The code with error

apustr = 0

function start_apu(keycode, shifts)

if apustr == 0 then

apustr = 1

ipc.writeSB("0b58", 1)

ipc.display("apu on")

else

apustr = 0

ipc.writeSB("0b58", 0)

ipc.display("apu off")

end

end

event.key(72, 9, "start_apu")

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

The 9 in red wait a Ctrl command before the "H" key.

Tanks for help.

Posted

I made a simple code in LUA to transform a keypress in a Toggle for the APU Start, becase this entry don´t have a toggle option, and i need this in toggle. The code work´s fine if use a simple key like "H" in below exemple. This on and off the Apu Starter when the H key is pressed. But if i try send a keypress with Ctrl + H or Shift + H the code only run a single time, case the event key don´t release.

Yes, I can verify this. Looks like a bug. Sorry -- I will fix it today.

The 9 in red wait a Ctrl command before the "H" key.

actually '9' is for Shift. Ctrl would be 10.

Regards

Pete

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.