Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Pete,

Is my understanding below correct?

If a key assignment is made using Lua ScriptName under the FSUIPC Key assignments tab, then when that key is pressed the Lua file ScriptName is loaded and run. 

In contrast to this, if a key assignment is made using LuaToggle ScriptName along with a Parameter field entry (flag number), then when the key is pressed the associated flag value is toggled, but that is all, the script ScriptName is not loaded and run at that point due to the key stroke.  So if ScriptName is to detect and process the changed flag value, [e.g., by using event.flag( ) ], ScriptName must of previously been loaded and run such as by listing it under an [Auto] section in the FSUIPC.ini file.

Thanks,

Al

Posted
8 hours ago, ark1320 said:

If a key assignment is made using Lua ScriptName under the FSUIPC Key assignments tab, then when that key is pressed the Lua file ScriptName is loaded and run. 

Yes, that's one way to run a plug-in.

8 hours ago, ark1320 said:

In contrast to this, if a key assignment is made using LuaToggle ScriptName along with a Parameter field entry (flag number), then when the key is pressed the associated flag value is toggled, but that is all, the script ScriptName is not loaded and run at that point due to the key stroke.

Correct. None of the assignable Lua controls other than Lua <name> and LuaDebug <name> actually load and run a plug-in. they are all designed to talk to or affect the way a running plug-in acts. There's no point in toggling a flag from one state to another n a plug-in which has just been loaded -- it might as well simply assume such a toggle in the first place.

8 hours ago, ark1320 said:

So if ScriptName is to detect and process the changed flag value, [e.g., by using event.flag( ) ], ScriptName must of previously been loaded and run such as by listing it under an [Auto] section in the FSUIPC.ini file.

Yes. Scripts intended to remain running can be loaded via [Auto] sections, or by macro, or by other Lua plug-ins, or, still, by assignment to a Lua <name> control.

The difference between a plug-in designed to stay running and one which just does something and terminates is the presence of event functions which tell it to wait for something to happen -- like a flag being toggled, or an offset changing, and so on.

If you want to assign a key or button to a plug-in which just does something and exits, but you want it to do somethnig different each time, use the parameter value when assigning to Lua <name>. That's passed to the plug-in as the variable "ipcPARAM".

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.