checkinit

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6413 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Bukz
2011-05-10 09:14:29 +00:00
parent 68b05f1204
commit 9ac75ac9aa
3 changed files with 32 additions and 3 deletions
+5
View File
@@ -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];
+3 -3
View File
@@ -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
]
+24
View File
@@ -799,6 +799,30 @@
<arguments>
<argument token="A" description="the alias to check for"/>
</arguments>
<references>
<identifierReference identifier="checkinit"/>
</references>
</command>
<command name="checkinit">
<description>Ensures the initialization of an alias.</description>
<examples>
<example>
<code><![CDATA[checkinit mapstartalways]]></code>
<explanation>Output: if alias mapstartalways does not exist, this command initializes it.</explanation>
</example>
<example>
<code><![CDATA[checkinit mapstartalways [ echo New map, good luck! ]]]></code>
<explanation>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.</explanation>
</example>
</examples>
<arguments>
<argument token="A" description="the alias to check for"/>
<argument token="B" description="the optional block of code to ensure that the alias contains"/>
</arguments>
<references>
<identifierReference identifier="checkalias"/>
</references>
</command>
</identifiers>