Jump to content
The simFlight Network Forums

Recommended Posts

Posted


Hello everyone, I want to know how to program a LUA script that allows me to know whether a fsuipc macro has been executed or not.

I also want to know how to execute a fsuipc within a loop and how to stop the fsuipc macro execution when condition B1 = true.

Posted

First lets clarify some terminology.
A macro is just a collection of commands, executed in order, contained in a macro file, i.e .a file ending *.mcro. Macros can be called/executed by assigning to a button or key press/release, when entering/leaving an axis range, or by the lua command ipc.macro.
A lua script or plugin is a script in the lua programming language, contained in a *.lua file, that can be ran either automatically, on a button or key press/release, or  started by another lua script.

18 hours ago, javiersan said:

I want to know how to program a LUA script that allows me to know whether a fsuipc macro has been executed or not.

There are two way sof doing this. The lua script can monitor for the same event that starts the macro, so that when the macro is called the lua script also receives the event. e.g. if the macro is started on a button press, the lua script can wait for an event on the same button press using event.button. Alternatively, the macro could perform an action that can be picked up by the lua script, such as setting a flag or writing to an offset.

18 hours ago, javiersan said:

I also want to know how to execute a fsuipc within a loop and how to stop the fsuipc macro execution when condition B1 = true.

This doesn't make sense, FSUIPC runs until it exists - it makes no sense to 'execute fsuipc in a loop'. And a macro is just a sequence of commands with no control - it will execute until the end once started (ther is no conditional logic in a macro). If you mean that you want a lua to loop in a lua script until a condition is met, then use a while loop, e.g.
 

while(not B1)
do
   ...
end

See https://www.tutorialspoint.com/lua/lua_while_loop.htm.

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.