Adding new commands is easy! Most of Quotile's commands are written in a language called beanshell.
The command files, which can be edited using a simple text editor such as notepad, can be found in the /Data/commands directory.
To create a new command, simply create a new file in the commands directory (for example, "foo.bsh") and add your code.
Let's peek at an existing command to see how one's built:
// copy.bsh
signature = "pattern,pattern";
documentation = "Copies a pattern between sequencers (p1-p6) or archives (a1-a9)";
syntax = "copy [src-pattern-name] [dst-pattern-name]";
example = "copy p1 a3";
run()
{
src_pattern = arg1;
dst_pattern = arg2;
for (column = 0; column < 32; column++)
{
for (row = 0; row < 16; row++)
{
dst_pattern.set(column,row,src_pattern.get(column,row));
}
}
dst_pattern.draw();
}
The example code listed above can be broken down into three parts:
- Signature
Each command MUST set the signature variable. Setting the signature tells Quotile what parameters are required for the command. The copy command's signature is "pattern,pattern", because it copies data between two patterns. The term "pattern" refers to p1-p6 or a1-a8. The other signature types that you may use are "int", "row", and "column". For example, the command copyrow has the following signature:
signature = "pattern,pattern,row";
The "row" and "column" signature types require the user to enter a valid row or column. This saves you from having to ensure that the user's input is not out of bounds. The "int" signature type requires the user to enter any positive integer.
- Documentation
Although it is not required, each command should set the variables documentation, syntax, and example. These values will be displayed when the user types "help [command]".
- run() function
The run function is called when your command is run. Quotile automatically injects the arguments passed to your function as arg1, arg2, arg3, etc.
The arguments are guarenteed to match your command's signature.
Patterns can be manipulated using the following methods:
// Get the note velocity of the cell at position column,row
pattern.get(column,row);
// Sets the note velocity of the cell at position column,row.
pattern.set(column,row,velocity);
// Redraw the pattern. Call draw() after making changes to a pattern.
pattern.draw();
// Clear a pattern.
pattern.clear();
When Quotile is run, all of the commands are stored in memory. If you need to edit your command, make sure to restart Quotile for your changes to take effect.