diff --git a/config/docs.cfg b/config/docs.cfg index 2ed225dd..a17cb09c 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -340,8 +340,10 @@ docident [minlod] [Minimal level of detail.]; docargument [V] [] [min 25/max 250/default 60]; docident [modeacronyms] [Toggles use of acronyms instead of full modenames in the serverbrowser.]; docargument [B] [] [min 0/max 1/default 0]; -docident [getmodeacr] [Returns the current game mode's acronym.]; -docexample [echo (getmodeacr)] [Example output: CTF]; +docident [getmode] [Returns the current game mode.]; +docargument [N] [0 = full mode name, 1 = mode acronym] [min 0/max 1/default 0] [0]; +docexample [echo (getmode)] [Example output: capture the flag]; +docexample [echo (getmode 1)] [Example output: CTF]; docident [networkdebug] [Enables output of processed network packets.]; docargument [B] [enable network debugging] [min 0/max 1/default 0]; docremark [This variable only has an effect if the client binary is compiled in debug mode.]; diff --git a/config/scripts.cfg b/config/scripts.cfg index 9decc924..0c435d54 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -328,10 +328,6 @@ getscrext = [ ] ] -// getmodeacr - Returns the proper current mode's acronym. -gamemodes_list = "TDM COOP DM SURV TSURV CTF PF BTDM BDM LSS OSOK TOSOK BOSOK HTF TKTF KTF TPF TLSS BPF BLSS" -getmodeacr = [ result (at $gamemodes_list $gamemode) ] - // storesets - Generates an alias (list) of the current values for the given CVARs. omit_idents = "curname curteam idlebots name" diff --git a/docs/reference.xml b/docs/reference.xml index b6dc772d..18c77178 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -1096,7 +1096,7 @@ - + @@ -1587,19 +1587,26 @@ - - Returns the current game mode's acronym. + + Returns the current game mode. - + + Example output: capture the flag + + + Example output: CTF + + + - + Resets all binds back to their default values. diff --git a/source/src/command.cpp b/source/src/command.cpp index 7479b7e0..1bf64a00 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -1490,6 +1490,8 @@ void strpos_(char *haystack, char *needle, char *occurence) void l0(int p, int v) { string f; string r; formatstring(f)("%%0%dd", p); formatstring(r)(f, v); result(r); } +void getmode(int acr = 0) { result(modestr(gamemode, acr ? true : false)); } + COMMANDN(millis, millis_, ARG_IVAL); COMMANDN(strlen, strlen_, ARG_1STR); COMMANDN(substr, substr_, ARG_3STR); @@ -1499,6 +1501,7 @@ COMMAND(systime, ARG_NONE); COMMANDN(timestamp, timestamp_, ARG_NONE); COMMAND(datestring, ARG_NONE); COMMANDN(timestring, timestring_, ARG_NONE); +COMMAND(getmode, ARG_1INT); const char *currentserver(int i, bool internal) // = false) [client version] {