+ Reply to Thread
Results 1 to 5 of 5

Thread: How to write a config

  1. #1
    Senior Member Phlogiston will become famous soon enough Phlogiston will become famous soon enough Phlogiston's Avatar
    Join Date
    Aug 2010

    How to write a config

    I've seen an increase in threads about people who are wanting to get involved with editing their configs for the first time. Me and a few other members of my clan (current and ex-) have collaborated in writing a series of guides over the past couple of years which it seems no-one in our clan reads (since I'm always having to help them with their configs one-to-one still) so I thought I'd share a dieted, edited down version with all the info but without the discussions we've had stuck in the middle. This is a guide for everyone from beginners through to advanced config users, hopefully written in an easy to understand form
    So what is a config?
    It begins
    In game settings
    VSTRS pts 1, 2, 3

    So what is a config?
    Quite simply, a config configures the game. It changes the adjustable settings to how you like them, whether it's having maximum bloom so everything's a blurry mess or having a letter on your keyboard spam a smiley. The game itself stores this info in two automatically created files 'qzconfig.cfg' and 'repconfig.cfg'

    What the game also does is search for a file called 'autoexec.cfg' when it loads up, if it finds this file it reads it and changes the settings on startup. Essentially this means that you can create an 'autoexec.cfg' with all of your settings contained within, take that with you to any other computer running quakelive and you will have the exact same settings which you're used to without having to mess around in the menus for 20mins+ (if you can even remember).

    The folder the game saves the rep- and qz- files as well as searches for the autoexec differs from OS to OS:
    Vista/win7 -%AppData%\..\LocalLow\id Software\quakelive\home\baseq3
    XP -%appdata%\id Software\quakelive\home\baseq3
    Linux - ~/.quakelive/quakelive/home/baseq3/
    OSX -~/Library/Application Support/Quakelive/
    I'd recommend finding that folder now and creating a shortcut to it on your desktop.
    It begins
    I much prefer to start with a blank canvas as then you learn exactly what each variable does as you add it in, you have a general idea of what you've already put in your config and you don't scare yourself with the '/writeconfig' command which dumps out a lot of unnecessary stuff AND puts it in a disorganised wall of text. (This takes me (very experienced with configs) about 30mins to sift through and organise and I already know what half of it is, for a beginner you're commiting seppuku at the start...)

    So. Open a brand new file in notepad (textedit for macs) and we'll begin.

    The thing I tell everyone to start with is their movement and weapon binds. Most people have the basics the same (WASD for movement), but everyone has some slight variations, from using mouse2 as jump to callvoting DM6 on mouse1. This is the first thing you want to setup. With the following info...
    bind - used to bind a key to a certain function(s) - it's quite important to put the functions in "" quotation marks and separate multiple functions with a semi-colon:
    bind a "+moveleft;print I am moving left"
    // - Anything put after '//' double slashes on a line will be ignored by quake and so can be used to leave yourself messages and/or separate your config into sections:
    bind e "weapon 5" //binds e to weapon 5 (rocket launcher)
    ...the weapon numbers...
    1: Gauntlet / 2: Machinegun / 3: Shotgun / 4: Grenade Launcher / 5: Rocketlauncher / 6: Lightninggun / 7: Railgun / 8: Plasmagun / 9: BFG / 11: Nailgun / 12: Proximity mine launcher / 13: Chaingun
    ...and some simple commands...
    +moveleft / +moveright / +forward / +back / +moveup / +movedown / +speed / weapon / +attack / +zoom / print / say / +button2 / say_team
    ...you should now be able to knock together something like this as your first config:
    bind w "+forward"
    bind s "+back"
    bind a "+moveleft"
    bind d "+moveright"
    bind CTRL "+movedown"
    bind SHIFT "+speed"
    bind SPACE "+moveup"

    bind MOUSE1 "+attack"
    bind MWHEELUP "weapnext"
    bind MWHEELDOWN "weapprev"
    bind q "weapon 7" //rocket
    bind e "weapon 5" //rail
    bind f "weapon 6" //lightning
    You'll notice that I only have the 3 most powerful weapons bound at this stage, this is pretty common practice as if you have one of these (or all of them) you're probably going to want it easily available. (I actually have all of the weapons bound, but I used some trickier stuff to set that up on fewer keys which is covered later)
    Go to 'file->save as' and save this in the same folder as rep and qzconfig, calling it autoexec.cfg - make sure it's NOT autoexec.cfg.txt
    In-game settings
    The next obvious use of a config is setting it up so that the game looks and sounds how you want it to. There are hundreds of variables for tweaking things which are all referenced in MuffinMan86's guide.

    As there are hundreds, I'd recommend starting with the one thing we're missing from above, your mouse control. Sensitivity, the m_ variables and a few cl_mouse***** settings should be set up so that if you ported this config over to another computer, it would play exactly the same (but maybe look different) to how it does on your current computer. Personally I also use the m_cpi command so that if I had to play with a different mouse for whatever reason it'd be a very easy switch over - it requires a little bit of math to set up initially, but it could save time in the long run if your mouse dies or if you play on different setups. Instructions are here. I'd also recommend that if you don't use accel, you need to specify cl_mouseaccel "0" in your config. If you jump on a computer after someone who HAS been using accel, then you need to reset their setting.

    Once you have the mouse done, you might want to start with the 'Pro' tweaks, which make visibility of your enemies and movement easier. Fortunately I don't have to plough through these because Emsixteen already did it

    Now this is where you can start to end up with a messy config, with different cvars in a random order and maybe even repeated in different parts of the config. There are two easy methods to keep your config organised. The first is separating a file with different sections by using //comments as I've already shown. The other way is to have completely separate files for the different sections. So, what I've done is I have all my cvars in a file called 'settings.cfg', all my binds in a file called 'binds.cfg' and I also have a separate file for all my chatbinds for CTF called 'chat.cfg'. This leaves me with a blank autoexec.cfg except for three lines:
    exec settings
    exec chat
    exec binds
    I then also have the settings section divided into (what I deem to be) a logical set of groups using the //comments method (mouse, weapon fx, hud, sound, models, display) so I can easily find things if I need to...
    So now, you could be at the stage where every single part of the game is defined in your own personal config. What's next? It's time to personalise it some more. Maybe you want to have your railgun use a different crosshair to the other weapons, or to have it zoom in automatically when you select it. This is where you start using binds and cvars together.

    For the example I just stated, let's assume my normal cg_fov is 100 and I use cg_drawcrosshair 1. But I want crosshair 2 and fov 85 for rail. Firstly I change my railgun bind:
    bind q "weapon 7;cg_fov 85;cg_drawcrosshair 2"
    Secondly I change ALL of my other weapon binds to the original settings:
    bind e "weapon 5;cg_fov 100;cg_drawcrosshair 1"
    bind f "weapon 6;cg_fov 100;cg_drawcrosshair 1"
    bind mwheelup "weapprev;cg_fov 100;cg_drawcrosshair 1"
    bind mwheeldown "weapnext;cg_fov 100;cg_drawcrosshair 1"
    This is because selecting rail will change the settings one way, and you need to change them back again for the other weapons, it won't remember automatically.

    So far so good... but now I decide to change my normal crosshair to number 3. I have to go back through all the binds and change every instance (except the rail) from '1' to '3'. A bit of a pain with 4 lines of binds with 2 cvars in each, really annoying if the numbers are higher. This is where things start to get interesting.
    VSTRs part 1
    A V(ariable)STR(ing) is a way of storing a list of commands under a userdefined name so that you can recall them for various different things. The simplest use is to store a bunch of default settings that you might want to use the majority of the time but have some exceptions for. So using the example above we're going to create a VSTR called '_normalsettings' and store our usual fov and crosshair in there and simply call up that vstr with the binds that require it, whilst still having customised settings for the rail.
    set _normalsettings "cg_fov 100;cg_drawcrosshair 1;cg_crosshairsize 20;cg_zoomfov 75"
    bind e "weapon 5;vstr _normalsettings"
    bind f "weapon 6;vstr _normalsettings"
    bind q "weapon 7;cg_fov 85;cg_drawcrosshair 2;cg_crosshairsize 16;cg_zoomfov 50"
    bind mwheelup "weapprev;vstr _normalsettings"
    bind mwheeldown "weapnext;vstr _normalsettings"
    Much easier to read through AND edit. Note the use of 'set' and 'vstr' in defining and recalling the VSTRs. One other thing you should note is the use of an underscore at the start of the vstr name. This isn't compulsory, but makes finding all of your custom vstrs much easier in the console (just type _ then tab).
    VSTRs part 2
    Now the next stage of mastering VSTR's is using them to create toggle switches where one press performs one function, a second press performs a different one and then it returns to it's original function. There is an inbuilt 'toggle' command that can be used for switching CVARs between 0/1 values but if you want a switch for something like changing the models and colours you need to do it yourself:
    bind x "vstr modelswitch1"
    set modelswitch1 "cg_forceenemymodel keel/bright;cg_enemyuppercolour 0x#FFFFFFFF;bind x vstr modelswitch2"
    set modelswitch2 "cg_forceenemymodel tankjr/bright;cg_enemyuppercolour 0x#000000FF;bind x vstr modelswitch1"

    There's one thing I don't like about that script, which is that you have to look halfway through the line to see that you've used bind x. You might at some stage decide you want to bind x to something else or even forget completely that you already used it in this script and bind it to something else. To solve this, we use the same technique from Part 1 which adds in an extra VSTR which we vary instead of rebinding the key in each line:
    bind x "vstr _modelswitch"
    set _modelswitch "vstr _modelswitch1"
    set _modelswitch1 "cg_forceenemymodel keel/bright;cg_enemyuppercolour 0x#55FF55FF;set _modelswitch vstr _modelswitch2"
    set _modelswitch2 "cg_forceenemymodel tankjr/bright;cg_enemyuppercolour 0x#5555FFFF;set _modelswitch vstr _modelswitch1"
    VSTRs Part 3
    Final brief section about VSTRs, to show how the above methods can be extended to create a volume script:
    bind [ "vstr _volDown"
    bind ] "vstr _volUp"
    set _vol00 "s_volume 0.00;set _volUp vstr _vol05;print MUTED"
    set _vol05 "s_volume 0.05;set _volDown vstr _vol00;set _volUp vstr _vol10;print [|...................]"
    set _vol10 "s_volume 0.10;set _volDown vstr _vol05;set _volUp vstr _vol15;print [.|..................]"
    set _vol15 "s_volume 0.15;set _volDown vstr _vol10;set _volUp vstr _vol20;print [..|.................]"
    set _vol20 "s_volume 0.20;set _volDown vstr _vol15;set _volUp vstr _vol25;print [...|................]"
    set _vol25 "s_volume 0.25;set _volDown vstr _vol20;set _volUp vstr _vol30;print [....|...............]"
    set _vol30 "s_volume 0.30;set _volDown vstr _vol25;set _volUp vstr _vol35;print [.....|..............]"
    set _vol35 "s_volume 0.35;set _volDown vstr _vol30;set _volUp vstr _vol40;print [......|.............]"
    set _vol40 "s_volume 0.40;set _volDown vstr _vol35;set _volUp vstr _vol45;print [.......|............]"
    set _vol45 "s_volume 0.45;set _volDown vstr _vol40;set _volUp vstr _vol50;print [........|...........]"
    set _vol50 "s_volume 0.50;set _volDown vstr _vol45;set _volUp vstr _vol55;print [.........|..........]"
    set _vol55 "s_volume 0.55;set _volDown vstr _vol50;set _volUp vstr _vol60;print [..........|.........]"
    set _vol60 "s_volume 0.60;set _volDown vstr _vol55;set _volUp vstr _vol65;print [...........|........]"
    set _vol65 "s_volume 0.65;set _volDown vstr _vol60;set _volUp vstr _vol70;print [............|.......]"
    set _vol70 "s_volume 0.70;set _volDown vstr _vol65;set _volUp vstr _vol75;print [.............|......]"
    set _vol75 "s_volume 0.75;set _volDown vstr _vol70;set _volUp vstr _vol80;print [..............|.....]"
    set _vol80 "s_volume 0.80;set _volDown vstr _vol75;set _volUp vstr _vol85;print [...............|....]"
    set _vol85 "s_volume 0.85;set _volDown vstr _vol80;set _volUp vstr _vol90;print [................|...]"
    set _vol90 "s_volume 0.90;set _volDown vstr _vol85;set _volUp vstr _vol95;print [.................|..]"
    set _vol95 "s_volume 0.95;set _volDown vstr _vol90;set _volUp vstr _vol100;print [..................|.]"
    set _vol100 "s_volume 1.00;set _volDown vstr _vol95;print [...................|]"
    Breaking it down into sections, the first two lines are the initial binds for turning the game volume up or down. Then each of the other lines sets the game volume (s_volume), redefines the two control vstrs (_volUp and _volDown) and then gives a little notification to the user as to where the volume is overall. The final line is required to set the volume on startup.

    It was using VSTR's that I set up my weapon binds so that a double tap would select a different weapon to a single tap for a lot of them (still have RL, RG and LG with direct access of course)
    But what about aliases
    Aliases are VERY similar to VSTR's, some people prefer to use aliases for the majority of things because you can use one less word when typing them out, but there are some crucial differences:
    - There is a 128 limit on the number of aliases you can use. No limit on VSTR's (the limit was 64 a while back which is why I preferred VSTR's)

    - If an alias is used, it will only go one step through a cycle even if you hold the key down, whereas a vstr will continually scroll through until it's released.

    - An alias can be used to activate on either a key press OR release
    The third difference is the crucial one. By naming your alias +<aliasname> it will set a function for when the key is pressed, and you can also have a function -<aliasname> for when it's released. The most common use of this is for the LG script, where it is used to change your sensitivity while firing a weapon and then changes back afterwards, enabling you to have the low sens for tracking an enemy and higher sens for movement. For those who have never seen it, here's the simplest form of the LG script:
    bind mouse1 "+fire"

    //LG Script
    alias +fire "+attack;sensitivity 14" //sets '+fire' to lower sensitivity AND attacks when mouse1 is pressed
    alias -fire "-attack;sensitivity 21" //stops 'attack' and changes to a higher sens when mouse1 is released
    Note that you don't have to bind mouse1 to -fire as well, it automatically maps the corresponding +/- scripts to the press and release.

    You might have noticed I said 'simplest' form of the LG script. Technically it's not an 'LG' script since it changes the sensitivity for ALL the weapons, though you probably won't notice in-game except on MG, plasma and chaingun because you don't hold down mouse1 with the others. For a proper LG script what you can do is a slightly more complicated script where each of your weapon binds changes whether the script is active or not:
    bind mouse1 +fire
    bind e "weapon 5;_lgOff"
    bind f "weapon 6;_lgOn"
    bind q "weapon 7;_lgOff"

    //LG Script
    alias +fire "+attack"
    alias -fire "-attack;_normsens"

    alias _lgOn "alias +fire _lgfire"
    alias _lgFire "+attack;_LGsens"

    alias _lgOff "alias +fire +attack;_normsens"

    alias _LGsens "sensitivity 14"
    alias _normsens "sensitivity 21"
    I've broken it into sections to explain it more easily:

    The top section is defining the initial use of mouse1 and ALWAYS reverting to the normal sens when I release it - it doesn't matter if LG is selected or not, if I let go of fire, I want my sens to go back to normal.

    The second section forwards the +fire command to another alias if LG is selected, this second alias '_lgFire' is exactly the same as the first script above, but I used another alias '_LGsens' to store my different sensitivity, I'll explain why in a moment.

    The third section changes '+fire' back to it's normal use and sets the sensitivity back to normal whenever I select a weapon other than LG.

    The final section is used to store both sensitivities for the whole script, so I don't have to root through the different lines to find it (and means I only have to change the value once)... so that's a brief introduction to scripting for you which leaves me only to say:

    Congratulations. You're done with your config and reading this wall of text. With some practice you'll be as pro as the next person at writing useless code
    The most excessively complicated use of aliases and VSTR's I've come up with so far is detailed in this post for anyone who wants to see what can be done with them.

    A complete copy of my config is here - it won't make you a better Quake player but might give you a headache.

    Thanks to Yakumo, Muffinman and Emsixteen for being great reference sources, Anytime for his parts of the original guides, my old buddy Radiac who got me started on this in Q2, all the guys and girls in SWAT (past and present) who's configs I temporarily broke, other various forum and QL peoples and of course Atakara for being uniquely disturbed. Much wuv <3

    I hope this doesnt scare everyone off, I know I'm not quite perfect, so any mistakes or places which need clarifying you find please let me know and I'll amend it (I have written almost all of this with a glass of something or other in my hand)
    Last edited by Phlogiston; 11-18-2011 at 01:40 PM. Reason: grammar and formatting

  2. #2
    Senior Member malk_ will become famous soon enough malk_ will become famous soon enough malk_'s Avatar
    Join Date
    Aug 2010
    Quote Originally Posted by PoLLeNSKi View Post
    The most stupidly complicated use of aliases and VSTR's I've come up with so far is detailed in this post for anyone who wants to see what can be done with them.
    Remove the "stupidly" For what I know, OSP added modif for exactly that:

    modif[1..5] stuff
            +modif[1..5] and -modif[1..5] supports the option for people who
        want to double-bind multiple keys using key sequences, as shown
        in the example below: 
          set normkeys "bind 1 weapon 1; bind 2 weapon 2"
          set altkeys  "bind 1 say_team nme incoming; bind 2 say_team base is safe"
          +modif1 vstr normkeys
          -modif1 vstr altkeys
          bind shift +modif1
    Its great for using teambinds without repositioning your hand. I was happy to read you did a "framework" that I can use if I feel the need to in the future.
    "I worked hard to learn to aim where I shouldn't be aiming, I want others to get through this pain too!"
    o . o . o . o

  3. #3
    Senior Member Phlogiston will become famous soon enough Phlogiston will become famous soon enough Phlogiston's Avatar
    Join Date
    Aug 2010
    Quote Originally Posted by malk_
    Remove the "stupidly" For what I know, OSP added modif for exactly that:

    modif[1..5] stuff
            +modif[1..5] and -modif[1..5] supports the option for people who
        want to double-bind multiple keys using key sequences, as shown
        in the example below: 
          set normkeys "bind 1 weapon 1; bind 2 weapon 2"
          set altkeys  "bind 1 say_team nme incoming; bind 2 say_team base is safe"
          +modif1 vstr normkeys
          -modif1 vstr altkeys
          bind shift +modif1
    Its great for using teambinds without repositioning your hand. I was happy to read you did a "framework" that I can use if I feel the need to in the future.

    Changed it to 'excessively'

    And yeah it is very useful - I have double functions for almost all of my team binds in CTF - I first learnt it from Radiac in Q2, iirc he had three complete keyboards worth of info using two modifier keys lol
    Last edited by Phlogiston; 11-18-2011 at 01:45 PM.

  4. #4
    I wish there was one for left handed people,
    but this will work with some editing, it will take a while.
    Maybe i'll do it one day.

  5. #5
    Senior Member Yakumo has a spectacular aura about Yakumo has a spectacular aura about Yakumo has a spectacular aura about Yakumo's Avatar
    Join Date
    Aug 2010
    Hadn't seen this before actually, thanks for the shout out Phlogiston =)

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts