Perk config is very versatile, but it can be even more so.
Example
There could be an unused-by-default call function which is able to execture commands provided via perk's settings, for example:
"myslapperk"
{
"name" "My Slap Perk"
"good" "0"
(...)
"settings"
{
"command" "sm_slap"
"arg1" "%target%" // %target% gets replaced with user ID player who rolled the perk
"arg2" "100" // slap damage
}
"call" "CustomCommand_Call"
"init" "CustomCommand_Init"
}
Overview
The command can be provided via the command setting and its arguments through consecutive argN settings. The function called CustomCommand_Call will parse and build a command that is run on the server, targeting the player who rolled this particular perk.
%target% will be replaced with the user ID of a player by RTD, to make sure addressing is unique and not name-dependent. Furthermore, %target% can be specified in any argument, since it's up to the command to define which argument is the target.
CustomCommand_Init will verify whether the command is valid and is safe (see section below) to run while the config is parsed. This is helpful for debugging because you can see a message in the server logs whether you configured something incorrectly.
Security
Running server commands in an unsolicited way is bad. CustomCommand_Call will always check flags of the provided command. Commands will the following flags should error out without being executed:
Perk config is very versatile, but it can be even more so.
Example
There could be an unused-by-default
call
function which is able to execture commands provided via perk's settings, for example:Overview
The command can be provided via the
command
setting and its arguments through consecutiveargN
settings. The function calledCustomCommand_Call
will parse and build a command that is run on the server, targeting the player who rolled this particular perk.%target%
will be replaced with the user ID of a player by RTD, to make sure addressing is unique and not name-dependent. Furthermore,%target%
can be specified in any argument, since it's up to the command to define which argument is the target.CustomCommand_Init
will verify whether the command is valid and is safe (see section below) to run while the config is parsed. This is helpful for debugging because you can see a message in the server logs whether you configured something incorrectly.Security
Running server commands in an unsolicited way is bad.
CustomCommand_Call
will always check flags of the provided command. Commands will the following flags should error out without being executed: