Table Of Contents
-
Making a .cfg file
-
The "wait" command
-
Making a 2 option toggle
-
Making a 3+ option toggle
-
Making a 2-way toggle (soon)
-
Demos; Recording and playing (soon)
- More coming soon...
Making a .cfg file Top
To make a config file, use a text editing program (I prefer notepad) and save the document in quotation marks ("and") and add .cfg after the filename like this:
----------
"script.cfg"
----------
The "wait" command Top
For an example, we will use the following script:
----------
bind x "vstr script1"
set script1 "weaponbank 4;wait 10;+attack;wait 400;-attack;weaponbank 3"
----------
You make this script assuming it will change to grenade, wait 4 seconds, and throw. Chances are it won't, because the "wait" command is dependant on your fps. So, if you say "wait 100" it waits 100 frames. For example, if you are getting 100fps, and you say "wait 100" it would wait 1 second. So if you are getting exactly 100fps, the above script would infact work, but if you are getting 50fps or lower, it would wait no less than 8 seconds, ending at 5 seconds with you being blown to peices by your own grenade. If you really wanted to use a script like this, you could "cap" your fps with "com_maxfps 20" or any other number, this makes it so your fps can't go above 20, you use "com_maxfps 0" to give it no limit. Then you must change your "wait" statement to wait 4 seconds, so you change the wait to 80. The script would then look like this:
----------
bind x "vstr script1"
set script1 "com_maxfps 20;weaponbank 4;wait 10;+attack;wait 80;-attack;weaponbank 3;com_maxfps 0"
----------
The above script would hold your grenade for almost exactly 4 seconds, the throw it. There is still one more downside to the "wait" command...If you are strafing right when you started this script, you would continue strafing right until the script finished. That is why it is better to learn to prime your own grenades, and avoid using the "wait" command if at all possible.
Making a 2 option toggle Top
I will use a simple, but usefull FOV toggle for the example.The first thing you will want to do, it make a variable telling wolfenstein what the next step in the toggle is. To make my scripts easier to understand, i usually add "tog" on the end of this variable. The variable is set like this:
----------
bind x "vstr fovtog"
set fovtog "vstr fov180"
----------
Although you do not usually need quotation marks, it is a good habit to get into. With the above script, when x is pressed, wolfenstein would do the commands that "fovtog" told it to, in this case it would end up reading the variable "fov180". The next step is to set "fov180", we want "fov180" to set our fov to 180. Not only do we have to set the fov to 180, but we need to set "fovtog" to read "fov90" next time x is pressed. Our script would look like the following so far:
----------
bind x "vstr fovtog"
set fovtog "vstr fov180"
set fov180 "cg_fov 180;set fovtog vstr fov90"
----------
Then we add the variable "fov90" to set our fov to 90. This variable will have a command to to make "fovtog" read "fov180". Our finished script would look like this:
----------
bind x "vstr fovtog"
set fovtog "vstr fov180"
set fov180 "cg_fov 180;set fovtog vstr fov90"
set fov90 "cg_fov 90;set fovtog vstr fov180"
----------
Here's what's happening:
- Player presses x
- Wolfenstein reads "fovtog"
- "fovtog" tells wolfenstein to read "fov 180"
- "fov180" set cg_fov to 180, then tells fov tog to read "fov90"
- Player presses x again
- Wolfenstein reads "fovtog"
- "fovtog" tells wolfenstein to read "fov 90"
- "fov90" set cg_fov to 90, then tells fov tog to read "fov180"
- The cycle starts over again
Making a 3+ option toggle Top
Making a 3+ option toggle is essentially like a 2 option toggle. The first thing we need to do is set the variable which
will tell wolfenstein which other variable to visit next. Again, we will use the example with the variable "cg_fov" which
changes your feild of view.
----------
bind x "vstr fovtog"
set fovtog "vstr fov90"
set fov90 "cg_fov 90"
----------
In the above, pressing "x" would trigger the variable "fovtog" whcih triggers the variable "fov 90". To add another
variable, all we have to do is make the variable triggered by "fovtog" (fov90) make it so that fovtog triggers the next
variable in the series, which will be fov110. What we need to do is add ";set fovtog vstr fov110" onto the end of "fov90"
and add the line "set fov110 "cg_fov 110;set fovtog vstr fov90"". Which gives us a working two option toggle.
Unfortunately, a 2 option toggle is not what we want, we want a 3 option toggle, so we need to add another variable, which
we will now call "fov130". So, we add the line "set fov130 "cg_fov 130;set fovtog vstr fov90"" and change "fov110" so it
tells "fovtog" to trigger "fov130" and we have a working 3 option toggle.
----------
bind x "vstr fovtog"
set fovtog "vstr fov90"
set fov90 "cg_fov 90;set fovtog vstr fov110"
set fov110 "cg_fov 110;set fovtog vstr fov130"
set fov130 "cg_fov 130;set fovtog vstr fov90"
----------
You can add as many options as you want by simply telling each one to target the next, and the last one to target the first.