Command Interpolation
Server Name Command Interpolation
Server Name Command Interpolation (SNCI) is the feature included in Megapatch II.
It provides a simple and easy form of scripting to server names. It provides more power than SMod's server name variables if used properly. These can be used on the player list title as well.
How to use SNCI
The syntax for commands is {command_name,arg1,arg2,arg...} , which is placed within the server name. All characters can be escaped in order to have { , } , or , in closures. It means that you need to put a backslash (\) before { , } , or , if you want to use them in your servername. Whitespace of the command name or arguments is not trimmed.
Example
In this scenario, the following will be our server name:
<color=#b0b>The Stetzone</color>\n<color=#{random_list,b00,0b0,b0b}>Ruleless Anarchy</color>\n<color=#fc0><size=10>
{scp_counter} SCPs | {add,{alive_team,1},{alive_team,3}} Foundation Personnel | {add,{alive_team,2},{alive_team,4}}
Insurgents/Prisoners {warhead_detonated,| ☢ WARHEAD DETONATED ☢,}\n[{round_duration_minutes}:{round_duration_seconds}]
</size></color>
On the server list, it displays as a 20/20 server with the name of:
<color=#b0b>The Stetzone</color>
<color=#b00>Ruleless Anarchy</color>
<color=#fc0><size=10>3/5 SCPs | 12 Foundation Personnel | 4 Insurgents/Prisoners | ☢ WARHEAD DETONATED ☢ [8:29]</size></color>
The reason why it displays is:
- The interpolator encounters {random_list,b00,0b0,b0b}.
- The interpolator picks a random number from 1-3 (amount of items).
- The interpolator resolves that item just in case it has closures within it.
- Returned b00.
- The interpolator then moves to {scp_counter}.
- There were 5 SCPs at the start.
- There are only 3 now.
- Returned 3/5 .
- The interpolator keeps moving and finds {add,{alive_team,MTF},{alive_team,RSC}}
- The interpolator resolves the arguments.
- {alive_team,1} resolves to 9.
- {alive_team,3} resolves to 3.
- The interpolator adds the results together.
- Returned 12.
- The interpolator resolves the arguments.
- The interpolator scrolls along and sees {add,{alive_team,2},{alive_team,4}}. This is the same as #3 so it returned 4and we'll skip it.
- The interpolator goes to the next closure: {warhead_detonated,| ☢ WARHEAD DETONATED ☢,}
- The warhead has detonated so it selects the first argument.
- The interpolator resolves the first argument.
- Returned | ☢ WARHEAD DETONATED ☢
- The interpolator gets to {round_duration_minutes}.
- The round has been going on for 8 minutes, 29 seconds.
- Returned 8.
- The interpolator finally reaches {round_duration_seconds}.
- The round has been going on for 8 minutes, 29 seconds.
- Returned 29.
Commands
Server info
Name | Arguments | Returns |
---|---|---|
ip | None | The IP address of the server. |
port | None | The port of the server . |
number | None | Assuming the port starts at 7777, the server number. |
version | None | The leading compatible version. |
Player Counts
Name | Arguments | Returns |
---|---|---|
player_count | None | The current number of players on the server |
full_player_count | None; [full] | The current out of maximum players on the server, or full if full. |
max_players | None | The maximum number of players on the server. |
Round Info
Name | Arguments | Returns |
---|---|---|
round_duration_minutes | None | The duration of the round in minutes. |
round_duration_seconds | None | The duration of the round in seconds, ignoring minutes (always <60). |
kills | None | Total kills this round. |
kills_frag | None | Total frag grenade kills this round. |
mtf_respawns | None | Total MTF respawns this round. |
warhead_detonated | None;[detonated][undetonated] | Detonated or undetonated (default "☢ WARHEAD DETONATED☢" or
empty) depending on whether or not the warhead has been detonated. |
Alive Players
Name | Arguments | Returns |
---|---|---|
alive_role | [role ID] | The amount of players with that role alive. Role ID can be a name or integer ID. |
alive_team | [team ID] | The amount of players with that team alive. Team ID can be a name or integer ID. |
Team Numbers for alive_team
Team Name | Team Number |
---|---|
SCP | 0 |
MTF & Facility Guard | 1 |
Chaos Insurgency | 2 |
Scientist | 3 |
ClassD | 4 |
Spectator | 5 |
Tutorial | 6 |
SCP Info
Name | Arguments | Returns |
---|---|---|
scp_counter | None | Alive SCPs (except for zombies) out of initial SCPs of the round. |
scp_start | None | Initial SCPs of the round. |
scp_killed | None | SCPs killed this round. |
scp_kills | None | Kills by SCPs this round. |
zombies_recalled | None | Zombies recalled this round. |
Class D Info
Name | Arguments | Returns |
---|---|---|
classd_counter | None | Escaped Class Ds out of initial Class Ds of the round. |
classd_start | None | Initial Class Ds of the round. |
classd_escaped | None | Class Ds escapees this round. |
Scientist Info
Name | Arguments | Returns |
---|---|---|
scientist_counter | None | Escaped scientists out of initial scientists of the round. |
scientist_start | None | Initial scientists of the round. |
scientist_escaped | None | Scientist escapees this round |
Randomization
Name | Arguments | Returns |
---|---|---|
random | [max]; [min] [max] | Random decimal between the min (default 0) and max. |
random_list | [item 1] [item 2] […] | A random item |
Constants
Name | Arguments | Returns |
---|---|---|
constant_e | None | Euler's number. |
constant_pi | None | Pi (π). |
Operations
Name | Arguments | Returns |
---|---|---|
add | [a] [b] | a + b |
subtract | [a] [b] | a - b |
multiply | [a] [b] | a * b |
division | [a] [b] | a / b |
power | [a] [b] | a ^ b |
log | [value]; [base] [value] | Log [base] (default 10) of [value]. |
ln | [value] | Natural log of [value] |
Rounding
Name | Arguments | Returns |
---|---|---|
round | [value] | Rounds to the nearest whole number. |
round_up | [value] | Rounds up to the nearest whole number. |
round_down | [value] | Rounds down to the nearest whole number. |
Comparisons
Name | Arguments | Returns |
---|---|---|
equals | [a] [b] | Checks equality of [a] and [b] by string representation. |
greater | [a] [b] | "True" if [a] > [b], else "False". |
lesser | [a] [b] | "True" if [a] < [b], else "False". |
greater_or_equal | [a] [b] | "True" if [a] >= [b], else "False". |
lesser_or_equal | [a] [b] | "True" if [a] <= [b], else "False". |
Boolean Logic
Name | Arguments | Returns |
---|---|---|
not | [value] | Inverts [value]. |
or | [a] [b] | "True" if [a] OR [b] are true, else "False". |
and | [a] [b] | "True" if [a] AND [b] are true, else "False". |
xor | [a] [b] | "True" if [a] OR [b] but NOT [a] AND [B], else "False". |
if | [condition] [a]; [condition] [a] [b] | [a] if [condition] is true else [b] (default empty) |