Overview
A quick guide on how to create your own commands using project_smok administration system.
Introduction
This guide explains how you can create your own chat and console commands using the project_smok add-on. Everything about this add-on is documented in it’s source code page[github.com]. This guide was made for versions of project_smok v2.0.0 and higher.
[link]Follow each section in order to successfully create a custom command. If you have any questions, suggestions or issue reports, feel free to ask, share and report them in the add-on’s discussions:
You can also find some shared custom commands in this discussion
Locating the configuration files
project_smok lets you customize settings and create commands and much more through the configuration files. These configuration files are created after you start a map at least once.
You can locate the configuration files under the directory
The scripts folder allows you to create custom commands (or run custom scripts).
In this folder, there are 2 files
- example_command_file.nut: An example command file
- file_list.txt: List of file names to include from this folder
You can read/edit the example file with any text editor.
Creating a new command file
Create a new text file and name it however you want with .nut Squirrel language file extension.
Start editing the file you’ve created with a text editor ( notepad, VS Code etc. )
Custom command file format
To start creating a command, you need to know a bit of programming, the Squirrel scripting language and what is provided to you in the global scope. You can check the example command file for some help.
If you just want to use someone else’s script, you can copy and paste it into this file and skip to step 5.
If you want to create a new command from scratch, follow these steps
- Pick a command name and initialize a table under PS_Scripts table.
- Decide the minimum user level required for the use of this command with MinimumUserLevel value.
- Write some documentation about the command with Help table.
- Write the function which takes 3 parameters (player, arguments, text) with Main function.
- Scripting part is completed. Write the file name into file_list.txt to include your command script.
- DONE. Start a game and check your console to see if the command was registered.
Using the command you’ve created
Check how your documentation of the command looks from chat
Result of the command called from chat
Result of the command called from console
Reloading custom commands in-game
You can edit your custom command files and then reload them while you’re in-game, using the reload_scripts command. This command will apply all the changes you’ve made to the command files.
Example used in this guide
Example contents of my_command_file.nut file is given below.