From aa20b54a55a6c209eb54014d141123e15bea65ed Mon Sep 17 00:00:00 2001 From: Bukz Date: Mon, 4 Feb 2013 06:42:31 +0000 Subject: [PATCH] cleanup git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7149 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/scripts.cfg | 2 +- config/survival.cfg | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/config/scripts.cfg b/config/scripts.cfg index cb7c9c27..c67548f5 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -348,7 +348,7 @@ const storesets [ // switch - Takes an integer argument to determine which block of code to execute. // NOTE: This command can only handle up to 23 "cases" (24 arguments). switch = [ - if (&& (<= $numargs 24) (checkrange $arg1 0 22)) [ + if (&& (<= $numargs $MAX_ARGS) (checkrange $arg1 0 (- $MAX_ARGS 2))) [ execute (getalias (format arg%1 (+ $arg1 2))) ] ] diff --git a/config/survival.cfg b/config/survival.cfg index a1e671ab..bbf334e9 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -29,7 +29,7 @@ const genSurvDifStr [ const survival [ kickallbots; if (! (curteam)) [ team RVSF ]; if (> $numargs 1) [ survSetDif $arg2 ] - tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases + tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = []; survTimeBetKills = []; resetSurvAliases checkinit onKill [ // Use onKill for enemies killed counter and other stats if $startedSurvival [ // if (&& (= $arg1 (player1 cn)) (!= $arg1 $arg2)) [ // Player1 was actor and was not suicide @@ -62,7 +62,7 @@ const startSurvival [ sleep $timeBetChkPts [ gotCheckPoint = 1; increaseDifficulty ] ] -const setzone [ if (> (listlen $arg1) 3) [ zone = []; loop szl 4 [ add2list zone (at $arg1 $szl) ] ]; drawzone (at $arg1 0) (at $arg1 1) (at $arg1 2) (at $arg1 3); ] +const setzone [ if (> (listlen $arg1) 3) [ zone = []; loop szl 4 [ add2list zone (at $arg1 $szl) ] ]; drawzone (at $arg1 0) (at $arg1 1) (at $arg1 2) (at $arg1 3) ] // Zones consist of two points on a grid. Any area within these points are considered "inner zone". // The order of the arguments given to setzone are important: setzone "minX maxX minY maxY" @@ -111,7 +111,7 @@ const findCenter [ midZoneY = (+f (divf (-f (at $tmpSurvZone 3) (at $tmpSurvZone 2)) 2) (at $tmpSurvZone 2)) ] -const teleportPlayer [ if (! (alive)) [ attack ]; if (!= $gamespeed 100) [ gamespeed 100 ]; survTeleported = 1; findCenter; if (! $editing) [ edittoggle ]; go_to $midZoneX $midZoneY; sleep 25 [ edittoggle ] ] +const teleportPlayer [ if (! (alive)) attack; if (!= $gamespeed 100) [ gamespeed 100 ]; survTeleported = 1; findCenter; if (! $editing) edittoggle; go_to $midZoneX $midZoneY; sleep 25 edittoggle ] const isInZone [ if (&& (checkrange (player1 x) (at $zone 0) (at $zone 1)) (checkrange (player1 y) (at $zone 2) (at $zone 3))) [ result 1 ] [ result 0 ] ] @@ -154,18 +154,22 @@ const applySurvDamageEffects [ const checkzone [ if (! $survIsFinished) [ - if $survDamageEffects [ - if (&& $startedSurvival (>= (player1 health) 50)) [ if (&& (!= $gamespeed 100) (! $changingspeed)) [ changespeed 100 10 ] ] - if (&& $startedSurvival (> (player1 health) 32)) [ if (!= $gamma (at $survOrigSets 0)) [ if (! $changinggamma) [ changegamma (at $survOrigSets 0) 10 ] ] ] - if (&& $startedSurvival (< (player1 health) 50)) [ applySurvDamageEffects ] + if (! $startedSurvival) [ + if (! (curteam)) [ team RVSF ] + if (isInZone) startSurvival + if (>= (- (millis) $startPreSurvMillis) $timeUntilTele) teleportPlayer + ] [ + if (&& (>= (- (millis) $startSurvMillis) 500) (|| (|| (idlebots 2) (! (botsshoot 2))) $editing)) [ endSurvival (concatword (genSurvDifStr) (red) " Error: " (blue) editmode (white) ", " (yellow) idlebots (white) ", and " (green) botsshoot (white) " are not allowed in Survival Mode.") ] + if (&& (! (alive)) (>= (- (millis) $startSurvMillis) 500)) [ finalSurvMillis = (- (millis) $startSurvMillis); endSurvival (concatword (genSurvDifStr) (red) " You survived for " (white) (divf $finalSurvMillis 1000) (red) " seconds, killed " (white) $survKills (red) " enemies. Average: " (white) (divf (listaverage $survTimeBetKills) 1000) (red) " seconds between kills. Total Damage Dealt: " (white) $survTotalDmg) ] + if (&& (! (isInZone)) (! $startedOBCount)) startOBCount + if (&& (>= (- (millis) $lastCheckPoint) $timeBetChkPts) $gotCheckPoint) increaseDifficulty + if $survDamageEffects [ + if (>= (player1 health) 50) [ if (&& (!= $gamespeed 100) (! $changingspeed)) [ changespeed 100 10 ] ] + if (> (player1 health) 32) [ if (!= $gamma (at $survOrigSets 0)) [ if (! $changinggamma) [ changegamma (at $survOrigSets 0) 10 ] ] ] + if (< (player1 health) 50) applySurvDamageEffects + ] ] - if (&& $startedSurvival (&& (>= (- (millis) $startSurvMillis) 500) (|| (|| (idlebots 2) (! (botsshoot 2))) $editing))) [ endSurvival (concatword (genSurvDifStr) (red) " Error: " (blue) editmode (white) ", " (yellow) idlebots (white) ", and " (green) botsshoot (white) " are not allowed in Survival Mode.") ] - if (&& (isInZone) (! $startedSurvival)) [ startSurvival ] - 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) (red) " You survived for " (white) (divf $finalSurvMillis 1000) (red) " seconds, killed " (white) $survKills (red) " enemies. Average: " (white) (divf (listaverage $survTimeBetKills) 1000) (red) " seconds between kills. Total Damage Dealt: " (white) $survTotalDmg) ] - if (&& (! (curteam)) (! $startedSurvival)) [ team RVSF ]; sleep 0 [ checkzone ] + sleep 0 checkzone ] ] @@ -199,7 +203,7 @@ const endSurvival [ echo $tmp_survstr if (&& $spamSurvMsgs $survKills) [ hudecho (green)GG ] ] - if (curmodeattr bot) [ kickallbots ] + if (curmodeattr bot) kickallbots tdm (rndmap) ]