Scripts
From NS community wiki
(the whole stuff has to be revised and completed... also see http://www.unknownworlds.com/ns/forums/index.php?showtopic=86538 )
Contents |
Presentation of what is a script, and what they can be used to do
Scripts are defined as a series, or string, of commands executed by the hitting of one key. Ultra-basic scripts would be like : bind "t" "impulse 100" ( logospray )
The advantage of scripts is linking ONE button, ONE key on your keyboard, to MULTIPLE commands. For example : alias med "impulse 10; say_team Medpack" bind b "med" Basically this script does " when you hit b you request a medpack and say to your team 'medpack' ".
Scripts are mostly used for the pistol weapon, the wigglewalk technique and the upgrades of all kinds.
Mp_blockscripts blocks _special and + and - scripts, as well as config-switching.
Using a script
First off, a script is always in the following form :
alias A "B; C" bind K "A"
A being the alias name B and C different actions K the key bound to execute the script.
It is generally wise to use multiple configs for your different scripts. For example, you can use marine.cfg when you play marines, and kharaa.cfg when you play aliens. You can also have one config file per lifeform.
For example, if we consider you want to play with a marine.cfg and a kharaa.cfg
You need a userconfig.cfg ( which you can use for the mp_blockscripts 1 servers ), and in this userconfig.cfg you have to create something like :
alias joinmarines "jointeamone; exec marine.cfg" bind F1 "joinmarines" alias joinkharaa "jointeamtwo; exec kharaa.cfg" bind F2 "joinkharaa"
You can also ensure the config-loading by adding, at the start of the kharaa.cfg and marine.cfg some sounds like (beginning of marine.cfg)
jointeamone speak on
When the config is loaded you will hear the half-life guy say "on".
It is also good to have your .cfg be clean so that when you have to edit something you can do it really easily. For example you can use the following structure :
- marine.cfg - // scriptname bind ... alias ... // scriptname2 bind ... alias ...
In the list below, please use the same kind of structure. You cna also describe what the script does below its name.
+ and - commands are also very important. For every + there is a - The + is the action executed when actually hitting the key (+duck : you start ducking when hitting the key) The - is the action executed automatically when releasing the key (-duck : you stop ducking when releasing the key) Whenever you create a +script, you have to create a -script. Then you can bind a key to the +script, and whenever you will hit the bound key, the +script action will be executed, and the -script actions will be executed when releasing the key.
Common scripts
// WAIT
It's always cool to write w50 instead of 50 times wait; wait; ... . You may need those for the following scripts.
alias "w" "wait" alias "w2" "w;w" alias "w3" "w;w;w" alias "w4" "w;w;w;w" alias "w5" "w;w;w;w;w" alias "w6" "w;w;w;w;w;w" alias "w7" "w;w;w;w;w;w;w" alias "w8" "w;w;w;w;w;w;w;w" alias "w9" "w;w;w;w;w;w;w;w;w" alias "w10" "w;w;w;w;w;w;w;w;w;w" alias "w50" "w10;w10;w10;w10;w10" alias "w100" "w50; w50"
// CHEATS
Easy and cheap *script* for when the sv_cheats 1 command is activated so that you don't have to type givexp or givepoints 1000 times in your console...also activates sv_cheats 1 ( if local ), bigdig ( fast construction ) and cl_showspeed 1 ( cool for bunnyhop ).
alias givemanypoints "givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints; wait;givepoints; givepoints"
alias givemanyxp "givexp; givexp; wait; givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait;givexp; givexp; wait; givexp; givexp; wait; givexp; givexp;wait; givexp; givexp;wait; givexp; givexp;wait; givexp; givexp;wait; givexp; givexp"
alias cheatson "sv_cheats 1; wait; bigdig; wait; givemanypoints; wait; givemanyxp; wait; cl_showspeed 1" bind yourkey "cheatson"
// DEMO RECORDING
First hit of your key : you can type the name you want for the demo, and it will be recorded. Second hit : stops the recording, and then you can record again..
alias demo "demo_prompt" alias demo_prompt "messagemode record; alias demo demo_stop" alias demo_stop "stop; speak exit; alias demo demo_prompt" bind yourkey "demo"
// DISPLAYING RATES
Basically, you just enter your rates values instead of the x below, and whenever you hit the key you bound to it, you will see the rates values displayed at the top left corner of your screen. You won't be able to move for a few seconds, but it's cool to have an overview of your general values so you can tell someone easily ingame without messing up with the console.
alias DisplayRates0 "developer 1; motdfile echo.txt; motd_write ----- * Displaying Rates [ ON ] * -----; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates1 "developer 1; motdfile echo.txt; motd_write RATE : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates2 "developer 1; motdfile echo.txt; motd_write CL_CMDBACKUP : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates3 "developer 1; motdfile echo.txt; motd_write CL_CMDRATE : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates4 "developer 1; motdfile echo.txt; motd_write CL_UPDATERATE : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates6 "developer 1; motdfile echo.txt; motd_write CL_LW : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates7 "developer 1; motdfile echo.txt; motd_write EX_INTERP : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates8 "developer 1; motdfile echo.txt; motd_write EX_EXTRAPMAX : x; MOTD; motdfile motd.txt; developer 0; w50" alias DisplayRates9 "developer 1; motdfile echo.txt; motd_write ----- * Displaying Rates [ OFF ] * -----; MOTD; motdfile motd.txt; developer 0" alias DisplayRates "Displayrates0; w10; Displayrates1; w10; Displayrates2; w10; Displayrates3; w10; Displayrates4; w10; Displayrates6; w10; Displayrates7; w10; Displayrates8; w10; Displayrates9; w" bind yourkey "Displayrates"
// CHANGING NAME
Basically, you insert 10 nicknames you regularly use at the place of WIKI1/2/3/... and replaces the YOURKEY1/2/3 by whatever you don't use ingame. When you hit YOURKEY2 or YOURKEY3 it will be like you're moving in the menu of the 10 nicknames. Then hitting the YOURKEY1 will change your name to whatever was displayed at the top left corner of the screen ( if you replaced WIKI1/2/3/... by whatever you wanted to, obviously ). Cool for changing nicks =D
alias name1 "name WIKI1" alias change1 "bind YOURKEY1 name1; speak one; wait; namebackup1; alias switchup change2; alias switchdown change0" alias namebackup1 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI1 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name2 "name WIKI2" alias change2 "bind YOURKEY1 name2; speak two; wait; namebackup2; alias switchup change3; alias switchdown change1" alias namebackup2 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI2 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name3 "name WIKI3" alias change3 "bind YOURKEY1 name3; speak three; wait; namebackup3; alias switchup change4; alias switchdown change2" alias namebackup3 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI3 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name4 "name WIKI4" alias change4 "bind YOURKEY1 name4; speak four; wait; namebackup4; alias switchup change5; alias switchdown change3" alias namebackup4 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI4 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name5 "name WIKI5" alias change5 "bind YOURKEY1 name5; speak five; wait; namebackup5; alias switchup change6; alias switchdown change4" alias namebackup5 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI5 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name6 "name WIKI6" alias change6 "bind YOURKEY1 name6; speak six; wait; namebackup6; alias switchup change7; alias switchdown change5" alias namebackup6 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI6 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name7 "name WIKI7" alias change7 "bind YOURKEY1 name7; speak seven; wait; namebackup7; alias switchup change8; alias switchdown change6" alias namebackup7 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI7 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name8 "name WIKI8" alias change8 "bind YOURKEY1 name8; speak eight; wait; namebackup8; alias switchup change9; alias switchdown change7" alias namebackup8 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI8 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name9 "name WIKI9" alias change9 "bind YOURKEY1 name9; speak nine; wait; namebackup9; alias switchup change0; alias switchdown change8" alias namebackup9 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI9 ] * -----; MOTD; motdfile motd.txt; developer 0" alias name0 "name WIKI10" alias change0 "bind YOURKEY1 name0; speak ten; wait; namebackup0; alias switchup change1; alias switchdown change9" alias namebackup0 "developer 1; motdfile echo.txt; motd_write ----- *Name [ WIKI10 ] * -----; MOTD; motdfile motd.txt; developer 0"
alias "switchup" "change1" alias "switchdown" "change1" bind "YOURKEY2" "switchdown" bind "YOURKEY3" "switchup"
// STATUS CONDUM SCRIPT //This script will clear out your console, make a list of steamIDs, and make //a condump all with one keystroke - handy for when someone is cheating.
//Written by Agent777
alias "clearcon" "clear" alias "savecon" "condump" alias "getID" "status" alias "thewholething" "clearcon; w10; getID; w10; savecon"
Frontiersmen specific scripts
//REQUESTS
Those are the requests with the say_team messages. It's even more cool because the text message changes at every use (or almost)... there is no real purpose to change to text message except it's cooler :D Have fun. The weld requests also plays with the flashlight to attract your mates' attention. The scan requests doesnt exists so it just executes an order requests with other text message...
alias med1 "impulse 10; say_team whateveryouwantaboutmedpacks1; bind YOURKEY1 med2" alias med2 "impulse 10; say_team whateveryouwantaboutmedpacks2; bind YOURKEY1 med3" alias med3 "impulse 10; say_team whateveryouwantaboutmedpacks3; bind YOURKEY1 med1" bind "YOURKEY1" "med1" alias lights "impulse 100; wait; impulse 100; wait; impulse 100; wait; impulse 100" alias +weld1 "impulse 14; say_team whateveryouwantaboutwelding1; wait; lights" alias -weld1 "bind YOURKEY2 +weld2" alias +weld2 "impulse 14; say_team whateveryouwantaboutwelding2; wait; lights" alias -weld2 "bind YOURKEY2 +weld3" alias +weld3 "impulse 14; say_team whateveryouwantaboutwelding3; wait; lights" alias -weld3 "bind YOURKEY2 +weld1" bind "YOURKEY2" "+weld1" alias +scan1 "impulse 80; say_team whateveryouwantaboutscanning1" alias -scan1 "bind YOURKEY3 +scan2" alias +scan2 "impulse 80; say_team whateveryouwantaboutscanning2" alias -scan2 "bind YOURKEY3 +scan3" alias +scan3 "impulse 80; say_team whateveryouwantaboutscanning3" alias -scan3 "bind YOURKEY3 +scan1" bind "YOURKEY3" "+scan1" alias ammo1 "impulse 11; say_team whateveryouwantaboutammos1; bind YOURKEY4 ammo2" alias ammo2 "impulse 11; say_team whateveryouwantaboutammos2; bind YOURKEY4 ammo3" alias ammo3 "impulse 11; say_team whateveryouwantaboutammos3; bind YOURKEY4 ammo1" bind "YOURKEY4" "ammo1" alias order1 "impulse 80; say_team whateveryouwantaboutorders1; bind YOURKEY5 order2" alias order2 "impulse 80; say_team whateveryouwantaboutorders2; bind YOURKEY5 order3" alias order3 "impulse 80; say_team whateveryouwantaboutorders3; bind YOURKEY5 order1" bind "YOURKEY5" "order1"
// PISTOL SCRIPTS
Various pistol scripts exist... Their purpose is to shoot very quickly, often quicker than without it. The higher your FPS, the better it is for the script. ( then you can add +attack and -attack commands ). Don't use it as aliens, personally my skulk was shooting 2 parasite at a time when using it... which is annoying for adrenaline purposes.
alias +pscript "fps_max 100; +attack; wait; -attack; wait; +attack" alias -pscript "-attack; wait; +attack; wait; -attack" bind mouse1 +pscript
The problem with most pistol scripts is that when you exit out of console, it will finish any +alias with the -alias. So in the above example, after you get out of console, -pscript will be executed and you'll fire a shot. You will sometimes notice many players freeze for a few seconds and then shoot once. This is probably because of their pistol script. This pistol script rebinds the console key "`" and shifts some other binds around so exiting console with the "`" key will not cause you to fire. However, exiting with the Escape key will.
// Improved Pistol script alias unbindm1 "unbind mouse1" bind "`" "toggleconsole;unbindm1" alias +rebindm1 alias -rebindm1 "bind mouse1 +pscript" bind joy1 +rebindm1 alias +pscript "+attack" alias -pscript "-attack; wait; +attack; wait; -attack" bind mouse1 +pscript
// WIGGLE WALKING
Kharaa specific scripts
NB : please do not add abusive scripts or customizations which are forbidden... ;)
