Difference between revisions of "AutoConfigs (SourceMod Scripting)"
m (Removed old language switch) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__FORCETOC__ | __FORCETOC__ | ||
− | {{Languages| | + | {{Languages|AutoConfigs_(SourceMod_Scripting)}} |
SourceMod provides a system for simple plugins to automatically generate config files which get executed on load. This is done via the <tt>AutoExecConfig</tt> native in <tt>scripting/include/sourcemod.inc</tt>. | SourceMod provides a system for simple plugins to automatically generate config files which get executed on load. This is done via the <tt>AutoExecConfig</tt> native in <tt>scripting/include/sourcemod.inc</tt>. | ||
Line 14: | Line 14: | ||
''Note'': If you have multiple <tt>AutoExecConfig</tt> calls marked with '''autoCreate''' being true, the first file to be auto created will prevent any others from being created. Thus, there is no way to automatically split cvars between multiple files. | ''Note'': If you have multiple <tt>AutoExecConfig</tt> calls marked with '''autoCreate''' being true, the first file to be auto created will prevent any others from being created. Thus, there is no way to automatically split cvars between multiple files. | ||
+ | |||
+ | ''Note'': If a cvar has the flag <tt>FCVAR_DONTRECORD</tt>, it will not show up in the autoconfig. A good example of a use for this flag in a cvar, would be for the '''version''' cvar plugins need for the sake of tracking. | ||
Line 37: | Line 39: | ||
[[Category:SourceMod Scripting]] | [[Category:SourceMod Scripting]] | ||
− | |||
− |
Latest revision as of 02:37, 7 June 2017
Language: | English • 한국어 |
---|
SourceMod provides a system for simple plugins to automatically generate config files which get executed on load. This is done via the AutoExecConfig native in scripting/include/sourcemod.inc.
Once all configuration files are executed, OnConfigsExecuted is called. This forward will always be called, even if your plugin had no configs or if it was loaded late.
Contents
Usage
There are three parameters to this call:
- autoCreate - If true, SourceMod will dump all ConVars created by the plugin into a config file if the specified config file does not exist.
- name - Name of the config file (excluding the .cfg extension). If empty, the plugin's name will be used instead, with plugin. prepended. For example, hat.smx becomes plugin.hat.cfg.
- folder - Optionally change the folder under the main cfg folder. By default this is sourcemod, and configs go in cfg/sourcemod/. If empty, the config will be in cfg/.
Note: It is possible to write nested folders; SourceMod will attempt to create each one.
Note: If you have multiple AutoExecConfig calls marked with autoCreate being true, the first file to be auto created will prevent any others from being created. Thus, there is no way to automatically split cvars between multiple files.
Note: If a cvar has the flag FCVAR_DONTRECORD, it will not show up in the autoconfig. A good example of a use for this flag in a cvar, would be for the version cvar plugins need for the sake of tracking.
Example Dump
The autoCreate feature exports a config file that looks like this:
// This file was auto-generated by SourceMod (v1.0.0.986) // ConVars for plugin "hat.smx" // MySQL database // - // Default: "" mysqlk_database "" // MySQL host, use this to configure various // things for your server. // - // Default: "localhost" mysqlk_host "localhost"