There are many scripts commonly found in QL configs, and quite some of them use complex vstrs. Complex vstrs are often ugly, repetitive, unreadable and unmanageable. This makes it easy by using a first file where common scripts are abstracted in easy to use macros. This file is then preparsed to produce a .cfg you can use in QL.
Preparser? Macro?
A preparser is a program that will read a file(your config), do some changes then output a new file(your parsed config) with the changes done. The file is then supposed to be read by another program(Quake Live). In ASCII art:
When a parser uses the concept of macros, we call it a macro processor. More on wikipedia.
Why use that?
Because often you see patterns that are in every config out there: For example, if you play more than one mode, say CTF and TDM, you'd have binds for each of them, but you don't want to have them use twice the number of keys. So you use some vstr magic to make a couple buttons to switch through your two set of binds. That takes effort, isn't pretty, discourages people. With this set of macros you could just do:
How to edit my config
Basically, paste the contents of the attached file at the beginning of your config, and put .m4 at the end of the file name(To mark it needs to be preprocessed).
Edit the very beginning of the stuff you just pasted(it's explained), then keep your config intact only placing macros as shown in the examples from the Macro reference section. {} are used for quoting. Unmatched { or }s are likely to break the whole thing. if you really want to have them in your config, double them like this: {{ blabla }}.
How to preparse my config
Other notes
- Consider this beta-quality.
- QL should be able to save/restore properly a config generated with this(as long as you don't use exec in it) as long as you don't put a cvar_restart in it. (To clear unused cvars go to Game settings on the website and click Reset all my settings)
- Configs generated with this will have some parts seriously mangled, meaning editing it will be a difficult thing. So please, please, please, keep your non-preparsed config in a safe place.
- Make sure to use proper "" quotations in your bind and set line, especially if they are inside a toggle_configs.
Macro reference
Known issues
- toggle_config is very slow when being preprocessed.
- command splitting is suboptimal, as I don't know the maximum vstr length.
Example config
Mine
(If you have one you wanna put as example here, tell me :))
Changelog
Sat Feb 27
- Initial release
Preparser? Macro?
A preparser is a program that will read a file(your config), do some changes then output a new file(your parsed config) with the changes done. The file is then supposed to be read by another program(Quake Live). In ASCII art:
Your config ----(preparser)----> Your preparsed config ---->(QL)A macro is a concept used by some preparser programs. Defining a macro means saying "Okay, from now on, every time you see X, replace it with Y". Of course, it gets a bit more complex, but that's the basic thing.
When a parser uses the concept of macros, we call it a macro processor. More on wikipedia.
Why use that?
Because often you see patterns that are in every config out there: For example, if you play more than one mode, say CTF and TDM, you'd have binds for each of them, but you don't want to have them use twice the number of keys. So you use some vstr magic to make a couple buttons to switch through your two set of binds. That takes effort, isn't pretty, discourages people. With this set of macros you could just do:
bind F9 toggle_configs((And you would be done with it :) Same goes for the streamer, the movie maker, which would want to keep a "Playing" config, a "Streaming" and/or a "Video" config.
{CTF},{
bind a say_team INC HIGH
...
}),({TDM},{
bind a say_team RUSH QUAD
...
}))
How to edit my config
Basically, paste the contents of the attached file at the beginning of your config, and put .m4 at the end of the file name(To mark it needs to be preprocessed).
Edit the very beginning of the stuff you just pasted(it's explained), then keep your config intact only placing macros as shown in the examples from the Macro reference section. {} are used for quoting. Unmatched { or }s are likely to break the whole thing. if you really want to have them in your config, double them like this: {{ blabla }}.
How to preparse my config
Other notes
- Consider this beta-quality.
- QL should be able to save/restore properly a config generated with this(as long as you don't use exec in it) as long as you don't put a cvar_restart in it. (To clear unused cvars go to Game settings on the website and click Reset all my settings)
- Configs generated with this will have some parts seriously mangled, meaning editing it will be a difficult thing. So please, please, please, keep your non-preparsed config in a safe place.
- Make sure to use proper "" quotations in your bind and set line, especially if they are inside a toggle_configs.
Macro reference
Known issues
- toggle_config is very slow when being preprocessed.
- command splitting is suboptimal, as I don't know the maximum vstr length.
Example config
Mine
(If you have one you wanna put as example here, tell me :))
Changelog
Sat Feb 27
- Initial release
Edited by Nicky at 12:55 CDT, 8 May 2010 - 18750 Hits