diff --git a/config/autosave.cfg b/config/autosave.cfg index ccddfdb1..692a00dc 100644 --- a/config/autosave.cfg +++ b/config/autosave.cfg @@ -1,9 +1,9 @@ +persistidents 0 checkinit mapstartalways [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ] checkinit onNewMap [ if $autosavemap autoSaveCheck; numAutoSaves = 0 ] - -checkinit autosavemap 0 // Autosavemap system disabled by default -checkinit timeBetAutoSaves 300000 // Once every 5 minutes. -checkinit numAutoSaveBackups 12 // Make a map .bak every 12 autosaves by default +check2init autosavemap 0 // Autosavemap system disabled by default +check2init timeBetAutoSaves 300000 // Once every 5 minutes. +check2init numAutoSaveBackups 12 // Make a map .bak every 12 autosaves by default const autoSaveCheck [ sleep $timeBetAutoSaves [ doAutoSave ] 1 ] @@ -25,4 +25,7 @@ const doAutoSave [ ] ] autoSaveCheck -] \ No newline at end of file +] + +addListOnQuit "autoSaveCheck execAutoSave doAutoSave numAutoSaves oldmapbackups" +persistidents 1 \ No newline at end of file diff --git a/config/defaults.cfg b/config/defaults.cfg index 0b877f80..c9ed4624 100644 --- a/config/defaults.cfg +++ b/config/defaults.cfg @@ -36,4 +36,7 @@ timeUntilTele = 120000 survMaxBots = 32 spamSurvMsgs = 0 nonSurvDefaults = 0 -survDamageEffects = 1 \ No newline at end of file +survDamageEffects = 1 +autosavemap = 0 +timeBetAutoSaves = 300000 +numAutoSaveBackups = 12 \ No newline at end of file diff --git a/config/dyngamma.cfg b/config/dyngamma.cfg index f5d60b49..6ae23512 100644 --- a/config/dyngamma.cfg +++ b/config/dyngamma.cfg @@ -1,3 +1,4 @@ +persistidents 0 // Initialize the list (if it doesn't already exist) using the current gamma as initial values. if (! (checkalias ofc_gamma_list)) [ ofc_gamma_list = "" @@ -27,10 +28,8 @@ const setgamma [ ] // Plugin to mapstartalways on every run if it doesn't already exist. -if (! (checkalias dyngamma)) [ dyngamma = 0 ] -if (! (checkalias mapstartalways)) [ mapstartalways = "" ] -if (! (strstr $mapstartalways dyngamma)) [ - add2alias mapstartalways [ - if $dyngamma [ if (strstr $defaultmaps (curmap 1)) [ gamma (at $ofc_gamma_list (findlist $defaultmaps (curmap 1))) ] ] - ] -] \ No newline at end of file +check2init dyngamma 0 +checkinit mapstartalways [ + if $dyngamma [ if (strstr $defaultmaps (curmap 1)) [ gamma (at $ofc_gamma_list (findlist $defaultmaps (curmap 1))) ] ] +] +persistidents 1 diff --git a/config/faq.cfg b/config/faq.cfg index 00420b42..8b187ca2 100644 --- a/config/faq.cfg +++ b/config/faq.cfg @@ -1,4 +1,5 @@ // generates the FAQ menu available from the first run menu or the help menu +persistidents 0 faqQuestions = [ "What is the fastest way to get help/support for AssaultCube?" "How do I determine what version of AssaultCube I have installed?" @@ -117,4 +118,5 @@ genFaq = [ newmenu "faq" genFaq menuitem "" -1 -menuitem " Close" [ closemenu faq ] \ No newline at end of file +menuitem " Close" [ closemenu faq ] +persistidents 1 diff --git a/config/scripts.cfg b/config/scripts.cfg index f3478902..732eb927 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -109,6 +109,7 @@ const MODES "tdm coop dm surv ts ctf pf btdm bdm lss osok tosok bosok htf tktf k const NUM_MODES (listlen $MODES) const PUNCTUATION "QUOTES BRACKETS PARENTHESIS _$_ QUOTE PERCENT" const MAX_BOT_MATCH_LENGTH 60 +const ENT_NUM_ATTRS 4 loop g (listlen $PUNCTUATION) [ const (at $PUNCTUATION $g) $g ] // echo (addpunct "hello world" $PARENTHESIS) - output: (hello world) @@ -250,10 +251,13 @@ const add2alias [ const addOnLoadOnce [ add2alias mapstartonce $arg1 ] const addOnLoadAlways [ add2alias mapstartalways $arg1 ] const addOnQuit [ add2alias onQuit $arg1 ] -const checkinit [ if (> $numargs 0) [ if (! (checkalias $arg1)) [ $arg1 = "" ]; if (&& (> $numargs 1) (! (strstr (getalias $arg1) $arg2))) [ add2alias $arg1 $arg2 ] ] ] -const aliasinit [ loop ail (listlen $arg1) [ if (< $numargs 2) [ checkinit (at $arg1 $ail) ] [ checkinit (at $arg1 $ail) $arg2 ] ] ] -const add2list [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] -const add2bind [ if (! (strstr (keybind $arg1) $arg2)) [ bind $arg1 (format "%1; %2" (keybind $arg1) $arg2) ] ] +const check2init [ if (! (checkalias $arg1)) [ $arg1 = $arg2 ] ] // only overwrites an alias if it doesn't exist +const check2initlist [ loop cll (listlen $arg1) [ check2init (at $arg1 $cll) $arg2 ] ] // check2inits multiple aliases +const forceinit [ loop fil (listlen $arg1) [ (at $arg1 $fil) = $arg2 ] ] // forcibly overwrites multiple aliases +const checkinit [ if (! (checkalias $arg1)) [ $arg1 = "" ]; if (> $numargs 1) [ if (! (strstr (getalias $arg1) $arg2)) [ add2alias $arg1 $arg2 ] ] ] // ensures the initialization of an alias, optionally ensures the alias contains string $arg2 +const aliasinit [ loop ail (listlen $arg1) [ checkinit (at $arg1 $ail) $arg2 ] ] // checkinits multiple aliases +const add2list [ if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] // works exactly like concat, use as a shortcut to: alias = (concat $alias "some string") +const add2bind [ if (! (strstr (keybind $arg1) $arg2)) [ bind $arg1 (format "%1; %2" (keybind $arg1) $arg2) ] ] // works exactly like add2alias except for used with keybinds const rndmap [ result (at $defaultmaps (rnd (listlen $defaultmaps))) ] // rrnd - Returns a ranged random integer. @@ -266,7 +270,7 @@ const listaverage [ if (listlen $arg1) [ tmp_sum = 0; loop gsl (listlen $arg1) [ // 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 -const get_ent_attrs [ cp_entbuf = (getenttype); loop gea 4 [ add2list cp_entbuf (getentattr $gea) ] ] +const get_ent_attrs [ cp_entbuf = (getenttype); loop gea $ENT_NUM_ATTRS [ add2list cp_entbuf (getentattr $gea) ] ] const copyent [ if $editing [ diff --git a/config/survival.cfg b/config/survival.cfg index cc2c6ef2..254dbe78 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -8,19 +8,17 @@ // * The difficulty is "increased" over time, by spawning more and increasing the skill level of bots at "checkpoints". // * If the player dies, or leaves the "zone" for too long of a duration, the game ends. // * Total seconds survived, total number of enemies killed during, average amount of time between kills, and total damage dealt while alive are reported as stats when the game ends. - +persistidents 0 const survResetAliases "gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount startPreSurvMillis startSurvMillis survKills survTeleported survTotalDmg survOrigSets changingspeed changinggamma" const resetSurvAliases [ - loop rsa (listlen $survResetAliases) [ (at $survResetAliases $rsa) = 0 ] - aliasinit survBotsToAdd 1; aliasinit "spamSurvMsgs survDifficulty" 0; aliasinit survNumBots 12; aliasinit survMaxBots 32; aliasinit timeBetChkPts 60000; aliasinit timeUntilTele 120000; aliasinit survDamageEffects 1 + forceinit $survResetAliases 0 + check2initlist "spamSurvMsgs survDifficulty" 0 + check2initlist "survBotsToAdd survDamageEffects" 1 + check2init survNumBots 12; check2init survMaxBots 32; check2init timeBetChkPts 60000; check2init timeUntilTele 120000 ] -if (! (checkalias afterinit)) [ afterinit = "" ] -if (! (strstr $afterinit resetSurvAliases)) [ - add2alias afterinit resetSurvAliases - if (! (checkalias survMap)) [ survMap = (rnd (listlen $defaultmaps)) ] -] +checkinit afterinit [ resetSurvAliases; check2init survMap (rnd (listlen $defaultmaps)) ] const genSurvDifStr [ if $nonSurvDefaults [ result "[CUSTOM]" ] [ @@ -32,29 +30,23 @@ const genSurvDifStr [ const survival [ kickallbots; if (! (curteam)) [ team RVSF ]; if (> $numargs 1) [ survSetDif $arg2 ] tmpSurvSets = $survNumBots; curSurvDifficulty = 0; survLastKill = ""; survTimeBetKills = ""; resetSurvAliases - if (! (checkalias onKill)) [ onKill = "" ] - if (! (strstr $onKill survKills)) [ - add2alias 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 - += survKills 1 // Increment enemies killed counter - if (! (listlen $survTimeBetKills)) [ // First kill - survTimeBetKills = (- (millis) $startSurvMillis) // - ] [ add2list survTimeBetKills (- (millis) $survLastKill) ] // Other kills - survLastKill = (millis) // Update last kill - ] [ if (= $arg2 (player1 cn)) [ add2list tmpSurvSets (concat $arg1 $arg2 $arg3 $arg4 (player $arg1 name)) ] ] // Player1 was target, pass arguments/data along for use in the after game results/stats messages. - ] + 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 + += survKills 1 // Increment enemies killed counter + if (! (listlen $survTimeBetKills)) [ // First kill + survTimeBetKills = (- (millis) $startSurvMillis) // + ] [ add2list survTimeBetKills (- (millis) $survLastKill) ] // Other kills + survLastKill = (millis) // Update last kill + ] [ if (= $arg2 (player1 cn)) [ add2list tmpSurvSets (concat $arg1 $arg2 $arg3 $arg4 (player $arg1 name)) ] ] // Player1 was target, pass arguments/data along for use in the after game results/stats messages. ] ] - if (! (checkalias onHit)) [ onHit = "" ] - if (! (strstr $onHit survTotalDmg)) [ - add2alias onHit [ // Use onHit for total damage dealt stat - if (&& (= $arg1 (player1 cn)) (!= $arg1 $arg2)) [ - += survTotalDmg $arg3 - ] + checkinit onHit [ // Use onHit for total damage dealt stat + if (&& (= $arg1 (player1 cn)) (!= $arg1 $arg2)) [ + += survTotalDmg $arg3 ] ] - add2alias mapstartonce [ + checkinit mapstartonce [ startPreSurvMillis = (millis); add2list tmpSurvSets (curmap 1); sleep 3 [ storesets "gamma" survOrigSets ] echo (genSurvDifStr) (yellow)Bot survival mode prepared, gather items and find the arena to start! (orange)You have (white) (div $timeUntilTele 1000) (orange)seconds to prepare! if (strstr $defaultmaps (curmap 1)) [ survMap = (findlist $defaultmaps (curmap 1)) ] @@ -131,9 +123,7 @@ const changespeed [ loops = (- $curspeed $targetspeed) ] [ loops = (- $targetspeed $curspeed) ] loop i $loops [ - sleep (* $i $increments) [ - gamespeed ((at "+ -" (> $curspeed $targetspeed)) $gamespeed 1) - ] + sleep (* $i $increments) [ gamespeed ((at "+ -" (> $curspeed $targetspeed)) $gamespeed 1) ] ] sleep (* $loops $increments) [ changingspeed = 0 ] ] [ changingspeed = 0 ] @@ -146,9 +136,7 @@ const changegamma [ loopss = (- $curgamma $targetgamma) ] [ loopss = (- $targetgamma $curgamma) ] loop t $loopss [ - sleep (* $t $incrementss) [ - gamma ((at "+ -" (> $curgamma $targetgamma)) $gamma 1) - ] + sleep (* $t $incrementss) [ gamma ((at "+ -" (> $curgamma $targetgamma)) $gamma 1) ] ] sleep (* $loopss $incrementss) [ changinggamma = 0 ] ] [ changinggamma = 0 ] @@ -197,7 +185,7 @@ const increaseDifficulty [ const endSurvival [ tmp_survstr = $arg1; survIsFinished = 1; startedSurvival = 0; survNumBots = (at $tmpSurvSets 0) - add2alias mapstartonce [ + checkinit mapstartonce [ if (! $dyngamma) [ gamma (at $survOrigSets 0) ]; gamespeed 100 if (&& (strstr $tmp_survstr " You survived for ") (strstr $tmp_survstr " enemies. Average: ")) [ echo (green)Bot Survival results for map: (white) (at $tmpSurvSets 1) @@ -218,3 +206,5 @@ const endSurvival [ const survAliases (concat $survResetAliases "resetSurvAliases genSurvDifStr survival tmpSurvSets curSurvDifficulty survLastKill survTimeBetKills startPreSurvMillis startSurvival startedSurvival setzone survOfcZones setOfcZones survMapIndex tmpSurvZone findCenter midZoneX midZoneY teleportPlayer survTeleported isInZone checkzone startOBCount startedOBCount startOBMillis backInZone tmpSCtr increaseDifficulty lastCheckPoint tmpSurvInt endSurvival tmp_survstr survIsFinished tmpstrlist finalSurvMillis zone survSetsList survDifList survSetDif survResetAliases survAliases") addListOnQuit $survAliases + +persistidents 1 diff --git a/config/tutorial.cfg b/config/tutorial.cfg index 8a5e4c72..c4c737ff 100644 --- a/config/tutorial.cfg +++ b/config/tutorial.cfg @@ -1,6 +1,7 @@ +persistidents 0 const tutstart [ if (= $arg1 1) [ - add2alias mapstartonce [ tut ] + checkinit mapstartonce tut // Disable most of the HUD storesets "consize crosshairsize hidespecthud hideteam hidehudequipment specthudgun" tmp_tutsets consize 0; crosshairsize 0; hidespecthud 1; hideteam 1; hidehudequipment 1; specthudgun 0; watchingtutorial = 1 @@ -213,4 +214,5 @@ menuitem "" -1 menuitem " 0Finish - 7/7" "paused 0; endmenuitem" const endmenuitem [ sleep 1000 [ showscores 1 ]; sleep 60000 [ endtutorial; tdm (rndmap) ] ] -watchingtutorial = 0 \ No newline at end of file +watchingtutorial = 0 +persistidents 1