_This section only covers specifically how custom game settings are used within B# scripts. For a better idea how B# is used generally, check out the B# Reference Sheet_
When the game is started from the lobby and the values of each setting have been receieved, each value is provided to scripts through a special bootstrap snippet SNIPPET_GameSettingInitialized wherever the custom game setting's id matches the first argument of the snippet.
SNIPPET_GameSettingInitialized("custom_game_setting_id", (value) => {
const settingValue = value.value
// Do stuff with the setting's value
})
These snippets trigger before any other bootstrap snippets so that their effects can be applied before they are used anywhere else. This can be helpful in cases where things like data structures need to be altered based on the provided value(s).
These snippets also trigger every time a game mode is launched, either from a new game or one that was previously saved. This is because B# script files are always parsed at this time, so previous changes in scripts that are not saved need to be re-applied each time a saved game is loaded to keep the behaviour consistent.