more updates
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6516 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -167,6 +167,7 @@ Cubescript
|
||||
[*] convertcase - Converts a list of strings to lower/uppercase characters.
|
||||
[*] testchar - Tests a character argument for certain things. (e.g. echo (testchar a) // Output: 0 // It is not a 0-9 digit.)
|
||||
[*] testlist - Tests a list argument for certain things. (e.g. echo (testlist "1 2.3 3.14") // Output: 1 // It is a valid list of ints/floats.)
|
||||
[*] listaverage - Returns the average of a list of numbers. (Supports ints and floats - e.g. echo (listaverage "2 5 5") // Output: 4.0)
|
||||
[*] player1 - // TODO explain // Also getposition and positiontype have been removed in favor of this command which does that and a lot more. :p
|
||||
[*] Multiple Idents - New helper aliases for voting for SURV, TPF, and TLSS. (e.g. /surv ac_desert)
|
||||
[*] "Sleeps" can be persistent. (3rd argument of "sleep" command)
|
||||
|
||||
@@ -251,6 +251,9 @@ docargument [S] [the original string to modify] [] [0];
|
||||
docargument [T] [the target sub-string to replace] [] [0];
|
||||
docargument [N] [the new sub-string to replace the target] [] [0];
|
||||
docexample [echo (strreplace "Hello cruel world" cruel "")] [Output: Hello world];
|
||||
docident [listaverage] [Returns the average of a list of numbers.];
|
||||
docargument [L] [the list of numbers] [supports ints and floats] [0];
|
||||
docexample [echo (listaverage "2 5 5")] [Output: 4.0];
|
||||
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];
|
||||
|
||||
@@ -257,6 +257,9 @@ add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat
|
||||
// rrnd - Returns a ranged random integer.
|
||||
rrnd = [ + (rnd (- $arg2 $arg1)) $arg1 ]
|
||||
|
||||
// listaverage - Returns the average of a list of numbers. (Supports ints & floats - e.g. echo (listaverage "2 5 5") // Output: 4.0)
|
||||
listaverage = [ if (&& (listlen $arg1) (testlist $arg1)) [ tmp_sum = 0; loop gsl (listlen $arg1) [ += tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ]
|
||||
|
||||
// copyent & pasteent - Quickly copy/paste the current closest entity. Initialize the two aliases below as "NULL" for error catching.
|
||||
// If /config/saved.cfg is readable/writable, errors are only possible up until the very first use of /copyent.
|
||||
cp_entbuf = NULL; cp_entstr = NULL
|
||||
|
||||
+2
-4
@@ -24,8 +24,6 @@ genSurvDifStr = [
|
||||
]
|
||||
]
|
||||
|
||||
genSurvAvgStr = [ if (listlen $arg1) [ tmp_sum = 0; loop gsl (listlen $arg1) [ += tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ]
|
||||
|
||||
survival = [
|
||||
kickallbots; tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases
|
||||
if (! (checkalias onKill)) [ onKill = "" ]; if (! (strstr $onKill survKills)) [ add2alias onKill [ if $startedSurvival [ += survKills 1; if (! (listlen $survTimeBetKills)) [ survTimeBetKills = (- (millis) $startSurvMillis) ] [ add2list survTimeBetKills (- (millis) $survLastKill) ]; survLastKill = (millis) ] ] ]
|
||||
@@ -113,7 +111,7 @@ checkzone = [
|
||||
if (&& (! $startedSurvival) (>= (- (millis) $startPreSurvMillis) $timeUntilTele)) [ teleportPlayer ]
|
||||
if (&& (>= (- (millis) $lastCheckPoint) $timeBetChkPts) (&& $startedSurvival $gotCheckPoint)) [ increaseDifficulty ]
|
||||
if (&& (! $startedOBCount) (&& (! (isInZone)) $startedSurvival)) [ startOBCount ]
|
||||
if (&& $startedSurvival (&& (! (alive)) (>= (- (millis) $startSurvMillis) 500))) [ finalSurvMillis = (- (millis) $startSurvMillis); endSurvival (concatword (genSurvDifStr) (c 3) " You survived for " (c 5) (divf $finalSurvMillis 1000) (c 3) " seconds, and killed " (c 5) $survKills (c 3) " enemies. Average: " (c 5) (divf (genSurvAvgStr $survTimeBetKills) 1000) (c 3) " seconds between kills.") ]
|
||||
if (&& $startedSurvival (&& (! (alive)) (>= (- (millis) $startSurvMillis) 500))) [ finalSurvMillis = (- (millis) $startSurvMillis); endSurvival (concatword (genSurvDifStr) (c 3) " You survived for " (c 5) (divf $finalSurvMillis 1000) (c 3) " seconds, and killed " (c 5) $survKills (c 3) " enemies. Average: " (c 5) (divf (listaverage $survTimeBetKills) 1000) (c 3) " seconds between kills.") ]
|
||||
if (&& (! (curteam)) (! $startedSurvival)) [ team RVSF ]; sleep 0 [ checkzone ]
|
||||
]
|
||||
]
|
||||
@@ -138,6 +136,6 @@ endSurvival = [
|
||||
]
|
||||
|
||||
// List of aliases that need to be cleared from saved.cfg on quit:
|
||||
survAliases = (concat $survResetAliases "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis genSurvDifStr genSurvAvgStr increaseDifficulty isInZone midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startOBCount startOBMillis startSurvival survLastKill survMapIndex survOfcZones survTimeBetKills tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_sum tmp_survstr tmpSurvZone tmpZoneCenter zone aliasinit survResetAliases survAliases")
|
||||
survAliases = (concat $survResetAliases "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis genSurvDifStr increaseDifficulty isInZone midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startOBCount startOBMillis startSurvival survLastKill survMapIndex survOfcZones survTimeBetKills tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_sum tmp_survstr tmpSurvZone tmpZoneCenter zone aliasinit survResetAliases survAliases")
|
||||
|
||||
addListOnQuit $survAliases
|
||||
+13
-1
@@ -1087,7 +1087,19 @@
|
||||
<identifierReference identifier="substr"/>
|
||||
</references>
|
||||
</command>
|
||||
|
||||
|
||||
<command name="listaverage">
|
||||
<description>Returns the average of a list of numbers.</description>
|
||||
<examples>
|
||||
<example>
|
||||
<code><![CDATA[echo (listaverage "2 5 5")]]></code>
|
||||
<explanation>Output: 4.0</explanation>
|
||||
</example>
|
||||
</examples>
|
||||
<arguments>
|
||||
<argument token="L" description="the list of numbers" valueNotes="supports ints and floats"/>
|
||||
</arguments>
|
||||
</command>
|
||||
|
||||
</identifiers>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user