What you need to know about calling those functions:
- When you give too few arguments you get CTD.
- When you give enough or too many arguments you might get: "bad argument #1 to 'IsCharacterPlayerControlled' (Pointer<CHARACTER> expected, got userdata)"
So, for each function that exists you do (in a Lua script):
- use pcall to call that function with say 9 arguments that are likely of the wrong type.
- It should give an error, parse the error message, change the first argument to the right one, then try again, change second, etc (there is also chance that the first argument is already of the right type and the error message is about the second argument, be sure to handle that case as well).
- Once the function succeeds remove all extraneous arguments, and try again. If it CTDs you removed too much, which means that the argument type you removed was of the right type and required.
- Be sure to log before and after each action what was succeeded, if empire CTDs restart empire (have it set to automatically start a campaign) and read the logs to find where you were when it crashed and skip that or fix what you did wrong.
For the program you write to auto restart Empire there something you need to be aware of:
- When you start empire.exe it will activate steam (or start it if it's disabled) then quit empire, then steam will restart empire. So take that into account when you check if empire is still running.