The function is called when the Start event occurs. The function is intended for one-time execution of actions implemented in the script. There are two function types.
The version that returns the result
The value of int type displayed in the Journal tab.
The entry "script script_name removed (result code N)" is created in the terminal journal after a script execution is complete. Here, N is a value returned by the OnStart() function.
The OnStart() call that returns the execution result is recommended for use since it not only allows for a script execution, but also returns an error code or other useful data to analyze the script execution result.
The version without a result return is left only for compatibility with old codes. It is not recommended for use
OnStart() is the only function for handling events in scripts. No other events are sent to scripts. Start event is not passed to EAs and custom indicators.