Including other script files in your package

ScripterX (v3.0.4.7+) now has the ability to 'include' other scripts from within your main Package.js file.   This isn't a conventional javascript command, it is internal to ScripterX, and is very, very simple.

Simply call ScripterX.Include.Script("path_to_your_script_file.js");

Relative or full path?

The path you specify in your includes is relative to your package's installation root directory; you should not include the FULL path, only the part of the path from your package root.  Let's take a look at an example.

My package files are located at /Packages/mypackageinstallationId/ and I have a file in the same directory as Package.js, called test.js that I want to include in my package.  I simply use:

ScripterX.Include.Script("test.js");

So if you had test.js in another folder inside your package root directory, for example   /Packages/mypackageinstallationId/OtherScripts, I would use ScripterX.Include.Script("OtherScripts/test.js");

ScripterX will automatically use your package installation directory as your root directory - this also restricts the ability to include scripts from other packages or sources on the server, for security.

Includes are loaded AFTER Package.js, and BEFORE _package_init() is called.