diff --git a/config/docs.cfg b/config/docs.cfg index 4c483338..15e38c0c 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -210,6 +210,11 @@ 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.]; +docident [aliasinit] [Initializes a group of aliases using checkinit.]; +docargument [L] [the list of aliases to check for] [] [0]; +docargument [B] [the optional block of code to ensure the aliases contain] [] [0]; +docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5"] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them.]; +docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5" 0] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them to 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]; diff --git a/config/menus_bot.cfg b/config/menus_bot.cfg index 49f7a28e..796ec365 100644 --- a/config/menus_bot.cfg +++ b/config/menus_bot.cfg @@ -119,7 +119,7 @@ menuitemslider "# of milliseconds before teleporting: " 10000 180000 "$timeUntil menuitemslider "Maximum # of bots in survival mode: " 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1 ] menuitemslider "Spam survival mode messages: " 0 1 "$spamSurvMsgs" 1 [ "no" "yes" ] [ spamSurvMsgs = $arg1 ] menuitem [] -1 -menuitem " Back" [ closemenu "Survival Mode - Customize" ] +menuitem " Back" [ closemenu "Survival Mode - Customize" ] newmenu "Creating bot waypoints" diff --git a/config/scripts.cfg b/config/scripts.cfg index 913288fe..bb1201d6 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -232,10 +232,10 @@ 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 ";" +checkinit = [ if (> $numargs 0) [ if (! (checkalias $arg1)) [ $arg1 = ""; if (> $numargs 1) [ add2alias $arg1 $arg2 ] ] ] ] +aliasinit = [ loop ail (listlen $arg1) [ if (< $numargs 2) [ checkinit (at $arg1 $ail) ] [ checkinit (at $arg1 $ail) $arg2 ] ] ] add2list = [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] + // rrnd - Returns a ranged random integer. rrnd = [ + (rnd (- $arg2 $arg1)) $arg1 ] diff --git a/config/survival.cfg b/config/survival.cfg index 92d432de..a90e9889 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -9,17 +9,14 @@ // * If the player dies, or leaves the "zone" for too long of a duration, the game ends. // * Total seconds survived, and total number of enemies killed during, are reported as stats when the game ends. -checkSurvAliases = [ loop csa (listlen $arg1) [ if (! (checkalias (at $arg1 $csa))) [ (at $arg1 $csa) = $arg2 ] ] ] - survResetAliases = "gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount startPreSurvMillis startSurvMillis survKills survTeleported" resetSurvAliases = [ loop rsa (listlen $survResetAliases) [ (at $survResetAliases $rsa) = 0 ] - checkSurvAliases survMap (rnd (listlen $defaultmaps)) - checkSurvAliases survBotsToAdd 1; checkSurvAliases "spamSurvMsgs survDifficulty" 0; checkSurvAliases survNumBots 12; checkSurvAliases survMaxBots 32; checkSurvAliases timeBetChkPts 60000; checkSurvAliases timeUntilTele 120000 + aliasinit survBotsToAdd 1; aliasinit "spamSurvMsgs survDifficulty" 0; aliasinit survNumBots 12; aliasinit survMaxBots 32; aliasinit timeBetChkPts 60000; aliasinit timeUntilTele 120000 ] -resetSurvAliases +resetSurvAliases; if (! (checkalias afterinit)) [ afterinit = "" ]; if (! (strstr $afterinit survMap)) [ add2alias afterinit [ if (! (checkalias survMap)) [ survMap = (rnd (listlen $defaultmaps)) ] ] ] survival = [ storesets "positiontype" tmpSurvSets; add2list tmpSurvSets $survNumBots; curSurvDifficulty = 0; positiontype 1; resetSurvAliases @@ -133,6 +130,6 @@ endSurvival = [ ] // List of aliases that need to be cleared from saved.cfg on quit: -survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startPreSurvMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones survTeleported tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_survstr tmpSurvZone tmpZoneCenter zone checkSurvAliases survResetAliases survAliases" +survAliases = "backInZone checkzone curSurvDifficulty endSurvival finalSurvMillis gotCheckPoint increaseDifficulty isInZone lastCheckPoint midZoneX midZoneY onKill resetSurvAliases setOfcZones setzone startedOBCount startedSurvival startOBCount startOBMillis startPreSurvMillis startSurvival startSurvMillis survIsFinished survival_test survKills survMapIndex survOfcZones survTeleported tmpSCtr tmpSurvCtr tmpSurvInt tmpSurvSets tmp_survstr tmpSurvZone tmpZoneCenter zone aliasinit survResetAliases survAliases" addListOnQuit $survAliases \ No newline at end of file diff --git a/docs/reference.xml b/docs/reference.xml index fd0e7ef0..d611505a 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -801,6 +801,7 @@ + @@ -822,6 +823,29 @@ + + + + + + Initializes a group of aliases using checkinit. + + + + Checks to ensure that all 5 aliases listed exist, if not, it initializes them. + + + + Checks to ensure that all 5 aliases listed exist, if not, it initializes them to 0. + + + + + + + + +