cw.setting classclient
Defines the client-side cw.setting library, the controls of the settings menu, each bound to a console variable.
There is one function per control type (slider, drop-down list, number box, text box, check box and color picker),
each taking a category, a label, a tooltip and an optional condition. cw.setting:AddSettings adds Catwork's own
settings.
Summary
Methods
Methods
cw.setting:AddCheckBox(category, text, conVar, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:141Adds a check box to the settings menu that toggles a console variable.
cw.setting:AddCheckBox('#AdminESP', '#EnableAdminESP', 'cwAdminESP', '#EnableAdminESPDesc', function()
return cw.player:IsAdmin(cw.client)
end)
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Name of the console variable
- toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
cw.setting:AddColorMixer(category, text, conVar, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:166Adds a color picker to the settings menu.
The color is stored in four console variables named after conVar with R,
G, B and A appended.
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Prefix of the console variable names
- toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
cw.setting:AddMultiChoice(category, text, conVar, options, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:55Adds a drop-down list to the settings menu that sets a console variable.
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Name of the console variable
- options Map optional, defaults to
nilValues the variable is set to, keyed by the text shown for them - toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
cw.setting:AddNumberSlider(category, text, conVar, minimum, maximum, decimals, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:29Adds a slider to the settings menu that changes a number console variable.
A setting is keyed by its console variable, so adding another setting for the same variable replaces it.
cw.setting:AddNumberSlider('#Framework', '#HeadbobAmount', 'cwHeadbobScale', 0, 1, 1, '#HeadbobAmountDesc')
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Name of the console variable
- minimum Number Lowest value
- maximum Number Highest value
- decimals Number Number of decimal places
- toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
cw.setting:AddNumberWang(category, text, conVar, minimum, maximum, decimals, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:87Adds a number box to the settings menu that changes a number console variable.
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Name of the console variable
- minimum Number Lowest value
- maximum Number Highest value
- decimals Number Number of decimal places
- toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
Adds Catwork's own settings: framework options, language, theme and admin ESP.
Called from the ClockworkInitialized hook. Theme choice is only shown when
the modify_themes config is on, and the ESP settings only to admins.
cw.setting:AddTextEntry(category, text, conVar, toolTip, Condition)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:112Adds a text box to the settings menu that sets a string console variable.
Parameters
- category String Category of the settings menu, or a language phrase
- text String Label of the setting, or a language phrase
- conVar String Name of the console variable
- toolTip String optional, defaults to
nilTooltip of the setting, or a language phrase - Condition Function optional, defaults to
nilReturns whether the setting is shown; shown always whennil
Returns
- String Index of the setting, which is
conVar
cw.setting:Remove(category, text, class, conVar)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:205Removes every setting that matches all of the given fields.
A nil field matches anything, so cw.setting:Remove('#AdminESP') removes a whole category.
Parameters
- category String optional, defaults to
nilCategory of the setting - text String optional, defaults to
nilLabel of the setting - class String optional, defaults to
nilKind of setting:'numberSlider','multiChoice','numberWang','textEntry','checkBox'or'colorMixer' - conVar String optional, defaults to
nilName of the console variable
cw.setting:RemoveByConVar(conVar)
client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:189Removes every setting bound to a console variable.
Parameters
- conVar String Name of the console variable
Removes a setting by its index.
Parameters
- index String Index returned when the setting was added