diff --git a/changelog.txt b/changelog.txt index a5764a2a..4010bda6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -169,6 +169,7 @@ Cubescript [*] 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 +[*] rndmap - Returns a random official map. (e.g. echo (rndmap) // Example output: ac_desert3) [*] 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) [*] Substr crash bug is fixed. Also the command can now use a negative position value. diff --git a/config/docs.cfg b/config/docs.cfg index 408a0d68..a61677ac 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -710,6 +710,7 @@ docident [xhairwpsel] [Determines if bot waypoints should be selected/placed usi docargument [V] [Note: This is turned on by default.] [min 0/max 1/default 1]; docident [survival] [Prepares a round of bot survival mode on the specified map.]; docargument [M] [the map to use] [] [0]; +docargument [D] [optional: the difficulty] [0 = easy, 1 = intermediate, 2 = hard, 3 = impossible] [0]; docremark [All official maps are compatible with survival, if you want to play survival on a custom map, prior edits/additions to the script are necessary, such as adding a zone for that specific map.]; docident [inWater] [Determines if the local player is standing in water or submerged.]; docargument [T] [check if submerged instead?] [min 0/max 1/default 0] [0]; diff --git a/config/menus_bot.cfg b/config/menus_bot.cfg index 9d5847d2..19befdab 100644 --- a/config/menus_bot.cfg +++ b/config/menus_bot.cfg @@ -107,10 +107,11 @@ genenemyitems "4 8 12 16 24 32" 1 survSetsList = "survNumBots survBotsToAdd timeBetChkPts timeUntilTele survMaxBots" survDifList = [ "10 1 60000 120000 20" "12 1 45000 90000 30" "14 2 30000 45000 50" "16 5 10000 30000 50" ] +survSetDif = [ survDifficulty = $arg1; tmpSurvCtr = 0; loop sdl 5 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $tmpSurvCtr); += tmpSurvCtr 1 ] ] newmenu "Survival Mode" menuitemslider "Map: " 0 28 "$survMap" 1 [ "ac_aqueous" "ac_arabian" "ac_arctic" "ac_arid" "ac_complex" "ac_depot" "ac_desert" "ac_desert2" "ac_desert3" "ac_douze" "ac_edifice" "ac_elevation" "ac_gothic" "ac_iceroad" "ac_industrial" "ac_ingress" "ac_keller" "ac_mines" "ac_outpost" "ac_power" "ac_rattrap" "ac_scaffold" "ac_shine" "ac_snow" "ac_stellar" "ac_sunset" "ac_toxic" "ac_urban" "ac_werk" ] [ survMap = $arg1 ] -menuitemslider "Difficulty: " 0 3 "$survDifficulty" 1 [ "easy" "intermediate" "hard" "impossible" ] [ survDifficulty = $arg1; tmpSurvCtr = 0; loop sdl 5 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $tmpSurvCtr); += tmpSurvCtr 1 ]; nonSurvDefaults = 0 ] +menuitemslider "Difficulty: " 0 3 "$survDifficulty" 1 [ "easy" "intermediate" "hard" "impossible" ] [ survSetDif $arg1; nonSurvDefaults = 0 ] menuitem [] -1 menuitem " Customize" [ showmenu "Survival Mode - Customize" ] menuitem " Start!" [ survival (at $defaultmaps $survMap) ] diff --git a/config/scripts.cfg b/config/scripts.cfg index 3974223f..728a19de 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -253,6 +253,7 @@ addOnQuit = [ add2alias onQuit $arg1 ] 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) ] ] +rndmap = [ result (at $defaultmaps (rnd (listlen $defaultmaps))) ] // rrnd - Returns a ranged random integer. rrnd = [ + (rnd (- $arg2 $arg1)) $arg1 ] diff --git a/config/survival.cfg b/config/survival.cfg index 6bfdd22f..98c9e174 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -25,15 +25,29 @@ genSurvDifStr = [ ] survival = [ - kickallbots; tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases - if (! (checkalias onKill)) [ onKill = "" ]; if (! (strstr $onKill survKills)) [ add2alias onKill [ if (&& $startedSurvival (= $arg1 (findcn $curname))) [ += survKills 1; if (! (listlen $survTimeBetKills)) [ survTimeBetKills = (- (millis) $startSurvMillis) ] [ add2list survTimeBetKills (- (millis) $survLastKill) ]; survLastKill = (millis) ] ] ] + kickallbots; if (! (curteam)) [ team RVSF ]; if (> $numargs 1) [ survSetDif $arg2; nonSurvDefaults = 0 ] + tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases + if (! (checkalias onKill)) [ onKill = "" ] + if (! (strstr $onKill survKills)) [ + add2alias onKill [ + if $startedSurvival [ + if (&& (= $arg1 (findcn $curname)) (!= $arg1 $arg2)) [ + += survKills 1 + if (! (listlen $survTimeBetKills)) [ + survTimeBetKills = (- (millis) $startSurvMillis) + ] [ add2list survTimeBetKills (- (millis) $survLastKill) ] + survLastKill = (millis) + ] [ if (= $arg2 (findcn $curname)) [ add2list tmpSurvSets (concat $arg1 $arg2 $arg3 $arg4 (findpn $arg1)) ] ] + ] + ] + ] add2alias mapstartonce [ startPreSurvMillis = (millis); add2list tmpSurvSets (curmap 1) echo (genSurvDifStr) (c 2)Bot survival mode prepared, gather items and find the arena to start! (c 9)You have (c 5) (div $timeUntilTele 1000) (c 9)seconds to prepare! if (strstr $defaultmaps (curmap 1)) [ survMap = (findlist $defaultmaps (curmap 1)) ] setOfcZones; checkzone ] - if (! (curteam)) [ team RVSF ]; mode 7; map $arg1 // Make 'em fight for us :p + votemap 7 $arg1 ] startSurvival = [ @@ -131,8 +145,19 @@ increaseDifficulty = [ endSurvival = [ tmp_survstr = $arg1; survIsFinished = 1; startedSurvival = 0; survNumBots = (at $tmpSurvSets 0) - add2alias mapstartonce [ if (&& (strstr $tmp_survstr " You survived for ") (strstr $tmp_survstr " enemies. Average: ")) [ echo (c 0)Bot Survival results for map: (c 5) (at $tmpSurvSets 1) ]; echo $tmp_survstr; if (&& $spamSurvMsgs $survKills) [ hudecho (c 0)GG ] ] - tdm (at $defaultmaps (rnd (listlen $defaultmaps))) + add2alias mapstartonce [ + if (&& (strstr $tmp_survstr " You survived for ") (strstr $tmp_survstr " enemies. Average: ")) [ + echo (c 0)Bot Survival results for map: (c 5) (at $tmpSurvSets 1) + if (!= (at $tmpSurvSets 2) (at $tmpSurvSets 3)) [ + if (= (at $tmpSurvSets 5) 1) [ sleep 5 [ echo (concatword (c 2) (format "you were %1 by %2" (gibmessage (at $tmpSurvSets 4)) (at $tmpSurvSets 6))) ] ] [ + sleep 5 [ echo (concatword (c 2) (format "you were %1 by %2" (fragmessage (at $tmpSurvSets 4)) (at $tmpSurvSets 6))) ] + ] + ] [ sleep 5 [ echo (concatword (c 2) "you suicided!") ] ] + ] + echo $tmp_survstr + if (&& $spamSurvMsgs $survKills) [ hudecho (c 0)GG ] + ] + tdm (rndmap) ] // List of aliases that need to be cleared from saved.cfg on quit: diff --git a/config/tutorial.cfg b/config/tutorial.cfg index d2b59bd1..c39bd746 100644 --- a/config/tutorial.cfg +++ b/config/tutorial.cfg @@ -211,5 +211,5 @@ menuitem "Try it out!" -1 menuitem "" -1 menuitem " 0Finish - 7/7" "paused 0; endmenuitem" -endmenuitem = [ sleep 1000 [ showscores 1 ]; sleep 60000 [ endtutorial; tdm (at $defaultmaps (rnd (listlen $defaultmaps))) ] ] +endmenuitem = [ sleep 1000 [ showscores 1 ]; sleep 60000 [ endtutorial; tdm (rndmap) ] ] watchingtutorial = 0 \ No newline at end of file diff --git a/docs/reference.xml b/docs/reference.xml index 78ac8977..44454b50 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -3048,7 +3048,8 @@ Output: All official maps are compatible with survival, if you want to play survival on a custom map, prior edits/additions to the script are necessary, such as adding a zone for that specific map. - + +