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

Adds a check box to the settings menu that toggles a console variable.
Adds a color picker to the settings menu.
Adds a drop-down list to the settings menu that sets a console variable.
Adds a slider to the settings menu that changes a number console variable.
Adds a number box to the settings menu that changes a number console variable.
Adds Catwork's own settings: framework options, language, theme and admin ESP.
Adds a text box to the settings menu that sets a string console variable.
Removes every setting that matches all of the given fields.
Removes every setting bound to a console variable.
Removes a setting by its index.

Methods

cw.setting:AddCheckBox(category, text, conVar, toolTip, Condition)

client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:141

Adds 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 nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:166

Adds 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 nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:55

Adds 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 nil Values the variable is set to, keyed by the text shown for them
  • toolTip String optional, defaults to nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:29

Adds 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 nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:87

Adds 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 nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:112

Adds 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 nil Tooltip of the setting, or a language phrase
  • Condition Function optional, defaults to nil Returns whether the setting is shown; shown always when nil

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:205

Removes 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 nil Category of the setting
  • text String optional, defaults to nil Label of the setting
  • class String optional, defaults to nil Kind of setting: 'numberSlider', 'multiChoice', 'numberWang', 'textEntry', 'checkBox' or 'colorMixer'
  • conVar String optional, defaults to nil Name of the console variable

cw.setting:RemoveByConVar(conVar)

client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:189

Removes every setting bound to a console variable.

Parameters

  • conVar String Name of the console variable

cw.setting:RemoveByIndex(index)

client gamemodes/catwork/gamemode/core/libraries/cl_setting.lua:183

Removes a setting by its index.

Parameters

  • index String Index returned when the setting was added

Defined in