diff --git a/config/docs.cfg b/config/docs.cfg index 124abe36..4c483338 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -205,6 +205,11 @@ docident [checkalias] [Determines if the argument given is an existing alias or docargument [A] [the alias to check for] [] [0]; docexample [hello = ""; echo (checkalias hello)] [Output: 1]; docexample [echo (checkalias oMgThIsAlIaSpRoLlYdOeSnTeXiSt)] [Output: 0]; +docident [checkinit] [Ensures the initialization of an alias.]; +docargument [A] [the alias to check for] [] [0]; +docargument [B] [the optional block of code to ensure that the alias contains] [] [0]; +docexample [checkinit mapstartalways] [Output: if alias mapstartalways does not exist, this command initializes it.]; +docexample [checkinit mapstartalways [ echo New map, good luck! ]] [Output: if alias mapstartalways does not exist, it is initialized, and if the block of code "[ echo New map, good luck! ]" does not exist within the aliases contents, this command adds it.]; docsection [General] docident [addserver] [Adds a server to the list of server to query in the server list menu.]; docargument [S] [the address of the server (hostname or IP)] [] [0]; diff --git a/config/scripts.cfg b/config/scripts.cfg index 09c750d7..913288fe 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -222,7 +222,6 @@ sbconnect = [ ] ] ] - // For those players who use IRC too much... join = [ connect $arg1 $arg2 $arg3 ] add2alias = [ @@ -233,6 +232,7 @@ add2alias = [ addOnLoadOnce = [ add2alias mapstartonce $arg1 ] addOnLoadAlways = [ add2alias mapstartalways $arg1 ] addOnQuit = [ add2alias onQuit $arg1 ] +checkinit = [ if (> $numargs 0) [ if (! (checkalias $arg1)) [ $arg1 = "" ]; if (> $numargs 1) [ if (! (strstr (getalias $arg1) $arg2)) [ add2alias $arg1 $arg2 ] ] ] ] // add2list - Quickly append an element to a list without add2alias'es ";" add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] @@ -330,7 +330,7 @@ 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 ] +gamemodes_list = "TDM COOP DM SURV TSURV CTF PF BTDM BDM LSS OSOK TOSOK BOSOK HTF TKTF KTF" getmodeacr = [ result (at $gamemodes_list $gamemode) ] // setmr - Restart the current demo and fast forward to, a predefined minutes remaining. @@ -344,7 +344,7 @@ setmr = [ tmp_mrem = (*f $arg1 60000) add2alias mapstartonce [ tmp_svol = $soundvol - add2alias mapstartonce [ if (!= $soundvol $tmp_svol) [ soundvol $tmp_svol ] ] // Ensure that soundvol is reset to original setting + checkinit mapstartonce [ if (!= $soundvol $tmp_svol) [ soundvol $tmp_svol ] ] // Ensure that soundvol is reset to original setting sleep (- (* $minutesremaining 60000) $tmp_mrem) [ gamespeed 100; soundvol $tmp_svol; tmp_ff = 0 ] soundvol 0; gamespeed 1000; tmp_ff = 1 ] diff --git a/docs/reference.xml b/docs/reference.xml index 292e5210..fd0e7ef0 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -799,6 +799,30 @@ + + + + + + + Ensures the initialization of an alias. + + + + Output: if alias mapstartalways does not exist, this command initializes it. + + + + Output: if alias mapstartalways does not exist, it is initialized, and if the block of code "[ echo New map, good luck! ]" does not exist within the aliases contents, this command adds it. + + + + + + + + +