Other great resources: Official JS API docs, Scripting Forum
scriptName
The filename of the main script loaded in to a particular scripting environment...
Syntax
scriptNameValues
This is the filename, without the extension or path, of the main script that was loaded in to your scripting environment.
Examples:
if the script loaded was "multiplay/skirmish/nullbot.js" the scriptName would be "nullbot"
for rules.js, it will be "rules"
for scavfact.js, it will be "scavfact"
Notes
This global is useful for console or chat messages, particularly when an AI is communicating with human players.
Example
// say hello to the human game host (who is always player 0)
chat(0, "Hi, I'm "+scriptName);