Skip to content

User Guide ‐ Main interface ‐ Settings ‐ Autosettings

ElGuillermo edited this page Feb 4, 2025 · 76 revisions

🧭 You are here : Wiki home / User Guide / Main interface / Settings / Autosettings


Menu


image

What it is and what it is for

Autosettings contains a set of parameters and commands that will be automatically applied when defined conditions are met.

You can control almost every feature of CRCON through autosettings.
Any auto_settings_capable command on the api/get_api_documentation endpoint can be used.

This lets you do awesome things like enabling or disabling something (such as the seeding automod) during defined hours.

Warning

If enabled in Services, autosettings will always have the precedence over whatever you've manually set in the different settings pages.

Tip

Autosettings are stored as a unique text string that must obey the JSON syntax.
The CRCON interface won't let you save your autosettings if they contain any syntax error.

If you want to manually edit them, we advise you use a JSON syntax verifier.
For example : https://jsonlint.com/.

Here is a blank autosettings set.
It doesn't do anything, as it contains no parameters or commands in defaults and has no rules to evaluate.

{
  "always_apply_defaults": true,
  "can_invoke_multiple_rules": true,

  "defaults": {},

  "rules": [],

  "_available_commands": {},
  "_available_conditions": {}
}

Now we'll see how to configure the different parts.

always_apply_defaults

true :
Defaults commands and parameters values will be applied BEFORE rules evaluation.
Any parameter defined within a rule will prevail over what have been set in Defaults.

false :
Defaults commands and parameters values will only be applied AFTER rules evaluation and if no rule can be applied.

Tip

As an autosettings set can get pretty large, with multiple rules and conditions,
you may face logical flaws when using the same values in defaults and in rules.
To avoid this :

  • Set always_apply_defaultsto true
  • Only set in defaults the static parameters values (those which won't change in any rule)
  • Set the changing parameters values in each rule

Have a look at the Flow chart below.

can_invoke_multiple_rules

Allows multiple rules to be applied when their conditions are met.

true :
If different rules conditions are met, their different commands and parameters values will be applied.
If the same command or parameter is present in different rules whose conditions are met, the last occurrence will get over the previous.

false :
Only commands and parameters values from the first rule whose conditions are met (if any) will be applied.
If a rule's conditions are met, the following rules won't be evaluated.

defaults

Here you can define the default settings that will be applied on your game server.

To define a command, you have to put its corresponding API command name and its mandatory arguments in the defaults branch.
You'll find the complete list of available endpoints here : http://(your VPS IP):8010/api/get_api_documentation
Remember : you only can use the endpoints that are auto_settings_capable

ie : if you want to set a Max queue length of 6 :

{
  "always_apply_defaults": true,
  "can_invoke_multiple_rules": true,
  "defaults": {

    "set_queue_length": {
      "value": 6
    } 

  },
  "rules": []
}

To avoid logical flaws, you'd be advised to :

  • set the always_apply_defaults on true
  • only put in here the main General settings parameters values that should be applied at all times, whatever the conditions.

If you intend to use any of these parameters in your rules,
get it out of the defaults and give it a value in each of your rules.

For example :

Here is an usual set of defaults commands :

{
  "always_apply_defaults": true,
  "can_invoke_multiple_rules": true,
  "defaults": {

    "set_autobalance_enabled": {
      "value": true
    },
    "set_autobalance_threshold": {
      "max_diff": 2
    }
    "set_max_ping_autokick": {
      "max_ms": 300
    },
    "set_queue_length": {
      "value": 6
    },
    "set_vip_slots_num": {
      "value": 1
    },
    "set_profanities": {
      "profanities": [
        "f-word",
        "n-word"
      ]
    },
    "set_map_shuffle_enabled": {
      "enabled": false
    },

  },
  "rules": []
}

rules

Now we've set the defaults parameters, it's time to unleash the real power of autosettings !

A "rule" is a set of commands that will be applied when defined conditions are met.

Conditions

Different conditions are available :

  • player_count : the number of connected players, expressed from a min and a max.
    You can invert the condition using the not parameter.
            "player_count": {
              "min": 0,
              "max": 39,
              "not": false
            }
  • online_mods : the number of moderators logged in a CRCON session, expressed from a min and a max.
    You can invert the condition using the not parameter.
            "online_mods": {
              "min": 0,
              "max": 5,
              "not": false
            }
  • ingame_mods : the number of moderators connected on server, expressed from a min and a max.
    You can invert the condition using the not parameter.
            "ingame_mods": {
              "min": 0,
              "max": 5,
              "not": false
            }
  • current_map : a list of maps in which we'll search for the current one.
    You can invert the condition using the not parameter.
            "current_map": {
              "maps": [
                "stmariedumont_warfare",
                "carentan_warfare"
              ],
              "not": false
            }
  • time_of_day : a time period, expressed from a min and a max hour.
    You can invert the condition using the not parameter.
            "time_of_day": {
              "min": "00:00",
              "max": "24:00",
              "timezone": "UTC",
              "not": false
            }
    You'll find your timezone code here : https://utctime.info/timezone/

Using the not parameter

Each condition can be inverted with the special parameter "not": true
The main use of it is for the time_of_day condition.

For example :
You want to set some parameters during night hours (10pm to 5am).
As you can't set a min value higher than the max value, you can't define such a condition :

(this one won't work)
        "time_of_day": {
          "min": "22:00",
          "max": "5:00",
          "timezone": "UTC"
        }

So, here comes not to the rescue :
We define the "other part" of the day (5am to 10pm), then invert it, making it "10pm to 5am" :

        "time_of_day": {
          "min": "5:00",
          "max": "22:00",
          "timezone": "UTC",
          "not": true
        }

Syntax

To define a ruleset, you have to put its corresponding commands and conditions in the rules branch.

ie :
You want to set your "Idle autokick" time to 0 when there is less than 40 players connected.

{
  "always_apply_defaults": false,
  "can_invoke_multiple_rules": true,
  "defaults": {
    "set_idle_autokick_time": {
      "minutes": 10
    }
  },
  "rules": [ <-- open rules list

    { <-- open a ruleset

      "commands": { <-- open a commands set
        "set_idle_autokick_time": {
          "minutes": 0
        }
      }, <-- close the commands set

      "conditions": { <-- open a conditions set
        "player_count": {
          "max": 39,
          "min": 0
        }
      } <-- close the conditions set

    } <-- close the ruleset

  ] <-- close rules list
}

(delete the red comments if you intend to use this as a template)

As you can define multiple rules, be careful about overlapping conditions.
If, for example, you set two rules, with these conditions :

  • Rule 1 : "if player_count is 0 < x < 50, set the parameter value to x" ;
  • Rule 2 : "if player_count is 40 < x < 100, set the parameter value to y".

...Your two rules conditions will be met when player_count is 41 <= x <= 49.
During that time, if you set can_invoke_multiple_rules to true, the second rule will prevail (value = y).
if you set can_invoke_multiple_rules to false, only the first rule will be applied (value = x).

Uses cases

Map rotation based on the number of players (seed)

As you're trying to seed your server up to 40 players :

  • you do not want the "hard" maps to appear ;
  • you do not want the idle players to be kicked ;
  • you want to allow the players to change team every 5 min ;
  • you want a broadcast message to remind the server is in seed time.

So you either can :

  • (method 1) (prefered) set 2 rulesets :
    • one for 0-39 players ingame ;
    • another one for 40-100 players ingame.
  • (method 2) set defaults to the "seeded" conditions and one ruleset that will prevail the defaults if there is less than 40 players ingame.

Method 1

{
  "always_apply_defaults": true,
  "can_invoke_multiple_rules": false,
  "defaults": {
    "set_queue_length": {
      "value": 6
    },
    "set_vip_slots_num": {
      "value": 1
    },
    "set_max_ping_autokick": {
      "max_ms": 600
    },
    "set_autobalance_enabled": {
      "value": true
    },
    "set_map_shuffle_enabled": {
      "enabled": false
    },
    "set_autobalance_threshold": {
      "max_diff": 2
    }
  },
  "rules": [
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "stmariedumont_warfare",
            "stmereeglise_warfare",
            "carentan_warfare"
          ]
        },
        "set_idle_autokick_time": {
          "minutes": 0
        },
        "set_team_switch_cooldown": {
          "minutes": 5
        },
        "set_broadcast": {
          "message": "The server is seeding until 40 players are connected."
        }
      },
      "conditions": {
        "player_count": {
          "max": 39,
          "min": 0
        }
      }
    },
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "elalamein_warfare",
            "foy_warfare",
            "kursk_warfare"
          ]
        },
        "set_idle_autokick_time": {
          "minutes": 10
        },
        "set_team_switch_cooldown": {
          "minutes": 10
        }
      },
      "conditions": {
        "player_count": {
          "max": 100,
          "min": 40
        }
      }
    }
  ]
}

Method 2

{
  "always_apply_defaults": false,
  "can_invoke_multiple_rules": false,
  "defaults": {
    "set_queue_length": {
      "value": 6
    },
    "set_vip_slots_num": {
      "value": 1
    },
    "set_max_ping_autokick": {
      "max_ms": 600
    },
    "set_autobalance_enabled": {
      "value": true
    },
    "set_map_shuffle_enabled": {
      "enabled": false
    },
    "set_autobalance_threshold": {
      "max_diff": 2
    },
    "set_maprotation": {
      "map_names": [
        "elalamein_warfare",
        "foy_warfare",
        "kursk_warfare"
      ]
    },
    "set_idle_autokick_time": {
      "minutes": 10
    },
    "set_team_switch_cooldown": {
      "minutes": 10
    }
  },
  "rules": [
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "stmariedumont_warfare",
            "stmereeglise_warfare",
            "carentan_warfare"
          ]
        },
        "set_idle_autokick_time": {
          "minutes": 0
        },
        "set_team_switch_cooldown": {
          "minutes": 5
        },
        "set_broadcast": {
          "message": "The server is seeding until 40 players are connected."
        }
      },
      "conditions": {
        "player_count": {
          "max": 39,
          "min": 0
        }
      }
    }
  ]
}

Map rotation based on time of day

You'd like to have a different map set during night hours

{
  "always_apply_defaults": false,
  "can_invoke_multiple_rules": false,
  "defaults": {
    "set_maprotation": {
      "map_names": [
        "elalamein_warfare",
        "foy_warfare",
        "kursk_warfare"
      ]
    },
    "set_broadcast": {
      "message": "Day time map rotation"
    }
  },
  "rules": [
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "stmariedumont_warfare",
            "stmereeglise_warfare",
            "carentan_warfare"
          ]
        },
        "set_broadcast": {
          "message": "Night time map rotation"
        }
      },
      "conditions": {
        "time_of_day": {
          "min": "5:00",
          "max": "22:00",
          "timezone": "UTC",
          "not": true
        }
      }
    }
  ]
}

Map rotation based on number of players + time of day

You'd like to have a different map set during night hours, and also according to the number of players.
So, that would give something like :

  • "Easy" maps during night hours" ;
  • "Easy + hard maps during day time" ;
  • "Skirmish maps if there's less than 40 players, whatever the time".
{
  "always_apply_defaults": false,
  "can_invoke_multiple_rules": true,
  "defaults": {
    "set_maprotation": {
      "map_names": [
        "stmariedumont_warfare",
        "stmereeglise_warfare",
        "carentan_warfare",
        "elalamein_warfare",
        "foy_warfare",
        "kursk_warfare"
      ]
    }
  },
  "rules": [
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "stmariedumont_warfare",
            "stmereeglise_warfare",
            "carentan_warfare"
          ]
        },
        "set_broadcast": {
          "message": "Night time map rotation"
        }
      },
      "conditions": {
        "time_of_day": {
          "min": "5:00",
          "max": "22:00",
          "timezone": "UTC",
          "not": true
        }
      }
    },
    {
      "commands": {
        "set_maprotation": {
          "map_names": [
            "mortain_skirmish_day",
            "mortain_skirmish_overcast",
            "SMDM_S_1944_Day_P_Skirmish",
            "SMDM_S_1944_Night_P_Skirmish",
            "SMDM_S_1944_Rain_P_Skirmish"
          ]
        },
        "set_broadcast": {
          "message": "Less than 40 players ingame - Only skirmish maps"
        }
      },
      "conditions": {
        "player_count": {
          "max": 39,
          "min": 0
        }
      }
    }
  ]
}

Using a map rotation in seed, a votemap when seeded

Modifying user settings

For the user_config endpoints and only those settings (for example set_votemap_config), you can provide partial values, so only the provided values will change.
All other commands require you to pass every required parameter.

For example : you can pass just the enabled parameter, so you don't have to duplicate all of your other settings :

  "rules": [
    {
      "commands": {
        "set_votemap_config": {
          "enabled": true
        }
      },
      "conditions": {
        "player_count": {
          "max": 39,
          "min": 0
        }
      }
    }
  ]

Votemap whitelist

Note

Make sure the Votemap feature feature is enabled and configured.

Defining a whitelists in autosettings is similar as map rotation lists :
You have to set them in "commands" parts, like this :

        "set_votemap_whitelist": {
          "map_names": [
            "carentan_warfare",
            "stmariedumont_warfare",
            "stmereeglise_warfare"
          ]
        }

You can have different whitelists according to different rules conditions, exactly as map rotations.

Complete template

Enables votemap if players number is >= 40, sets a map rotation otherwise.

{
  "always_apply_defaults": true,
  "can_invoke_multiple_rules": true,
  "defaults": {},
  "rules": [
    {
      "commands": {
        "set_votemap_config": {
          "enabled": false
        },
        "set_maprotation": {
          "map_names": [
            "stmariedumont_warfare",
            "stmereeglise_warfare",
            "carentan_warfare"
          ]
        }
      },
      "conditions": {
        "player_count": {
          "max": 39,
          "min": 0
        }
      }
    },
    {
      "commands": {
        "set_votemap_config": {
          "enabled": true
        },
        "set_votemap_whitelist": {
          "map_names": [
            "elalamein_warfare",
            "foy_warfare",
            "kursk_warfare"
          ]
        }
      },
      "conditions": {
        "player_count": {
          "max": 100,
          "min": 40
        }
      }
    }
  ]
}

Flow chart

autosettings_flow

HLL Community RCON Wiki

📦 Getting Started

📖 User Guide

🕵️ Main interface

Home

Views
  • Live (waiting for update)
  • Team (waiting for update)
Maps
Records
Settings
Webhooks
Automods
Others
Stats

🧑‍🤝‍🧑 Public (stats) interface

(TODO)

🧙‍♂️ Admin panel

Additional Setup

🛠️ Additional installs

💾 Backup

🚚 Moving/changing servers

👽 Specific server providers setups

⚗️ Developer Guides

🆘 Troubleshooting & Help

Common procedures

Need help ?

Clone this wiki locally