Skip to content

CommandScript (CSC)#

Notice

CommandScript is no longer usable within modern engine builds. It was an early concept and will never be supported. This page exists for archival purposes only.

Attention

As of March 29, 2018, CommandScript is not the suggested way to add custom commands in Blamite. We strongly recommend you use BlamScript instead. It has a similar formatting style of CSC and is constantly being expanded and extended. Plus, you can use it to create scripts for your own custom maps. You will receive no support on our forums for CommandScript.

What is CommandScript?#

CommandScript (CSC) is a variant of BlamScript/HaloScript that is used primarily for testing purposes and simple commands.

Creating a Command#

By default, the engine will search in /dev_data/scripts/ for any .csc files. You can place any CSC files there and the engine will automatically detect them.

There are three main parts to a CSC command: * Command Name - This is what will be shown to the user when pressing TAB or running the help command. This is also what is used to run the command. * Description - This is the description shown when the user runs classify to view information on the command. * Action - This is what happens when the command is run.

In CSC, only one action may be run. The way actions are handled are simply put through to the command interpreter. Let's go into more detail. By looking at debug_ui.cpp and examining the HaloConsole struct, we can find the following (shortened) example for the print command:

if (strstr(command_line, "print:"))
{
    const char* color_code = command_line + 5;

    if (strstr(color_code, ":red "))
    {
        AddLog("p>%s", msg);
    }
    else if (strstr(color_code, ":blue "))
    {
        AddLog("p>%s", msg);
    }
    else if (strstr(color_code, ":igold "))
    {
        AddLog("p>%s", msg);
    }
    else if (strstr(color_code, ":pink "))
    {
        AddLog("p>%s", msg);
    }
}
else
{
    AddLog("p>%s", msg);
}

This may look a bit overwhelming - especially when viewing raw code. Let's "zoom in" further:

if (strstr(color_code, ":red "))
{
    AddLog("p>%s", msg);
}

Notice the p>%s? This is what you'll want to look at. The %s is simply a variable used in the print command for its message arguments. Our example command won't be using arguments, so we want to focus on the first part, p>. This is what is being internally used in order to print a message. p> is the default green color used for the print command. These "prefixes" in AddLog functions are what you'll want to use for your command.

Setting up your CSC file#

Here, we provide a skeleton CSC file that you can copy/paste and fill in as desired.

; CommandScript Example
(name "samplecmd")
(desc "This is a test command for CSC (CommandScript)")
(output "p> Good to go!")

If you are familiar with BlamScript, you may find the format above somewhat recognizable. CSC is considered a variant of HSC (hence the similar acronym and name). Please note that CSC scripts can only be commented at the start of a line. In-line comments are NOT supported.

Valid output actions#

Some valid output actions can be found below:

  • p> message - Used to print a message.
  • To use arguments, use the syntax p>:args message. Color codes are identical to those found here.
  • [error] message - Used mainly in error codes. Works identical to p>:red message.

Is that really it? What is the point of this?#

As mentioned before, CSC is primarily used for testing in the process of getting full HSC operating. For more advanced commands, please take advantage of BlamScript (HSC).