The internal custom command system has been removed in v2.7 in favor of the more powerful scripting system. The Custom Command Xystem (CCX) is a script, which replaces the old system and provides more features as well as lots of new functions. It is an intelligent flexible parsing system/custom command system. CCX can allow more advanced users to create complex dynamic commands quickly without having to create separate scripts, while still keeping the simplicity of the old custom command system.
Snap is currently working on the conversion from plugin to script. For now, you can download the the current version of the CCX script here: http://www.stealthbot.net/forum/index.php?showtopic=806 (Note: You need an account for the forums to view the topic and download the attachment.)
- Go to the link above.
- Save the attachment to your scripts folder.
- Reload your scripts.
1. Go to the link above.
- If you get the following error message, you have to log in:
[#103139] You do not have permission to view this forum.
- If you do not have an account yet, you must create one.
2. Save the attachment to your scripts folder.
- If the script is being opened in your browser, either save the page or go back to the topic and right click on the attachment and then choose "Save link/target as..." (the exact text might differ depending on your browser).
- Either download the file directly to the scripts folder or download it to a temporary folder and move it to the scripts folder afterwards.
- You have to put the file in the scripts folder of your current profile (Scripting > Open Script Folder). Do not put it in the Default/scripts folder of your StealthBot installation path as this will have no effect on your current profile.
3. Reload your scripts.
- Either use the menu Scripting > Reload Scripts or the respective hot key CTRL + R.
- You might get a pop-up informing you that CCX has been updated and asking if you want to see the changelog.
- If you see the following message, the script was installed successfully and you are able to add custom commands now:
CCX: Custom Command Xystem Loaded with -1 CC's
|addcc||Adds a custom command.|
|appendcc||Appends a custom command.|
|setcc||Changes the required access/flags of a custom command.|
|editcc||Changes the output of a custom command.|
|renamecc||Renames a custom command.|
|listcc||Shows a list of available custom commands.|
|findcc||Finds available custom commands.|
|showcc||Shows the code of a custom command.|
|delcc||Deletes a custom command.|
|sortcc||Sorts the list of custom commands (console only).|
|Other (more advanced) commands|
|testcc||Tests the code of a custom command.|
|reloadcc||Reloads custom commands from the text file.|
|clipcc||Copies the code of a custom command to the bot owner's clipboard.|
|rfunctions||Shows a list of registered functions.|
Note: A more detailed documentation can be found at http://snapnjacks.com/CCXDoc.php. Visit this site for more complex examples and an overview of the new functions provided by CCX.
To add custom commands to your bot you have to use the addcc command. You can also use the alias addcmd (like the old version). The command cmdadd (also from the old version) will not work though.
The syntax for adding commands is as follows:
<trigger>addcc <name> <access/flags> <command response>
In the old version the order of the command name and the required access were interchanged. Except for this minor change the commands behave exactly the same. Remember that, when you try to add commands from inside the bot, you have to use the bot's internal trigger "/".
A new feature of CCX is that you can assign flags to custom commands now as well. You have the possibility to assign flags only, access only or both combined.
You are able to use arguments, which represent parameters passed to the command. There are unlimited arguments, number them accordingly. Argument 1 would be
%1, Argument 2 is
%2 and so on. The code
%rest stands for all remaining arguments. The code
%user in CCX) represents the person issuing the command.
You can define another line by using "& " in your command. Please note that there must be a space after the "&".
/addcc argtest 50 Argument 1: %1& Argument 2: %2& Argument 3: %3
<Stealth> .argtest First Second Third
<StealthBot> Argument 1: First <StealthBot> Argument 2: Second <StealthBot> Argument 3: Third
/addcc serve 50/M /me pours a refreshing glass of %rest& /me hands the glass to %1, compliments of %0 :)
<Stealth> .serve Mad Pepsi One
<StealthBot pours a refreshing glass of Pepsi One> <StealthBot hands the glass to Mad, compliments of Stealth :)>
- The command is accessible for users with 50+ access or flags M.
%0is the user who executed the command: Stealth.
%1is the first argument, in this case the person being served: Mad.
%restis the rest of the message, after the highest-numbered argument you used in making the custom command. In this case what you want to serve to them (argument 2 and 3 combined): Pepsi One.
You can use Battle.net commands in custom commands (as shown with
/me in example 2). Simply put the code in front of the command. For example, if you want to whisper the command response to the person who issued the command, you have to add
/w %0 (or
/w %user respectively) in front of the command response. Note that built-in commands (like shitlist, safeadd, etc.) do not work.
/addcc rules 50 /w %0 1) You do not talk about Fight Club.& /w %0 2) You DO NOT talk about Fight Club!& /w %0 ...
<To Stealth> You do not talk about Fight Club. <To Stealth> You DO NOT talk about Fight Club! <To Stealth> ...
When you add a command whose name is already taken, the bot will respond accordingly and add the command with a different name (e.g. "rules1" if "rules" is already taken).
You can change the output of an existing custom command using the editcc command. Example:
/editcc rules There are no rules yet.
If you just want to add additional text to the end of an existing command, you can use the command appendcc. Example:
/appendcc rules Stay tuned for updates!
If you want to change the required access or flags for a custom command, you have to use the setcc command. Example:
/setcc rules 20
With the showcc command you can look at the code of a custom command. It will show what you typed to create the command. Example:
You can also rename custom commands using the renamecc command. Example:
/renamecc rules1 newrules
All custom commands are saved in the ccx_CC.txt file, which is located in the plugins folder of your bot's profile. Theoretically you could manually edit the custom commands in the file. However, this is not recommended. You are supposed to use the respective CCX commands.
To delete a custom command use the delcc command. Alternatively you can use its alias delcmd. Example:
Users can use the listcc command to list all custom commands they have access to. Alternatively they can use the aliases cclist and cmdlist (as known from the old system). The commands are listed in the order they were created. The bot owner can use the sortcc command from inside the bot to sort them alphabetically.
If you are looking for a certain command, you can use the findcc command to search for it. Example:
This will list all commands that contain the phrase "rule" and that you have access to.
Upgrade from StealthBot v2.6R3
CCX can automatically convert your old custom commands from your StealthBot v2.6R3 to the new format. To do so, simply put the commands.dat file from your old StealthBot folder into the profile folder of your StealthBot v2.7+ with CCX installed. You have to reload your scripts if you did it while the bot was opened.
If you have problems installing the CCX script or if you get any errors while installing or using CCX, please make a topic in the Scripting forum.