Context Object
The first argument given to script functions is known as the "context object" or "context".
Syntax
The context object always contains the following keys:
caller
: the name of the user that initiated this script execution, as a string.calling_script
: the full name of the script that called this script, as a string. This is only filled if the script was called via subscript. If the script was called from the CLI or via scriptor, this value is null instead.this_script
: the full name of this script, as a string.cols
: the width of the main shell in the client running this script in characters, as a number. If called by automation (such as a cron_bot execution), 128 is used.rows
: the height of the main shell in the client running this script in characters, as a number. If called by automation, 64 is used.
The following properties may also be present:
is_scriptor
: true if the script is being run via a scriptor.is_brain
: true if the script execution was started by a cron_bot.
Examples
CLI Run
{
caller: "my_cool_user",
calling_script: null,
this_script: "my_cool_user.test_script",
cols: 125,
rows: 78
}
cron_bot
run
{
caller: "my_cool_bot_user",
calling_script: null,
this_script: "my_cool_bot_user.bot_brain",
is_brain: true,
cols: 128,
rows: 64,
}
Subscript call
{
caller: "my_cool_user",
calling_script: "my_cool_user.other_script",
this_script: "my_cool_user.test_script",
cols: 125,
rows: 78
}
Scriptor call
{
caller: "my_cool_user",
calling_script: null,
this_script: "my_cool_user.test_script",
is_scriptor: true,
cols: 125,
rows: 78
}