Jump to content
The simFlight Network Forums

Assigning a key to a LUA script


Recommended Posts

I've managed to assign a script to a LUA file I have written.

Sorry, I don't understand that. Do you mean you use a Lua plug-in to run some other script? A Lua one too?

Do I have to assign the command LUAclear **** for when the key is released.

LuaClear clears a Lua flag for your plug in. Are you setting a flag you want to clear? What is this about a "Key"?

Pete

Link to comment
Share on other sites

Ok,

I'm not good at writing about things I know little about but ill try to make it a bit clearer. Sorry.

I've written a LUA script and assigned it to a keystroke ( keyboard ) using fsuipc. I noticed that my .lua file also had one suffixed clear. The script I wrote just moves switches in my ifly 737 cockpit ( several at once instead of individually ) I just wonded if I also had to use the " clear" in the dropdown box that's actioned when my assigned key is released.

Hope that's a bit clearer sorry.

Graham

Link to comment
Share on other sites

I've written a LUA script and assigned it to a keystroke ( keyboard ) using fsuipc.

Okay. So you want that script to run when you press a key. Fine.

I noticed that my .lua file also had one suffixed clear.

Sorry, do you mean that the drop down assignments list has LuaClear? Of course. It also has LuaSet. LuaSet sets one of 32 flags for you to test, and LuaClear clears one of 32 flags. That is all. If you aren't using flags in your script then you don't need to use those, of course.

You might also notice that there are other controls in the list too, like LuaKill, LuaValue. Why are you asking specifically about LuaClear Each control has a specific purpose.and they ARE listed and described in the Lua documentation supplied.

Pete

Link to comment
Share on other sites

It's ok Peter.

I just wanted to make sure I didn't have to use the LuaClear to stop the script executing as I lifted the key. But I guess now that's not the case. It's just simple stuff I'm doing really but things seem fine.

Thanks for your programs and also your work and support.

Graham

Link to comment
Share on other sites

I just wanted to make sure I didn't have to use the LuaClear to stop the script executing as I lifted the key. But I guess now that's not the case.

Correct. A Lua script finishes and disappears from memory if its execution runs off its end, past the last line -- UNLESS it has an "event" command which keeps it in memory ready to respond to the declared event(s). The only other way of keeping a script in memory is having it running all the time, in a loop.(eg with "while ..."). But that isn't generally a good idea, though it does have its uses too.

Regards

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

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