What is an autoexec and how do I make one?
The autoexec is a way to customize all of your settings, bindings, and scripts and have them all load whenever you start a game of ETQW.
If you don't have one, create one by opening notepad and typing
seta ui_name "^1Pvt. Snuffy"
and then saving it to your /My Documents/idsoftware/Enemy Territory Quake Wars/sdnet/[player name]/base folder as "autoexec.cfg". If you're running Linux, then this file will get saved to ~/.etqwcl/sdnet/[player name]/base/. If you don't save it in your sdnet folder, then your context binds won't work. Encase the filename within the quotes. Notepad has a nasty habit of adding a .txt extension on files. Verify that the .txt extension did not get tagged on. Make sure you have "hide extensions of files with known file types" turned off so you can see what type of files it is. Other execable configs, such as class select configs, will got into /My Documents/idsoftware/Enemy Territory Quake Wars/base.
Once you have the basic document working, you can copy and paste all of your current game, video, and network settings into this doc, and they will load every time you launch ETQW.
This is my preferred way to make changes to your setup as ETQW won’t modify this document. It does modify and overwrite the etqwbinds.cfg and etqwconfigs.cfg files every time the game launches.
You can also create an autoexec by copying and renaming one of the existing configs.
The Basic Bind Command
At this stage of the game, we should all know what the bind command does. To bind a key to a basic command, the command is written in this format:
bind [key] “[command] [variable]”
bind x "say hi"
will set the X key to send the global message [say] "hi" to everyone in the game. And it works with just about every command.
Advanced Bind Commands
If you open the etqwbinds.cfg file, you’ll see a lot of lines that look like:
bind "MOUSE1" "_attack" "" "default"
We know what the command does and what the first two arguments are. But what are the other two? They are the modifier and the context.
Bind “[key]” “[command]” “[modifier]” “[context]”
The modifier argument, and probably the least used, is for a modifier key. While it isn't used often, it's still pretty damn useful. With this argument we can make a bind that looks like:
bind "DEL" "kill" "shift"
This means that when I want to /kill to change classes, I have to hit SHIFT+DEL so that I don’t accidentally hit DEL and /kill myself by accident. The more astute of you may realize that this will also allow you to bind multiple commands to the same key.
The last argument of the bind command is probably the most useful: the context. Unmodified, there are two contexts: "default" and "vehicle". The remainder are user configurable in the Bind Context CVARs section.
The vehicle context is a key's function only when you're in a vehicle. If I were to create two binds like this:
bind "SPACE" "_moveup" "" "default"
bind "SPACE" "_forward" "" "vehicle"
The space bar will then act as my forward key when I'm in a vehicle. But it will still be my jump (_moveup) key when I'm on foot.
The default context is the context used for a key when you're running on foot or you're in a vehicle and there isn't anything bound to the vehicle context. So if I were to use this bind:
bind "W" "_forward" "" "default"
and the game did not set a vehicle key bind like:
bind "W" "[do something else]" "" "[some other context]"
The 'W' key will always work as my move forward key, even when I'm in a vehicle.
Binding Context CVARs
There are several cvars with names that look like g_bind_context_[vehiclename]. These cvars really make that last argument in the bind command useful. Let's say I wanted individual binds for the anansi. Then I give the cvar "g_bind_context_anansi" a unique name like *thinks*... "anansi".
set g_bind_context_anansi "anansi"
Once I do this I can then use a key bind like:
bind "W" "_sprint" "" "anansi"
With this, whenever I'm in an Anansi, and only an Anansi, my 'W' key will make me move forward.
But what about the Tormentor, the Strogg flyer (originally named the Hornet)? I’ll bind both the Anansi and the Tormentor bind contexts to "flyers":
set g_bind_context_hornet "flyers"
Now, 'W' will act differently for both vehicles and a single keybind.
The bind context cvars are available with the default group assignments:
seta g_bind_context_anansi "vehicle"
seta g_bind_context_badger "vehicle"
seta g_bind_context_bumblebee "vehicle"
seta g_bind_context_desecrator "vehicle"
seta g_bind_context_goliath "vehicle"
seta g_bind_context_hog "vehicle"
seta g_bind_context_hornet "vehicle"
seta g_bind_context_husky "vehicle"
seta g_bind_context_icarus "vehicle"
seta g_bind_context_mcp "vehicle"
seta g_bind_context_platypus "vehicle"
seta g_bind_context_titan "vehicle"
seta g_bind_context_trojan "vehicle"
seta g_class_context_aggressor "aggressor"
seta g_class_context_technician "technician"
seta g_class_context_constructor "constructor"
seta g_class_context_oppressor "oppressor"
seta g_class_context_infiltrator "infiltrator"
seta g_class_context_soldier "soldier"
seta g_class_context_medic "medic"
seta g_class_context_engineer "engineer"
seta g_class_context_fieldops "fieldops"
seta g_class_context_covertops "covertops"
Chaining Multiple Commands
You can chain multiple commands into one key by using a semicolon (
at the end of each command. Such as:
Bind x “[command 1]; [command 2]”
Here’s an example:
bind x "say aishite iru ; sayteam baka yaro;"
Thus, whenever I hit the Y key, I'll declare my adoration of someone on the server and insult my team at the same time. (great tactic if you wish to confuse and befuddle... everyone)
While you can chain quite a few commands, you may be a bit frustrated if you attempt to chain any commands that begin with an underscore to another command. The console will just spit obscenities to you when you try to use it. For instance, this line here is not legal:
bind "MOUSE1" "_attack; say haha;" "" "default"
This was done deliberately to prevent people from creating scripts that could be considered cheating or unsportsmanlike.
Writing Class Selection Scripts
First off, selecting class and weapon loadouts from the limbo menu is pretty easy. Just drop the Limbo Menu (L) then use the number keys to select a class. Classes are numbered in the sequence in which they appear on the class select screen. Repeated presses of the same key will scroll through the weapons selection. So, if I was Strogg and wanted to change to the Infiltrator (5th on the list of classes and use the railgun (second weapon option), I'd key L-5-5.
However, If you want to write a set of binds that will simply take you to a team and class, the variables and an example are shown below:
Syntax: bind x "[team]; [class] [weapon number]"
Example: bind 1 "clientTeam Strogg; ClientClass Infiltrator 0"
Here is a list of the combinations of classes and weapons that are available.
ClientClass Infiltrator - Lacerator
ClientClass Infiltrator 1 - Railgun
ClientClass Constructor 0 - Lacerator
ClientClass Constructor 1 - Nailgun
ClientClass Constructor 2 - Lacerator w/ Plasma Launcher
ClientClass Technician 0 - Lacerator
ClientClass Technician 1 - Nailgun
ClientClass Oppressor 0 - Lacerator
ClientClass Oppressor 1 - Scoped Lacerator
ClientClass Aggressor 0 - Lacerator
ClientClass Aggressor 1 - Obliterator
ClientClass Aggressor 2 - Hyperblaster
ClientClass Aggressor 3 - Nailgun
ClientClass CovertOps 0 - Assault Rifle
ClientClass CovertOps 1 - Sniper'"
ClientClass Engineer 0 - Assault Rifle
ClientClass Engineer 1 - Shotgun
ClientClass Engineer 2 - Assault Rifle w/ Grenade Launcher
ClientClass Medic 0 - Assault Rifle
ClientClass Medic 1 - Shotgun
ClientClass FieldOps 0 - Assault Rifle
ClientClass FieldOps 1 - Scoped Assault Rifle
ClientClass Soldier 0 - Assault Rifle
ClientClass Soldier 1 - Rocket Launcher
ClientClass Soldier 2 - GPMG
ClientClass Soldier 3 - Shotgun
Any command that can be set to either on or off, can be set up on a toggle. For example, you can set Always Run to either on (1) or off (0), therefore I can create a toggle that lets me switch between always on or always off. This has a couple of advantages:
In the case of the +speed (run) command, I don't have to hold down my SHIFT key to run or walk. If I want to sneak up on someone, I can hit the toggle to walk, and then hit it again when I want to resume running.
This set up conserves keys. Instead of one button set to enable always run and another to disable it, I can consolidate everything to one key.
The syntax is:
bind [key] "toggle [command]"
Here are a couple of examples that I use in my autoexec.cfg
bind SHIFT "toggle ui_showgun" //Toggles whether the gun model is drawn or not
bind F3 "toggle com_showFPS" //Displays Frames per Second
bind F4 "toggle g_showwaypoints" //Displays waypoints or turns them off
bind F5 "toggle g_rotatecommandmap" //Enables or disables command map rotation
Look through your configuration for variables that take either a 0 or 1 value. Those are the commands that can be set up on a toggle.
Cycle allows the player to cycle thru a range of variable values with one single command. For example, you can use it to cycle through player icon sizes. The basic form is:
bind x "cycle [cvar name][beginning value][ending value][increment (optional)]"
In the case of a player icon size cycle, the line would look like this:
bind "cycle g_playericonsize 10 30 5"
This would change the icon size value by 5, starting with whatever I currently have specified in my config, up to size 30, then start back at 10.