change scripts to use tempalias and push/pop
* no more need to delete aliases "onQuit" * removed on_quit.cfg * moved faq.cfg, parsestrings.cfg and survival.cfg to config/opt * run faq.cfg and survival.cfg when needed DOCREF addListOnQuit
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ const serverdesc [ callvote 11 $arg1 ]
|
||||
const shuffleteams [ callvote 12 ]
|
||||
|
||||
const demo [
|
||||
_demofile = $arg1
|
||||
tempalias _demofile $arg1
|
||||
if $connected [
|
||||
addOnLoadOnce [ mode -1; map $_demofile ]
|
||||
disconnect
|
||||
|
||||
+6
-7
@@ -2,18 +2,19 @@ persistidents 0
|
||||
|
||||
checkinit mapstartalways [numAutoSaves = 0; autoSaveCheck]
|
||||
checkinit onNewMap [numAutoSaves = 0; autoSaveCheck]
|
||||
check2init autosavemap 0 // Autosavemap system disabled by default
|
||||
check2init timeBetAutoSaves 300000 // Autosave once every 5 minutes.
|
||||
check2init numAutoSaveBackups 3 // Make a map .bak every 3 autosaves (15 minutes) by default
|
||||
alias autosavemap 0 // Autosavemap system disabled by default
|
||||
alias timeBetAutoSaves 300000 // Autosave once every 5 minutes.
|
||||
alias numAutoSaveBackups 3 // Make a map .bak every 3 autosaves (15 minutes) by default
|
||||
tempalias numAutoSaves 0
|
||||
|
||||
const autoSaveCheck [ if $autosavemap [ sleep $timeBetAutoSaves doAutoSave ] ]
|
||||
|
||||
const execAutoSave [
|
||||
++ numAutoSaves
|
||||
oldmapbackups = $mapbackupsonsave
|
||||
push oldmapbackups $mapbackupsonsave
|
||||
if (|| (!= $numAutoSaveBackups $numAutoSaves) (= $numAutoSaveBackups 0)) [ mapbackupsonsave 0 ] [ numAutoSaves = 0 ] // Temporarily turn off map backups to avoid clutter.
|
||||
savemap (curmap 1)
|
||||
mapbackupsonsave $oldmapbackups
|
||||
mapbackupsonsave (pop oldmapbackups)
|
||||
echo (blue)The map was automatically saved. (white)Next auto-save in (divf $timeBetAutoSaves 60000) minutes.
|
||||
]
|
||||
|
||||
@@ -28,6 +29,4 @@ const doAutoSave [
|
||||
autoSaveCheck
|
||||
]
|
||||
|
||||
addListOnQuit [autoSaveCheck execAutoSave doAutoSave numAutoSaves oldmapbackups]
|
||||
|
||||
persistidents 1
|
||||
|
||||
@@ -21,17 +21,4 @@ __gibsgore = 1 // Default value for gibs slider.
|
||||
dyngamma = 0
|
||||
old_editbinds = 1
|
||||
nickhighlight = 0
|
||||
survMap = (rnd (listlen $defaultmaps))
|
||||
survDifficulty = 0
|
||||
survNumBots = 6
|
||||
survBotsToAdd = 1
|
||||
timeBetChkPts = 60000
|
||||
timeUntilTele = 90000
|
||||
survMaxBots = 20
|
||||
spamSurvMsgs = 0
|
||||
nonSurvDefaults = 0
|
||||
survDamageEffects = 1
|
||||
autosavemap = 0
|
||||
timeBetAutoSaves = 300000
|
||||
numAutoSaveBackups = 3
|
||||
menuBotGameLength = 15
|
||||
|
||||
+3
-2
@@ -13,9 +13,9 @@ if (! (checkalias ofc_gamma_list)) [
|
||||
const setgamma [
|
||||
if (checkrange $arg1 30 300) [
|
||||
if (strstr $defaultmaps (curmap 1)) [
|
||||
tmp_gamma_list = $ofc_gamma_list
|
||||
push tmp_gamma_list $ofc_gamma_list
|
||||
ofc_gamma_list = []
|
||||
cmapp = (findlist $defaultmaps (curmap 1)) // Find the position in the list of the current map
|
||||
push cmapp (findlist $defaultmaps (curmap 1)) // Find the position in the list of the current map
|
||||
loop sgl (listlen $defaultmaps) [
|
||||
if (= $sgl $cmapp) [ // Add the new gamma at the correct position in the list
|
||||
add2list ofc_gamma_list $arg1
|
||||
@@ -23,6 +23,7 @@ const setgamma [
|
||||
add2list ofc_gamma_list (at $tmp_gamma_list $sgl)
|
||||
]
|
||||
]
|
||||
pop tmp_gamma_list cmapp
|
||||
echo (blue)Note: (white) $arg1 has been set as your default gamma for (yellow) (curmap 1)
|
||||
] [ echo (red)Error: (white)You are not on a official map! ]
|
||||
] [ echo (red)Error: (white)gamma has a minimum value of 30 and maximum value of 300! ]
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ newmenu help
|
||||
menuitem (_ [AssaultCube reference]) [ showmenu reference ]
|
||||
menuitem (_ [Search the reference]) [ showmenu [Reference search] ]
|
||||
// menuitem (_ [Keyboard controls]) [ showmenu controls ] // This was never implemented or something? - Bukz
|
||||
menuitem (_ [View the FAQ]) [ showmenu faq ]
|
||||
menuitem (_ [View the FAQ]) [ load_faq ; showmenu faq ]
|
||||
menuitem [] -1
|
||||
menuitem (_ [...for further information/help see the README]) [ echo (yellow) (_ [The readme can be found in the base AssaultCube directory.]) ]
|
||||
|
||||
|
||||
+9
-31
@@ -13,17 +13,17 @@ const genbotmaps [
|
||||
]
|
||||
genbotmaps $defaultmaps
|
||||
|
||||
tmp_botskill = good
|
||||
tmp_numbots = 1
|
||||
tmp_mode =
|
||||
tmp_botmap =
|
||||
tmp_isbotteammode = 0
|
||||
tempalias tmp_botskill good
|
||||
tempalias tmp_numbots 1
|
||||
tempalias tmp_mode ""
|
||||
tempalias tmp_botmap ""
|
||||
tempalias tmp_isbotteammode 0
|
||||
|
||||
// add bots
|
||||
const startbotmatch [
|
||||
if ($tmp_isbotteammode) [ // team botmode
|
||||
numrvsf = (div $tmp_numbots 2)
|
||||
numcla = (div $tmp_numbots 2)
|
||||
tempalias numrvsf (div $tmp_numbots 2)
|
||||
tempalias numcla (div $tmp_numbots 2)
|
||||
if (= (player1 team) 0) [ -- numcla ] [
|
||||
if (= (player1 team) 1) [ -- numrvsf ]
|
||||
]
|
||||
@@ -37,7 +37,7 @@ const startbotmatch [
|
||||
|
||||
const preparebotmatch [
|
||||
echo starting botmatch..
|
||||
needsswitch = 0
|
||||
tempalias needsswitch 0
|
||||
if (&& (!= (player1 team) 0) (!= (player1 team) 1)) [ needsswitch = 1; team RVSF ]
|
||||
// register event that is fired during mapload
|
||||
addOnLoadOnce [
|
||||
@@ -81,7 +81,7 @@ menuitem (_ [Bot Pistol Frenzy]) [ tmp_mode = 18; tmp_isbotteammode =
|
||||
menuitem (_ [Bot Last Swiss Standing]) [ tmp_mode = 19; tmp_isbotteammode = 0; showmenu botskill ]
|
||||
menuitem (_ [Bot Team Survivor]) [ tmp_mode = 20; tmp_isbotteammode = 1; showmenu botskill ]
|
||||
menuitem (_ [Bot Team One Shot, One Kill]) [ tmp_mode = 21; tmp_isbotteammode = 1; showmenu botskill ]
|
||||
menuitem (_ [Bot Survival]) [ showmenu [Survival Mode] ]
|
||||
menuitem (_ [Bot Survival]) [ load_survival ; showmenu [Survival Mode] ]
|
||||
menuitem [] -1
|
||||
menuitem (_ [Bot settings...]) [ showmenu [Bot settings] ]
|
||||
menuitem (_ [Empty Map]) emptymap
|
||||
@@ -116,28 +116,6 @@ genenemyitems [2 4 8 12 16 24 32] 0
|
||||
newmenu [team enemies]
|
||||
genenemyitems [4 8 12 16 24 32] 1
|
||||
|
||||
const survSetsList [survNumBots survBotsToAdd timeBetChkPts timeUntilTele survMaxBots]
|
||||
const survDifList ["6 1 60000 90000 20" "8 2 45000 60000 30" "10 3 30000 45000 40" "12 5 10000 20000 50"]
|
||||
const survSetDif [ if (checkrange $arg1 0 3) [ survDifficulty = $arg1; loop sdl 5 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $sdl) ] ] [ sleep 1000 [ echo (c 3)Error: (c 5)invalid difficulty, defaulting to (genSurvDifStr 0) ] 1; survSetDif 0 ]; nonSurvDefaults = 0 ]
|
||||
|
||||
newmenu [Survival Mode]
|
||||
menuitemslider (_ [Map: ]) 0 (- (listlen $defaultmaps) 1) "$survMap" 1 [ac_aqueous ac_arabian ac_arctic ac_arid ac_avenue ac_cavern 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_lainio ac_mines ac_outpost ac_power ac_rattrap ac_scaffold ac_shine ac_snow ac_stellar ac_sunset ac_swamp ac_terros ac_toxic ac_urban ac_venison ac_wasteland ac_werk] [ survMap = $arg1 ]
|
||||
menuitemslider (_ [Difficulty: ]) 0 3 "$survDifficulty" 1 [easy intermediate hard impossible] [ survSetDif $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem (concatword [ ] (_ Customize)) [ showmenu [Survival Mode - Customize] ]
|
||||
menuitem (concatword [ ] (_ Start!)) [ survival (at $defaultmaps $survMap) ]
|
||||
|
||||
newmenu [Survival Mode - Customize]
|
||||
menuitemcheckbox (_ [Enable survival damage effects (uses gamespeed/gamma)]) "$survDamageEffects" [ survDamageEffects = $arg1 ]
|
||||
menuitemslider (_ [# of bots to spawn on start: ]) 6 20 "$survNumBots" 1 [] [ survNumBots = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of bots to spawn at checkpoints: ]) 1 5 "$survBotsToAdd" 1 [] [ survBotsToAdd = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of milliseconds between checkpoints: ]) 10000 120000 "$timeBetChkPts" 10000 [] [ timeBetChkPts = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of milliseconds before teleporting: ]) 10000 180000 "$timeUntilTele" 10000 [] [ timeUntilTele = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [Maximum # of bots in survival mode: ]) 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [Spam survival mode messages: ]) 0 1 "$spamSurvMsgs" 1 [ no yes ] [ spamSurvMsgs = $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem [ Back] [ closemenu [Survival Mode - Customize] ]
|
||||
|
||||
newmenu [Bot settings]
|
||||
menuitemslider (_ [Bot match length in minutes: ]) 1 60 "$menuBotGameLength" 1 [] [ menuBotGameLength = $arg1 ]
|
||||
menuitemcheckbox (_ [Idle bots?]) "(idlebots 2)" [ idlebots $arg1 ]
|
||||
|
||||
@@ -14,7 +14,7 @@ menuitem (_ [Bots...]) [ showmenu [Creating bot waypoints] ]
|
||||
menuitem (_ [Settings...]) [ showmenu [Editing settings] ]
|
||||
menuitem (_ Help?) [ echo (yellow) (_ [Please read the AssaultCube README which has a detailed guide on mapediting...]) ]
|
||||
|
||||
tmp_cradius = 12
|
||||
tempalias tmp_cradius 12
|
||||
|
||||
//Lighting menu.
|
||||
newmenu Lighting
|
||||
|
||||
@@ -81,7 +81,7 @@ menuitem [Force serverlist update] [ updatefrommaster 1; joinservermenu ]
|
||||
// Fancy custom connect menu.
|
||||
newmenu [Custom connect]
|
||||
|
||||
menuinit [ cc1 = []; cc2 = []; cc3 = [] ] // Resets the aliases
|
||||
menuinit [ tempalias cc1 []; tempalias cc2 []; tempalias cc3 [] ] // Resets the aliases
|
||||
menuitemtextinput [Server IP/DNS: ] [] [ cc1 = $arg1 ] [] 255
|
||||
menuitemtextinput [Server port (optional): ] [] [ cc2 = $arg1 ] [] 6
|
||||
menuitemtextinput [Server password (optional): ] [] [ cc3 = $arg1 ] [] 128 1
|
||||
@@ -91,7 +91,7 @@ menuitem "2 [ Connect ] " [ connect $cc1 $cc2 $cc3 ]
|
||||
// Connect to a menu as admin.
|
||||
newmenu [Admin connect]
|
||||
|
||||
menuinit [ acc1 = []; acc2 = []; acc3 = []; echo (red)To use this menu to connect as administrator, you will need to know the admin password for the server. ] // Resets the aliases
|
||||
menuinit [ tempalias acc1 []; tempalias acc2 []; tempalias acc3 []; echo (red)To use this menu to connect as administrator, you will need to know the admin password for the server. ] // Resets the aliases
|
||||
menuitemtextinput [Server IP/DNS: ] [] [ acc1 = $arg1 ] [] 255
|
||||
menuitemtextinput [Server port (optional): ] [] [ acc2 = $arg1 ] [] 6
|
||||
menuitemtextinput [Server admin password: ] [] [ acc3 = $arg1 ] [] 128 1
|
||||
@@ -188,7 +188,7 @@ menuitem "2 [ Connect without password ] " [ echo connecting to $sbdesc ; c
|
||||
menuinitselection 3
|
||||
|
||||
const addfavcatmenu [
|
||||
i = (+ 1 (findlist (listfavcats) $arg1))
|
||||
tempalias i (+ 1 (findlist (listfavcats) $arg1))
|
||||
newmenu [edit favourites]
|
||||
if (< $i 11) [
|
||||
menuitemvar (concatword "concat " (mod $i 10) ": $" sbfavourite_ $arg1 _desc " (concatword <s $" sbfavourite_ $arg1 _tag " r>)") (concatword "showmenu [favourites " $i "]")
|
||||
|
||||
@@ -54,7 +54,7 @@ menuitemslider [Graphics detail: ] 1 6 "$gfxqualityalias" 1 [Horrible Low Medium
|
||||
menuitemslider [Sound detail: ] 1 3 "$soundqualityalias" 1 [Low Medium High] [ new_sound_quality $arg1 ]
|
||||
menuitemslider [Field of view: ] 75 120 "$fov" 2 [] [ fov $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem "0 [ OK; View FAQ ]" [ closemenu [QUICK setup]; resetgl; showmenu faq ]
|
||||
menuitem "0 [ OK; View FAQ ]" [ closemenu [QUICK setup]; resetgl; load_faq ; showmenu faq ]
|
||||
menuitem "2 [ OK ]" [ closemenu [QUICK setup]; resetgl ]
|
||||
|
||||
const new_gfx_quality [
|
||||
@@ -420,7 +420,7 @@ menuitem [Weapon settings...] [ showmenu [Weapo
|
||||
menuitem [Edit kill messages...] [ showmenu [Kill Messages] ]
|
||||
menuitem [Bot settings...] [ showmenu [Bot settings] ]
|
||||
|
||||
__screenshottype = 0 // Initial setting for status of screenshots so AC doesn't give errors.
|
||||
tempalias __screenshottype 0
|
||||
|
||||
newmenu Misc
|
||||
menuitemcheckbox [Auto map download: ] "$autogetmap" [ autogetmap $arg1 ]
|
||||
|
||||
@@ -10,9 +10,9 @@ menuitem [5. Team Tactics] [ showmenu [Team Tactics] ]
|
||||
menuitem [6. Public Talk] [ showmenu [Public Talk] ]
|
||||
|
||||
const vcrnd [ // pick random shout if possible
|
||||
len = (listlen $arg1)
|
||||
tempalias len (listlen $arg1)
|
||||
if (> $len 1) [
|
||||
r = (rnd $len)
|
||||
tempalias r (rnd $len)
|
||||
voicecom (at $arg1 $r) (at $arg2 $r)
|
||||
] [
|
||||
voicecom $arg1 $arg2
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Adds a list of aliases to be deleted (cleared from saved.cfg) on every quit.
|
||||
// Do not modify. (unless you really know what you're doing)
|
||||
|
||||
persistidents 0
|
||||
|
||||
const addListOnQuit [ alias_list = $arg1; loop al (listlen $alias_list) [ addOnQuit (concat delalias (at $alias_list $al)) ] ]
|
||||
|
||||
const on_quit_aliases [
|
||||
_demofile __screenshottype
|
||||
acc1 acc2 acc3
|
||||
badargs cc1 cc2
|
||||
cc3 cdirlist cmapp
|
||||
cs_sets cs_newsets customphud
|
||||
custompwld customprimarydirs dirtotry
|
||||
gametimestart i len
|
||||
li modifier nargs
|
||||
needsswitch numcla numrvsf
|
||||
preload_music r s
|
||||
sbdesc sbdns sbport
|
||||
tmp tmpCCO tmp_botmap
|
||||
tmp_botskill tmp_cl tmp_cradius
|
||||
tmp_ff tmp_gamma_list tmp_hex
|
||||
tmpmode tmp_mode tmp_mrem
|
||||
tmp_numargs tmp_numbots tmp_old_sets
|
||||
tmp_sum tmp_svol tmp_wc
|
||||
marg1 marg2 marg3
|
||||
targ1 targ2
|
||||
svdata svpass
|
||||
addListOnQuit on_quit_aliases
|
||||
]
|
||||
|
||||
addListOnQuit $on_quit_aliases
|
||||
addOnQuit [ delalias alias_list ]
|
||||
|
||||
persistidents 1
|
||||
@@ -1,5 +1,4 @@
|
||||
// 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?"
|
||||
@@ -76,39 +75,37 @@ faqAnswer_7 = [
|
||||
|
||||
faqAnswer_8 = [
|
||||
"AssaultCube and its resources are pieced together and developed by various people"
|
||||
"throughout the world. While the source code is open source and released under a zlib"
|
||||
"license, the majority of the media found in the AssaultCube package are released under"
|
||||
"different licenses. Please read and understand the various licenses before"
|
||||
"modifying or redistributing media within AssaultCube or the AssaultCube package"
|
||||
"as a whole."
|
||||
"throughout the world. While the source code is open source and released under a"
|
||||
"license derived from the zlib license, the majority of the media found in the"
|
||||
"AssaultCube package are released under different licenses. Please read and"
|
||||
"understand the various licenses before modifying or redistributing media within"
|
||||
"AssaultCube or the AssaultCube package as a whole."
|
||||
""
|
||||
"Links:"
|
||||
"http://assault.cubers.net/docs/license.html - AssaultCube Licensing Information"
|
||||
]
|
||||
|
||||
genFaq = [
|
||||
loop i (listlen $faqQuestions) [
|
||||
if (= (mod $i 2) 0) [
|
||||
menuitem (concatword (yellow) (format [#%1: ] (+ $i 1)) (at $faqQuestions $i)) -1
|
||||
] [
|
||||
menuitem (concatword (c D) (format [#%1: ] (+ $i 1)) (at $faqQuestions $i)) -1
|
||||
]
|
||||
|
||||
tmpMenuAlias = (getalias (format faqAnswer_%1 (+ $i 1)))
|
||||
loop o (listlen $tmpMenuAlias) [
|
||||
if (strstr (at $tmpMenuAlias $o) "http://") [
|
||||
menuitem (concatword [ ] (blue) (at $tmpMenuAlias $o)) -1
|
||||
] [
|
||||
menuitem (concatword [ ] (white) (at $tmpMenuAlias $o)) -1
|
||||
]
|
||||
]
|
||||
menuitem "" -1
|
||||
]
|
||||
]
|
||||
|
||||
newmenu faq
|
||||
genFaq
|
||||
|
||||
loop i (listlen $faqQuestions) [
|
||||
if (= (mod $i 2) 0) [
|
||||
menuitem (concatword (yellow) (format [#%1: ] (+ $i 1)) (at $faqQuestions $i)) -1
|
||||
] [
|
||||
menuitem (concatword (c D) (format [#%1: ] (+ $i 1)) (at $faqQuestions $i)) -1
|
||||
]
|
||||
|
||||
tempalias tmpMenuAlias (concatword faqAnswer_ (+ $i 1))
|
||||
loop o (listlen $$tmpMenuAlias) [
|
||||
if (strstr (at $$tmpMenuAlias $o) "http://") [
|
||||
menuitem (concatword [ ] (blue) (at $$tmpMenuAlias $o)) -1
|
||||
] [
|
||||
menuitem (concatword [ ] (white) (at $$tmpMenuAlias $o)) -1
|
||||
]
|
||||
]
|
||||
delalias $tmpMenuAlias
|
||||
menuitem "" -1
|
||||
]
|
||||
menuitem [] -1
|
||||
menuitem [ Close] [ closemenu faq ]
|
||||
|
||||
persistidents 1
|
||||
|
||||
delalias faqQuestions
|
||||
@@ -1,7 +1,7 @@
|
||||
const breakparse [ parsebreak = 1 ]
|
||||
|
||||
const doparse [
|
||||
parselen = (strlen $strtoparse)
|
||||
tempalias parselen (strlen $strtoparse)
|
||||
loop dpl $parselen [
|
||||
if $parsebreak break [
|
||||
if $parsebackwards [
|
||||
@@ -18,13 +18,13 @@ const doparse [
|
||||
|
||||
const parsestring [
|
||||
if (> $numargs 2) [
|
||||
strtoparse = $arg1
|
||||
charcontainer = $arg2
|
||||
parsecode = $arg3
|
||||
tempalias strtoparse $arg1
|
||||
tempalias charcontainer $arg2
|
||||
tempalias parsecode $arg3
|
||||
if (> $numargs 3) [
|
||||
parsebackwards = $arg4
|
||||
] [ parsebackwards = 0 ]
|
||||
parsebreak = 0
|
||||
tempalias parsebackwards $arg4
|
||||
] [ tempalias parsebackwards 0 ]
|
||||
tempalias parsebreak 0
|
||||
doparse
|
||||
]
|
||||
]
|
||||
@@ -33,12 +33,11 @@ const parsestring [
|
||||
const CHARACTERTESTS [ISDIGIT ISALPHA ISALNUM ISLOWERCASE ISUPPERCASE ISCHAR ISPUNCT ISWHITESPACE]
|
||||
loop cel (listlen $CHARACTERTESTS) [
|
||||
const (at $CHARACTERTESTS $cel) $cel
|
||||
addListOnQuit (at $CHARACTERTESTS $cel)
|
||||
]
|
||||
|
||||
// trimAllUnnecessaryWhitespace - Returns a modified string after removing any unnecessary leading and trailing whitespace from the original.
|
||||
const trimAllUnnecessaryWhitespace [
|
||||
strtotrim = $arg1
|
||||
tempalias strtotrim $arg1
|
||||
forceinit [charsbegin charsend] -1
|
||||
parsestring $strtotrim tch [
|
||||
if (! (testchar $tch $ISWHITESPACE)) [
|
||||
@@ -58,7 +57,7 @@ const trimAllUnnecessaryWhitespace [
|
||||
]
|
||||
// trimAllWhitespace - Returns a modified string after removing any whitespace characters from the original.
|
||||
const trimAllWhitespace [
|
||||
strtotrim = $arg1
|
||||
tempalias strtotrim $arg1
|
||||
trimmedstr = []
|
||||
parsestring $strtotrim twh [
|
||||
if (! (testchar $twh $ISWHITESPACE)) [
|
||||
@@ -68,4 +67,3 @@ const trimAllWhitespace [
|
||||
return $trimmedstr
|
||||
]
|
||||
|
||||
addListOnQuit [parsebreak parselen strtoparse parsebackwards charcontainer dpl parsecode cel strtotrim charsbegin charsend tch __tch thc __thc twh trimmedstr]
|
||||
@@ -10,20 +10,52 @@
|
||||
// * 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
|
||||
|
||||
// set defaults - may be overwritten by saved.cfg
|
||||
looplist [
|
||||
spamSurvMsgs 0
|
||||
survDifficulty 0
|
||||
nonSurvDefaults 0
|
||||
survBotsToAdd 1
|
||||
survDamageEffects 1
|
||||
survNumBots 6
|
||||
survMaxBots 20
|
||||
timeBetChkPts 60000
|
||||
timeUntilTele 90000
|
||||
] [ a v ] [ alias $a $v ]
|
||||
alias survMap (rnd (listlen $defaultmaps))
|
||||
|
||||
// reset working variables
|
||||
const survResetAliases [gotCheckPoint lastCheckPoint survIsFinished startedSurvival startedOBCount startPreSurvMillis startSurvMillis survKills survTeleported survTotalDmg survOrigSets backInZone changingspeed changinggamma]
|
||||
const resetSurvAliases [ looplist $survResetAliases a [ tempalias $a 0 ] ]
|
||||
//checkinit afterinit resetSurvAliases
|
||||
resetSurvAliases
|
||||
|
||||
const resetSurvAliases [
|
||||
forceinit $survResetAliases 0
|
||||
check2initlist [spamSurvMsgs survDifficulty nonSurvDefaults] 0
|
||||
check2initlist [survBotsToAdd survDamageEffects] 1
|
||||
check2init survNumBots 6; check2init survMaxBots 20; check2init timeBetChkPts 60000; check2init timeUntilTele 90000
|
||||
]
|
||||
// build menus
|
||||
const survSetsList [survNumBots survBotsToAdd timeBetChkPts timeUntilTele survMaxBots]
|
||||
const survDifList ["6 1 60000 90000 20" "8 2 45000 60000 30" "10 3 30000 45000 40" "12 5 10000 20000 50"]
|
||||
const survSetDif [if (checkrange $arg1 0 3) [ survDifficulty = $arg1; loop sdl 5 [ (at $survSetsList $sdl) = (at (at $survDifList $survDifficulty) $sdl) ] ] [ sleep 1000 [ echo (c 3)Error: (c 5)invalid difficulty, defaulting to (genSurvDifStr 0) ] 1; survSetDif 0 ]; nonSurvDefaults = 0 ]
|
||||
|
||||
checkinit afterinit resetSurvAliases
|
||||
newmenu [Survival Mode]
|
||||
menuitemslider (_ [Map: ]) 0 (- (listlen $defaultmaps) 1) "$survMap" 1 [ac_aqueous ac_arabian ac_arctic ac_arid ac_avenue ac_cavern 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_lainio ac_mines ac_outpost ac_power ac_rattrap ac_scaffold ac_shine ac_snow ac_stellar ac_sunset ac_swamp ac_terros ac_toxic ac_urban ac_venison ac_wasteland ac_werk] [ survMap = $arg1 ]
|
||||
menuitemslider (_ [Difficulty: ]) 0 3 "$survDifficulty" 1 [easy intermediate hard impossible] [ survSetDif $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem (concatword [ ] (_ Customize)) [ showmenu [Survival Mode - Customize] ]
|
||||
menuitem (concatword [ ] (_ Start!)) [ survival (at $defaultmaps $survMap) ]
|
||||
|
||||
newmenu [Survival Mode - Customize]
|
||||
menuitemcheckbox (_ [Enable survival damage effects (uses gamespeed/gamma)]) "$survDamageEffects" [ survDamageEffects = $arg1 ]
|
||||
menuitemslider (_ [# of bots to spawn on start: ]) 6 20 "$survNumBots" 1 [] [ survNumBots = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of bots to spawn at checkpoints: ]) 1 5 "$survBotsToAdd" 1 [] [ survBotsToAdd = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of milliseconds between checkpoints: ]) 10000 120000 "$timeBetChkPts" 10000 [] [ timeBetChkPts = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [# of milliseconds before teleporting: ]) 10000 180000 "$timeUntilTele" 10000 [] [ timeUntilTele = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [Maximum # of bots in survival mode: ]) 10 50 "$survMaxBots" 2 [] [ survMaxBots = $arg1; nonSurvDefaults = 1 ]
|
||||
menuitemslider (_ [Spam survival mode messages: ]) 0 1 "$spamSurvMsgs" 1 [ no yes ] [ spamSurvMsgs = $arg1 ]
|
||||
menuitem [] -1
|
||||
menuitem [ Back] [ closemenu [Survival Mode - Customize] ]
|
||||
|
||||
const genSurvDifStr [
|
||||
if $nonSurvDefaults [ result "[CUSTOM]" ] [
|
||||
tmpstrlist = (concat (concatword (green) "[EASY]") (concatword (yellow) "[INTERMEDIATE]") (concatword (orange) "[HARD]") (concatword (dred) "[IMPOSSIBLE]"))
|
||||
tempalias tmpstrlist (concat (concatword (green) "[EASY]") (concatword (yellow) "[INTERMEDIATE]") (concatword (orange) "[HARD]") (concatword (dred) "[IMPOSSIBLE]"))
|
||||
if (&& $numargs (checkrange $arg1 0 3)) [ result (at $tmpstrlist $arg1) ] [ result (at $tmpstrlist $survDifficulty) ]
|
||||
]
|
||||
]
|
||||
@@ -32,9 +64,9 @@ const survOnKill [
|
||||
if (&& (= $arg1 (player1 cn)) (!= $arg1 $arg2)) [ // Player1 was actor and was not suicide
|
||||
++ survKills // Increment enemies killed counter
|
||||
if (! (listlen $survTimeBetKills)) [ // First kill
|
||||
survTimeBetKills = (- (millis) $startSurvMillis) //
|
||||
tempalias survTimeBetKills (- (millis) $startSurvMillis) //
|
||||
] [ add2list survTimeBetKills (- (millis) $survLastKill) ] // Other kills
|
||||
survLastKill = (millis) // Update last kill
|
||||
tempalias 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.
|
||||
@@ -54,9 +86,9 @@ checkinit onHit [if $startedSurvival [survOnHit $arg1 $arg2 $arg3 $arg4]]
|
||||
|
||||
const survival [
|
||||
if (> $numargs 1) [ survSetDif $arg2 ]; kickallbots; if (! (player1 team)) [ team RVSF ]
|
||||
tmpSurvSets = $survNumBots; curSurvDifficulty = 0; forceinit [survLastKill survTimeBetKills] []; resetSurvAliases
|
||||
tempalias tmpSurvSets $survNumBots; tempalias curSurvDifficulty 0; tempalias survLastKill []; tempalias survTimeBetKills []; resetSurvAliases
|
||||
checkinit mapstartonce [
|
||||
startPreSurvMillis = (millis); add2list tmpSurvSets (curmap 1); sleep 3 [ storesets gamma survOrigSets ]
|
||||
tempalias 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!
|
||||
setOfcZones; checkzone
|
||||
]
|
||||
@@ -64,12 +96,12 @@ const survival [
|
||||
]
|
||||
|
||||
const startSurvival [
|
||||
startedSurvival = 1; startSurvMillis = (millis); addnbot $survNumBots CLA bad
|
||||
tempalias startedSurvival 1; tempalias startSurvMillis (millis); addnbot $survNumBots CLA bad
|
||||
sleep 1000 [ if $survTeleported [ echo (orange)You were teleported to the zone. ]; echo (red)Starting survival mode, good luck! ]
|
||||
sleep $timeBetChkPts [ gotCheckPoint = 1; increaseDifficulty ]
|
||||
sleep $timeBetChkPts [ tempalias 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) [ tempalias 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"
|
||||
@@ -119,15 +151,15 @@ const survCstZones [
|
||||
]
|
||||
|
||||
const setOfcZones [
|
||||
survMapIndex = (findlist $survOfcZones (curmap 1))
|
||||
tempalias survMapIndex (findlist $survOfcZones (curmap 1))
|
||||
if (!= $survMapIndex -1) [
|
||||
tmpSurvZone = []
|
||||
tempalias tmpSurvZone []
|
||||
loop soz 4 [ add2list tmpSurvZone (at $survOfcZones (+ $survMapIndex (+ $soz 1))) ]
|
||||
setzone $tmpSurvZone
|
||||
] [
|
||||
survMapIndex = (findlist $survCstZones (curmap 1))
|
||||
if (!= $survMapIndex -1) [
|
||||
tmpSurvZone = []
|
||||
tempalias tmpSurvZone []
|
||||
loop soz 4 [ add2list tmpSurvZone (at $survCstZones (+ $survMapIndex (+ $soz 1))) ]
|
||||
setzone $tmpSurvZone
|
||||
]
|
||||
@@ -135,8 +167,8 @@ const setOfcZones [
|
||||
]
|
||||
|
||||
const findCenter [
|
||||
midZoneX = (+f (divf (-f (at $tmpSurvZone 1) (at $tmpSurvZone 0)) 2) (at $tmpSurvZone 0))
|
||||
midZoneY = (+f (divf (-f (at $tmpSurvZone 3) (at $tmpSurvZone 2)) 2) (at $tmpSurvZone 2))
|
||||
tempalias midZoneX (+f (divf (-f (at $tmpSurvZone 1) (at $tmpSurvZone 0)) 2) (at $tmpSurvZone 0))
|
||||
tempalias midZoneY (+f (divf (-f (at $tmpSurvZone 3) (at $tmpSurvZone 2)) 2) (at $tmpSurvZone 2))
|
||||
]
|
||||
|
||||
const teleportPlayer [
|
||||
@@ -153,16 +185,17 @@ const teleportPlayer [
|
||||
|
||||
const isInZone [ result (&& (checkrange (player1 x) (at $zone 0) (at $zone 1)) (checkrange (player1 y) (at $zone 2) (at $zone 3))) ]
|
||||
|
||||
forceinit [changingspeed changinggamma] 0
|
||||
tempalias changingspeed 0
|
||||
tempalias changinggamma 0
|
||||
|
||||
const changespeed [
|
||||
if (= $connected 0) [
|
||||
if (&& (>= $arg1 10) (<= $arg1 1000)) [
|
||||
changingspeed = 1; curspeed = $gamespeed; targetspeed = $arg1; increments = $arg2
|
||||
changingspeed = 1; tempalias curspeed $gamespeed; tempalias targetspeed $arg1; tempalias increments $arg2
|
||||
if (!= $curspeed $targetspeed) [
|
||||
if (> $curspeed $targetspeed) [
|
||||
loops = (- $curspeed $targetspeed)
|
||||
] [ loops = (- $targetspeed $curspeed) ]
|
||||
tempalias loops (- $curspeed $targetspeed)
|
||||
] [ tempalias loops (- $targetspeed $curspeed) ]
|
||||
loop CSL $loops [
|
||||
sleep (* $CSL $increments) [ gamespeed ((at [+ -] (> $curspeed $targetspeed)) $gamespeed 1) ]
|
||||
]
|
||||
@@ -177,11 +210,11 @@ const changespeed [
|
||||
]
|
||||
|
||||
const changegamma [
|
||||
changinggamma = 1; curgamma = $gamma; targetgamma = $arg1; incrementss = $arg2
|
||||
changinggamma = 1; tempalias curgamma $gamma; tempalias targetgamma $arg1; tempalias incrementss $arg2
|
||||
if (!= $curgamma $targetgamma) [
|
||||
if (> $curgamma $targetgamma) [
|
||||
loopss = (- $curgamma $targetgamma)
|
||||
] [ loopss = (- $targetgamma $curgamma) ]
|
||||
tempalias loopss (- $curgamma $targetgamma)
|
||||
] [ tempalias loopss (- $targetgamma $curgamma) ]
|
||||
loop CGL $loopss [
|
||||
sleep (* $CGL $incrementss) [ gamma ((at [+ -] (> $curgamma $targetgamma)) $gamma 1) ]
|
||||
]
|
||||
@@ -207,7 +240,7 @@ const checkzone [
|
||||
] [
|
||||
if (>= (- (millis) $startSurvMillis) 500) [
|
||||
if (|| $editing (|| (idlebots 2) (! (botsshoot 2)))) [ endSurvival (concatword (genSurvDifStr) (red) [ Error: editmode, idlebots, and botsshoot are not allowed in bot survival mode.]) 1 ]
|
||||
if (! (player1 alive)) [ 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 (! (player1 alive)) [ tempalias 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 (&& (isInZone) (&& $startedOBCount (! $backInZone))) [ backInZone = 1 ]
|
||||
@@ -225,7 +258,7 @@ const checkzone [
|
||||
|
||||
const startOBCount [
|
||||
if (&& (! $survIsFinished) $startedSurvival) [
|
||||
startedOBCount = 1; startOBMillis = (millis); backInZone = 0; tmpSCtr = 5
|
||||
tempalias startedOBCount 1; tempalias startOBMillis (millis); tempalias backInZone 0; tempalias tmpSCtr 5
|
||||
echo (red)Get back into the arena! (white)You only have (red)5 (white)seconds to return.
|
||||
loop soc 5 [ sleep (* $soc 1000) [ if (&& (! $survIsFinished) (&& (! (isInZone)) (! $backInZone))) [ if $spamSurvMsgs [ hudecho (concatword (orange) $tmpSCtr ...) ] [ echo (concatword (orange) $tmpSCtr ...) ]; -= tmpSCtr 1 ] [ backInZone = 1 ] ] ]
|
||||
sleep 5000 [ if (&& (! (isInZone)) (&& (! $backInZone) (>= (- (millis) $startOBMillis) 5000))) [ endSurvival (concatword (genSurvDifStr) (red) [ You took too long to return to the arena!]) 1 ] [ startedOBCount = 0 ] ]
|
||||
@@ -233,7 +266,7 @@ const startOBCount [
|
||||
]
|
||||
|
||||
const increaseDifficulty [
|
||||
lastCheckPoint = (millis)
|
||||
tempalias lastCheckPoint (millis)
|
||||
if (curmodeattr bot) [
|
||||
if (<= (+ $survNumBots $survBotsToAdd) $survMaxBots) [ += survNumBots $survBotsToAdd; addnbot $survBotsToAdd CLA best ] [ tmpSurvInt = (- $survMaxBots $survNumBots); += survNumBots $tmpSurvInt; addnbot $tmpSurvInt CLA best ]
|
||||
if (< $curSurvDifficulty 4) [ ++ curSurvDifficulty; botskillall (at [bad worse medium good best] $curSurvDifficulty) ]
|
||||
@@ -242,7 +275,7 @@ const increaseDifficulty [
|
||||
|
||||
const endSurvival [
|
||||
if (! $survIsFinished) [
|
||||
tmp_survstr = $arg1; tmp_nargs = $numargs; survIsFinished = 1; startedSurvival = 0; survNumBots = (at $tmpSurvSets 0)
|
||||
tempalias tmp_survstr $arg1; tempalias tmp_nargs $numargs; tempalias survIsFinished 1; tempalias startedSurvival 0; tempalias survNumBots (at $tmpSurvSets 0)
|
||||
checkinit mapstartonce [
|
||||
if (! $dyngamma) [ gamma (at $survOrigSets 0) ]; gamespeed 100
|
||||
if (< $tmp_nargs 2) [
|
||||
@@ -261,8 +294,4 @@ const endSurvival [
|
||||
]
|
||||
]
|
||||
|
||||
// List of aliases that need to be cleared from saved.cfg on quit:
|
||||
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 tmp_nargs survIsFinished tmpstrlist finalSurvMillis zone changegamma changespeed loops loopss increments incrementss curgamma targetgamma curspeed targetspeed applySurvDamageEffects survSetsList survDifList survSetDif survResetAliases survAliases])
|
||||
addListOnQuit $survAliases
|
||||
|
||||
persistidents 1
|
||||
+24
-24
@@ -147,7 +147,7 @@ const add2alias [
|
||||
const addOnLoadOnce [ add2alias mapstartonce $arg1 ]
|
||||
const addOnLoadAlways [ add2alias mapstartalways $arg1 ]
|
||||
const addOnQuit [ add2alias onQuit $arg1 ]
|
||||
const check2init [ if (! (checkalias $arg1)) [ $arg1 = $arg2 ] ] // only overwrites an alias if it doesn't exist
|
||||
const check2init [ if (! (checkalias $arg1)) [ tempalias $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
|
||||
@@ -198,14 +198,15 @@ delta_game_2 = [ if (checkrange (+ $fov $arg1) 75 120) [ fov (+ $fov $arg1) ] ]
|
||||
delta_spect_0 = [ changefollowplayer $arg1 ]
|
||||
|
||||
// Map editing using the mousewheel...
|
||||
modifier = 0
|
||||
tempalias modifier 0
|
||||
const domodifier [ modifier = $arg1; onrelease [ modifier = 0 ] ]
|
||||
|
||||
const universaldelta [
|
||||
push s
|
||||
if $editing [ s = edit ] [
|
||||
if (player1 alive) [ s = game ] [ s = spect ]
|
||||
]
|
||||
(concatword delta _ $s _ $modifier)
|
||||
(concatword delta _ (pop s) _ $modifier)
|
||||
]
|
||||
// To utilize the below, you will need to bind "domodifier X"
|
||||
// (replace X with the number of the delta_edit) to a key. To
|
||||
@@ -238,9 +239,8 @@ const toggleshowmap [ showmap 1; onrelease [ showmap 0 ] ]
|
||||
// arg7 "server description"
|
||||
// TODO: interpret a#3,4,5,6 [ft:any1:2010apr04]
|
||||
|
||||
forceinit [sbdns sbport sbdesc sbmsg sbpwd] []
|
||||
const sbconnect [
|
||||
sbdns = $arg1; sbport = $arg2; sbdesc = $arg7; forceinit [sbpwd sbmsg] []
|
||||
tempalias sbdns $arg1; tempalias sbport $arg2; tempalias sbdesc $arg7; tempalias sbpwd []; tempalias sbmsg []
|
||||
if (>= $arg5 1) [
|
||||
sbmsg = [This server is set to private.]; showmenu [password required]
|
||||
] [
|
||||
@@ -262,7 +262,7 @@ const quickanswer [ if (>= $lastpm 0) [ saycommand (concat /pm $lastpm []) ] [ s
|
||||
|
||||
// For those players who use IRC too much...
|
||||
const join [ connect $arg1 $arg2 $arg3 ]
|
||||
const reconnect [ if $numargs [ svpass = $arg1 ] [ svpass = [] ]; if $connected [ svdata = (curserver); afterdisconnect [ connect (at $svdata 0) (at $svdata 1) $svpass ] ] ]
|
||||
const reconnect [ if $numargs [ tempalias svpass $arg1 ] [ tempalias svpass [] ]; if $connected [ tempalias svdata (curserver); afterdisconnect [ connect (at $svdata 0) (at $svdata 1) $svpass ] ] ]
|
||||
|
||||
const dlmap [ getmap $arg1 [ sleep 2500 (concat map $arg1) ] ]
|
||||
const rndmap [ result (at $defaultmaps (rnd (listlen $defaultmaps))) ]
|
||||
@@ -272,7 +272,7 @@ const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ]
|
||||
const -- [ if (checkalias $arg1) [ -= $arg1 1 ] ]
|
||||
const ++f [ if (checkalias $arg1) [ +=f $arg1 1 ] ]
|
||||
const --f [ if (checkalias $arg1) [ -=f $arg1 1 ] ]
|
||||
const listaverage [ if (listlen $arg1) [ tmp_sum = 0; loop gsl (listlen $arg1) [ +=f tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ]
|
||||
const listaverage [ if (listlen $arg1) [ tempalias tmp_sum 0; loop gsl (listlen $arg1) [ +=f tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ]
|
||||
|
||||
forceinit [cp_entbuf cp_entstr] NULL
|
||||
const get_ent_attrs [ cp_entbuf = (getenttype); loop gea $ENT_NUM_ATTRS [ add2list cp_entbuf (getentattr $gea) ] ]
|
||||
@@ -298,28 +298,26 @@ const pasteent [
|
||||
|
||||
// genhex - Randomly generates a valid hexadecimal color value (e.g. 0x2FCAF1) - useful for finding fogcolours.
|
||||
const genhex [
|
||||
tmp_hex = 0x
|
||||
loop ghl 6 [
|
||||
if (rnd 2) [ tmp_hex = (concatword $tmp_hex (rnd 10)) ] [ tmp_hex = (concatword $tmp_hex (at [A B C D E F] (rnd 6))) ]
|
||||
]
|
||||
push genhex [at [0 1 2 3 4 5 6 7 8 9 A B C D E F] (rnd 16)]
|
||||
push tmp_hex (concatword 0x (genhex) (genhex) (genhex) (genhex) (genhex) (genhex))
|
||||
echo (red)Trying hexadecimal color: (white) $tmp_hex
|
||||
result $tmp_hex
|
||||
result (pop tmp_hex genhex)
|
||||
]
|
||||
|
||||
// genwc - Randomly generates a valid watercolour value (e.g. 2 17 29) - useful for finding watercolours.
|
||||
const genwc [
|
||||
if $editing [
|
||||
tmp_wc = []
|
||||
loop gwl 3 [ add2list tmp_wc (rrnd 1 256) ]
|
||||
echo (red)Trying water color: (white) $tmp_wc
|
||||
watercolour (at $tmp_wc 0) (at $tmp_wc 1) (at $tmp_wc 2)
|
||||
loop i 3 [push (concatword wc $i) (rrnd 1 256)]
|
||||
echo (red)Trying water color: (white) $wc0 $wc1 $wc2
|
||||
watercolour $wc0 $wc1 $wc2
|
||||
pop wc0 wc1 wc2
|
||||
]
|
||||
]
|
||||
|
||||
// gencl - Randomly generates a valid coloured light.
|
||||
const gencl [
|
||||
if $editing [
|
||||
tmp_numargs = $numargs; tmp_cl = []
|
||||
push tmp_numargs $numargs; push tmp_cl []
|
||||
loop gcl 3 [ add2list tmp_cl (rrnd 1 256) ]
|
||||
if $tmp_numargs [
|
||||
if (|| (!= (selx) 0) (!= (sely) 0)) [
|
||||
@@ -332,6 +330,7 @@ const gencl [
|
||||
entset light (getentattr 0) (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2)
|
||||
] [ echo (red)Error: (white)The current closest entity: (orange) (getenttype) (white)is not a light. ]
|
||||
]
|
||||
pop tmp_numargs tmp_cl
|
||||
] [ echo (red)Error: (white)You must be in edit mode for (blue)gencl (white)to function. ]
|
||||
]
|
||||
|
||||
@@ -375,7 +374,7 @@ const megabind [ if (> $numargs 5) [ bind $arg1 (format "if (watchingdemo) [ %1
|
||||
// storesets - Generates an alias (list) of the current values for the given CVARs.
|
||||
const storesets [
|
||||
if (> $numargs 1) [
|
||||
badargs = 0; $arg2 = []
|
||||
tempalias badargs 0; $arg2 = []
|
||||
loop ssl (listlen $arg1) [
|
||||
if (isIdent (at $arg1 $ssl)) [
|
||||
add2list $arg2 (getalias (at $arg1 $ssl))
|
||||
@@ -410,7 +409,7 @@ switch = [
|
||||
const cs_sets [clockdisplay crosshairsize hidecompass hideconsole hidectfhud hidedamageindicator hidehudequipment hidehudmsgs hideradar hidespecthud hideteam hidevote hudgun specthudgun showstats showtargetname showgrid showclips accuracy]
|
||||
const cs_newsets [0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0]
|
||||
|
||||
const disablehud [ storesets $cs_sets tmp_old_sets; loop csl (listlen $cs_sets) [ (at $cs_sets $csl) (at $cs_newsets $csl) ]; if $editing [ seteditshow 0 ] ]
|
||||
const disablehud [ tempalias tmp_old_sets []; storesets $cs_sets tmp_old_sets; loop csl (listlen $cs_sets) [ (at $cs_sets $csl) (at $cs_newsets $csl) ]; if $editing [ seteditshow 0 ] ]
|
||||
const enablehud [ if (checkalias tmp_old_sets) [ loop ros (listlen $cs_sets) [ (at $cs_sets $ros) (at $tmp_old_sets $ros) ]; if $editing seteditshow ] ]
|
||||
const cleanshot [ disablehud; sleep 200 screenshot; sleep 500 enablehud ]
|
||||
|
||||
@@ -427,7 +426,7 @@ const highestcn [
|
||||
// convertcase - Zap lists of strings to lower/uppercase.
|
||||
const convertcase [
|
||||
if (> $numargs 1) [
|
||||
tmpCCO = []
|
||||
tempalias tmpCCO []
|
||||
loop ccl $numargs [ if (> $ccl 0) [ tmpCCO = (concatword $tmpCCO [ ] (getalias (format arg%1 (+ $ccl 2)))) ] [ tmpCCO = (concatword $tmpCCO $arg2) ] ]
|
||||
if (!= $arg1 0) [ result (toupper $tmpCCO) ] [ result (tolower $tmpCCO) ]
|
||||
]
|
||||
@@ -470,13 +469,14 @@ const customclaimadminscript [
|
||||
] [ echo (red)Error: (white)you're not connected to $_CAS_servername servers ]
|
||||
]
|
||||
|
||||
// get optional scripts on demand
|
||||
tempalias load_survival [ run opt/survival ; alias load_survival [] ]
|
||||
tempalias load_parsestring [ run opt/parsestring ; alias load_parsestring [] ]
|
||||
tempalias load_faq [ run opt/faq ; alias load_faq [] ]
|
||||
|
||||
// Execute other .cfgs/scripts.
|
||||
run on_quit
|
||||
run parsestring
|
||||
run dyngamma
|
||||
run survival
|
||||
run autosave
|
||||
run faq
|
||||
|
||||
persistidents 1
|
||||
execdir scripts
|
||||
|
||||
+1
-1
@@ -118,6 +118,6 @@ registermusic "pingpong/Ping_Pong_-_Kamikadze" // M_FLAGGRAB
|
||||
registermusic "pingpong/Ping_Pong_-_Headshot" // M_LASTMINUTE1
|
||||
registermusic "dcp/Dietmar_Pier_-_AssaultCube" // M_LASTMINUTE2
|
||||
|
||||
preload_music = [ loop m 3 [ musicpreload $m ] ]
|
||||
const preload_music [ loop m 3 [ musicpreload $m ] ]
|
||||
// uncomment the line below if you want to preload the music (if you experience delay e.g. when picking up a flag)
|
||||
//preload_music
|
||||
|
||||
Reference in New Issue
Block a user