Files
assaultcube-/config/scripts.cfg
T
Bukz 876bd85e74 removing slowtoggle
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6448 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-05-17 14:28:05 +00:00

412 lines
17 KiB
INI

// CubeScript placed in this file is automatically executed on each startup.
// "editent" command:
// This command collects all the attributes of the nearest entity, and then
// prompts that into a handy command that allows you to edit that entities
// attributes easily.
// Note: The editent command can NOT define rotation/yaw inside the command!
// However, the current yaw of the player will define the rotation/yaw when
// using the command!
editent = [
if (strcmp (getenttype) "mapmodel") [ saycommand "/entset" (getenttype) (getentattr 1) (getentattr 2) (getentattr 3) ] [
if (> (findlist "light sound clip plclip" (getenttype)) -1) [
saycommand "/entset" (getenttype) (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3)
] [
saycommand "/entset" (getenttype) (getentattr ((> (findlist "playerstart ctf-flag" (getenttype)) -1)))
]
]
]
// "convertclips" command:
// This command automatically changes the a "clip" to a "plclip" entity or vice-versa.
convertclips = [
if (strcmp (getenttype) "clip") [ entset plclip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) ] [
if (strcmp (getenttype) "plclip") [ entset clip (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) ] [
echo No changes made. This entity isn't a clip or a plclip.; echo Try using the /closestenttype command to find a specific entity.
]
]
]
// "gibsgore" command:
// This command controls gib Speed/Number/TTL all in one variable.
gibsgore = [
if (= $arg1 4) [ // Unrealistic
gib 1; gibspeed 40; gibnum 100; gibttl 2500 // Turn TTL down to minimise lag...
__gibsgore = 4
] [
if (= $arg1 3) [ // Messy
gib 1; gibspeed 15; gibnum 65; gibttl 10000
__gibsgore = 3
] [
if (= $arg1 2) [ // Good
gib 1; gibspeed 30; gibnum 75; gibttl 5000
__gibsgore = 2
] [
if (= $arg1 1) [ // Normal
gib 1; gibspeed 30; gibnum 6; gibttl 5000
__gibsgore = 1
] [
if (= $arg1 0) [ // Off
gib 0
__gibsgore = 0
]
]
]
]
]
]
// "fullscreenscript" command:
// This command allows swapping of fullscreen mode to be bound to a key.
fullscreenscript = [ if $fullscreen [ fullscreen 0 ] [ fullscreen 1 ] ]
editmapmsg = [ saycommand ( concatword [/mapmsg ] ["] (getmapmsg) ["] ) ]
run = [ exec (concatword config/ $arg1 .cfg) ]
// Auto-completions
mapcomplete = [complete $arg1 "packages/maps/official packages/maps" cgz]
mapcommands = "map tdm coop dm lms ts ctf pf lss osok tosok htf vip tktf ktf sendmap"
loop i (listlen $mapcommands) [ mapcomplete (at $mapcommands $i) ]
complete demo "demos" dmo
entcomplete = [ listcomplete $arg1 "light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip plclip helmet" ]
entcomplete newent; entcomplete clearents; entcomplete closestenttype
// TODO:FIXME change all occurrence of SPECT(ator) to GHOST
listcomplete team "CLA RVSF CLA-SPECT RVSF-SPECT SPECTATOR"
// Game mode descriptions...
gamemodedesc 0 [Team Deathmatch: Find the enemy team and destroy them!]
gamemodedesc 1 [Co-operative edit: Use this mode to edit maps with others online!]
gamemodedesc 2 [Deathmatch: Destroy anything that moves! Everyone for themselves!]
gamemodedesc 3 [Survivor: Everyone for themselves! Once you die, you must wait for the round to restart.]
gamemodedesc 4 [Team Survivor: Find the enemy team, destroy them. Once everyone on the enemy team is gone... repeat!]
gamemodedesc 5 [Capture the Flag: Steal the enemy flag and bring it to your home base. Don't let your own flag get stolen.]
gamemodedesc 6 [Pistol Frenzy: Can you make your enemy eat lead with the most simple of weapons?]
gamemodedesc 7 [Bot Team Deathmatch: Find the enemy team and destroy them!]
gamemodedesc 8 [Bot Deathmatch: It's every man and A.I for themselves! Dismantle those bots! ]
gamemodedesc 9 [Last Swiss Standing: Knive and bomb the enemy!]
gamemodedesc 10 [One Shot, One Kill: You and your opponents start with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.]
gamemodedesc 11 [Team One Shot, One Kill: Your team starts with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.]
gamemodedesc 12 [Bot One-Shot, One Kill: You and the bots start with 1hp, a sniper rifle, a knife and no pickups. Survive with your sniper, or humiliate with your swiss steel.]
gamemodedesc 13 [Hunt the Flag: Find the enemy flag, frag the flag bearer and collect the flag to score. Protect your own team flag. If the flag bearer collects the enemy flag, they gain a 1 point bonus.]
gamemodedesc 14 [Team Keep the Flag: There is only one flag. Get the flag and keep it. You score one point every 15 seconds. If your teammate has the flag, protect him. If the flag bearer collects the enemy flag, they gain a 1 point bonus.]
gamemodedesc 15 [Keep the Flag: Get the flag and keep it. You score one point every 15 seconds. Everybody else will want to destroy you!]
resetbinds = [ run resetbinds; echo (c 3)All binds have been reset to default values! ]
changeteam = [ if (< (curteam) 4) [ team (at "RVSF CLA RVSF-SPECT CLA-SPECT" (curteam)) ] ]
spectate = [ suicide; sleep 500 [ team SPECTATOR ] ]
// Mode/map-setting aliases.
votemap = [ mode $arg1; map $arg2 ]
tdm = [ votemap 0 $arg1 ]
coop = [ votemap 1 $arg1 ]
dm = [ votemap 2 $arg1 ]
lms = [ votemap 3 $arg1 ]
ts = [ votemap 4 $arg1 ]
ctf = [ votemap 5 $arg1 ]
pf = [ votemap 6 $arg1 ]
lss = [ votemap 9 $arg1 ]
osok = [ votemap 10 $arg1 ]
tosok = [ votemap 11 $arg1 ]
htf = [ votemap 13 $arg1 ]
vip = [ votemap 13 $arg1 ]
tktf = [ votemap 14 $arg1 ]
ktf = [ votemap 15 $arg1 ]
// Helper aliases for (c) - easy color insertion. (e.g. echo (red)Hello (blue)world! (white)My fov today is: (orange) $fov)
green = [ result (c 0) ]
blue = [ result (c 1) ]
yellow = [ result (c 2) ]
red = [ result (c 3) ]
gray = [ result (c 4) ]
white = [ result (c 5) ]
dbrown = [ result (c 6) ]
dred = [ result (c 7) ]
purple = [ result (c 8) ]
orange = [ result (c 9) ]
// Weapon switching/action utilities.
primary = [ weapon (currentprimary) ]
secondary = [ weapon 1 ]
melee = [ weapon 0 ]
grenades = [ weapon 8 ]
altaction = [ (concatword altaction_ (curweapon)) ]
quicknadethrow_old = [
if (> (magcontent 8) 0) [
if (!= (curweapon) 7) [ grenades ]
attack
]
onrelease [ sleep 1 [ if (= (curweapon) 7) [ weapon (prevweapon) ] ] ]
]
loop i 10 [ (concatword altaction_ $i) = quicknadethrow ] // Quick nade throw is default
altaction_5 = [ setscope 1; onrelease [ setscope 0 ] ] // Sniper
// altaction_7 = [ setburst 1; onrelease [ setburst 0 ] ] // Combat pistol // TODO uncomment when this becomes a priority/testing, for now lets save an unused alias - Bukz
// altaction_8 = [ attack ] // Grenade // with this comment, you throw the nade and the nade is unselected : Brahma
oldsens = $sensitivity
zoom = [
if (= $arg1 1) [
if (! (=f $sensitivity (scopesens))) [
oldsens = $sensitivity
// avoid error if using 0.001 as sensitivity
newsens = (scopesens)
if (> (*f 1 1000) $newsens) [ if (< 1000 $newsens) [ sensitivity (scopesens) ] ]
setscope 1
]
] [ sensitivity $oldsens; setscope 0 ]
]
delta_game_0 = [ if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ] ]
delta_spect_0 = [ changefollowplayer $arg1 ]
// Map editing using the mousewheel...
modifier = 0
domodifier = [ modifier = $arg1; onrelease [ modifier = 0 ] ]
universaldelta = [
if $editing [ s = "edit" ] [
if (alive) [ s = "game" ] [ s = "spect" ]
]
(concatword delta _ $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
// use them, simply hold the key that the "domodifier" is bound
// to and then scroll backwards/forwards while looking at the
// floor/ceiling.
delta_edit_0 = [ editheight $flrceil $arg1 ] // Move cubes...
delta_edit_1 = [ if $flrceil [ vdelta $arg1 ] [ vdelta (- 0 $arg1) ] ] // Change heightfielding...
delta_edit_2 = [ edittex $flrceil $arg1 ] // Change floor/ceiling textures...
delta_edit_3 = [ edittex (+ $flrceil 1) $arg1 ] // Change wall/upper-wall textures...
delta_edit_4 = [ equalize $flrceil ] // Equalize floor/ceiling...
delta_edit_5 = [ entproperty 0 $arg1 ] // Changes the first value on entities...
delta_edit_6 = [ entproperty $editaxis $arg1 ] // Move map entity...
delta_edit_7 = [ entproperty 1 $arg1 ] // Changes the second value on entities...
delta_edit_8 = [ entproperty 2 $arg1 ] // Changes the third value on entities...
delta_edit_9 = [ entproperty 3 $arg1 ] // Changes the fourth value on entities...
// HUD toggles
toggleshowmap = [ showmap 1; onrelease [ showmap 0 ] ]
// convenient connecting from the serverbrowser
// sbconnect arg list:
// arg1 IP, arg2 port,
// arg3 1: server full
// arg4 1: password protected
// arg5 1: private mode, 2: match mode
// arg6 1: banned, 2: blacklisted 3: both
// arg7 "server description"
// TODO: interpret a#3,4,5,6 [ft:any1:2010apr04]
sbdns = ""; sbport = ""; sbdesc = ""; sbmsg = ""; sbpwd = ""
sbconnect = [
sbdns = $arg1; sbport = $arg2; sbdesc = $arg7; sbpwd = ""; sbmsg = ""
if (>= $arg5 1) [
sbmsg = "This server is set to private."; showmenu "password required"
] [
if (>= $arg6 1) [
sbmsg = "You are banned from this server."; showmenu "password required"
] [
if (= $arg4 1) [
sbmsg = "This server is password-protected."; showmenu "password required"
] [
echo connecting to $arg7; connect $arg1 $arg2;
]
]
]
]
// For those players who use IRC too much...
join = [ connect $arg1 $arg2 $arg3 ]
add2alias = [
if (strcmp "" (getalias $arg1)) [ $arg1 = $arg2 ] [
$arg1 = (concat (concatword (getalias $arg1) ";") $arg2)
]
]
addOnLoadOnce = [ add2alias mapstartonce $arg1 ]
addOnLoadAlways = [ add2alias mapstartalways $arg1 ]
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) ] ]
// rrnd - Returns a ranged random integer.
rrnd = [ + (rnd (- $arg2 $arg1)) $arg1 ]
// copyent & pasteent - Quickly copy/paste the current closest entity. Initialize the two aliases below as "NULL" for error catching.
// 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
get_ent_attrs = [
if $editing [
cp_entbuf = (getenttype)
loop gea 4 [ add2list cp_entbuf (getentattr $gea) ]
]
]
copyent = [
if $editing [
get_ent_attrs
cp_entstr = (concatword (c 9) "(" (at $cp_entbuf 0) " " (at $cp_entbuf 1) " " (at $cp_entbuf 2) " " (at $cp_entbuf 3) " " (at $cp_entbuf 4) ")" (c 5)) // Output (a string): (enttype param1 param2 param3 param4)
echo (c 1)Note: (c 5)The current closest entity: $cp_entstr - has been copied.
]
]
pasteent = [
if $editing [
if (&& (! (strcmp $cp_entbuf NULL)) (! (strcmp $cp_entstr NULL))) [
if (strcmp (at $cp_entbuf 0) mapmodel) [
newent (at $cp_entbuf 0) (at $cp_entbuf 2) (at $cp_entbuf 3) (at $cp_entbuf 4)
] [
newent (at $cp_entbuf 0) (at $cp_entbuf 1) (at $cp_entbuf 2) (at $cp_entbuf 3) (at $cp_entbuf 4)
]
echo (c 1)Note: (c 5)The previously copied entity: $cp_entstr - has been pasted.
] [ echo (c 3)Error: (c 5)pasteent requires an (c 1)initial (c 5)copyent to function. ]
]
]
// genhex - Randomly generates a valid hexadecimal color value (e.g. 0x2FCAF1) - useful for finding fogcolours.
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))) ]
]
echo (c 3)Trying hexadecimal color: (c 5) $tmp_hex
result $tmp_hex
]
// genwc - Randomly generates a valid watercolour value (e.g. 2 17 29) - useful for finding watercolours.
genwc = [
if $editing [
tmp_wc = ""
loop gwl 3 [ add2list tmp_wc (rrnd 1 256) ]
echo (c 3)Trying water color: (c 5) $tmp_wc
watercolour (at $tmp_wc 0) (at $tmp_wc 1) (at $tmp_wc 2)
]
]
// gencl - Randomly generates a valid coloured light.
gencl = [
if $editing [
tmp_numargs = $numargs; tmp_cl = ""
loop gcl 3 [ add2list tmp_cl (rrnd 1 256) ]
if $tmp_numargs [
if (|| (! (= $selx 0)) (! (= $sely 0))) [
echo (c 3)Trying colored light: (c 5) $arg1 (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2)
newent light $arg1 (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2)
] [ echo (c 3)Error: (c 5)If an argument "(radius)" is given for (concatword (c 1) gencl (c 5) ",") you must select a cube first. ]
] [
if (strcmp (getenttype) light) [
echo (c 3)Trying colored light: (c 5) (getentattr 0) (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2)
entset light (getentattr 0) (at $tmp_cl 0) (at $tmp_cl 1) (at $tmp_cl 2)
] [ echo (c 3)Error: (c 5)The current closest entity: (c 9) (getenttype) (c 5)is not a light. ]
]
] [ echo (c 3)Error: (c 5)You must be in edit mode for (c 1)gencl (c 5)to function. ]
]
// megabind - Binds a key to many different actions depending on the current game state.
megabind = [
if (> $numargs 5) [
bind $arg1 (format "if (watchingdemo) [ %1 ] [ if (|| $editing (= $gamemode 1)) [ %2 ] [ if $connected [ %3 ] [ if (curmodeattr bot) [ %4 ] [ %5 ] ] ] ]" $arg2 $arg3 $arg4 $arg5 $arg6)
]
]
// getscrext - Returns the proper file extension for the client's current screenshottype setting, including the "."
getscrext = [
if (= $screenshottype 0) [ result ".bmp" ] [
if (= $screenshottype 1) [ result ".jpg" ] [
if (= $screenshottype 2) [ result ".png" ] [
result -1
]
]
]
]
// getmodeacr - Returns the proper current mode's acronym.
gamemodes_list = "TDM COOP DM SURV TSURV CTF PF BTDM BDM LSS OSOK TOSOK BOSOK HTF TKTF KTF"
getmodeacr = [ result (at $gamemodes_list $gamemode) ]
// storesets - Generates an alias (list) of the current values for the given CVARs.
omit_idents = "curname curteam idlebots name"
storesets = [
if (> $numargs 1) [
if (listlen $arg1) [
badargs = 0; $arg2 = ""
loop ssl (listlen $arg1) [
if (&& (isIdent (at $arg1 $ssl)) (! (strstr $omit_idents (at $arg1 $ssl)))) [
add2list $arg2 (getvar (at $arg1 $ssl))
] [ badargs = 1; break ]
]
if $badargs [ delalias $arg2; echo (c 3)Error: (c 5)Bad "argument(s)" given! ]
]
]
]
// strins - Inserts a string into another string, at position x.
strins = [
if (> $numargs 2) [
if (&& (> $arg3 -1) (< $arg3 (strlen $arg1))) [
tmp_output = ""
loop sil (strlen $arg1) [
if (= $sil $arg3) [ tmp_output = (concatword $tmp_output $arg2 (substr $arg1 $sil 1)) ] [ tmp_output = (concatword $tmp_output (substr $arg1 $sil 1)) ]
]
result $tmp_output
] [ result -1 ]
]
]
// cleanshot - Take a "clean" screenshot with no HUD items.
cs_sets = "clockdisplay crosshairsize hidecompass hideconsole hidectfhud hidedamageindicator hidehudequipment hidehudmsgs hideradar hidespecthud hideteam hidevote hudgun spechudgun showstats"
cs_newsets = "0 0 1 1 1 1 1 1 1 1 1 1 0 0 0"
cleanshot = [
storesets $cs_sets tmp_old_sets
loop csl (listlen $cs_sets) [ (at $cs_sets $csl) (at $cs_newsets $csl) ]
sleep 10 [ screenshot ]
sleep 90 [ loop ros (listlen $cs_sets) [ (at $cs_sets $ros) (at $tmp_old_sets $ros) ] ]
]
votepending = 0
if (! (checkalias onCallVote)) [ onCallVote = "" ]; if (! (strstr $onCallVote votepending)) [ add2alias onCallVote [ votepending = 1 ] ]
if (! (checkalias onVoteEnd)) [ onVoteEnd = "" ]; if (! (strstr $onVoteEnd votepending)) [ add2alias onVoteEnd [ votepending = 0 ] ]
// convertcase - Zap a list of strings to lower/uppercase.
convertcase = [
if (> $numargs 0) [
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)
]
]
]
// Simple claim-admin script for one single-server.
// Fill in the 3 aliases below, and uncomment the below line to activate.
// bind F3 "customclaimadminscript"
_CAS_serverip = "IP ADDRESS"
_CAS_serverpass = "PASSWORD"
_CAS_servername = "SERVER NAME"
customclaimadminscript = [
if (strcmp (curserver 1) $_CAS_serverip) [
if (! (currole)) [ setadmin 1 $_CAS_serverpass ] [ setadmin 0; echo you relinquished admin status ]
] [ echo (c 3)Error: (c 5)you're not connected to $_CAS_servername servers ]
]
// Execute other .cfgs/scripts.
run on_quit
run dyngamma
run survival
run tutorial
execdir scripts