copied readme into RST

Paco Hope 2022-08-13 16:50:40 -04:00
parent f6c18dda29
commit d12ce0d4f2
1 changed files with 131 additions and 1 deletions

View File

@ -3,9 +3,139 @@ Welcome to TFScript
TFScript helps you manage all the customisations you make to your Team Fortress 2 configurations. If you have `custom scripts <>`_ in your ``cfg`` files, then this will help you automate that.
Basic overview
TFScript is meant to simplify the complexity of creating tf2 keybinds. While simple binds may be easy, more complex actions such as key combinations and toggles can be quite complex.
The basic process for creating a TFScript config file goes as such:
1. Write your TFScript file according to the <u>Syntax Guide</u>
2. Run ``TFScript <filename>`` to generate code and write to game files
3. Play tf2 with your new binds!
A TFScript file is written in YAML and parsed by the program to generate the apporpriate code, so if you know the YAML syntax you can jump straight to the <u>TFScript Syntax</u> section, otherwise, read the <u>YAML Syntax</u> section below, *then* read the <u>TFScript Syntax</u> section.
TFScript Syntax
A TFScript file is structured like this
.. code-block::
:caption: Basic tfscript input file
where ``class1``, ``class2``, etc. refer to classes such as soldier, pyro, or any of the other lovable mercenaries.
``key1`` and ``key2`` are keys such as ``w`` or ``mouse1`` to which you want actions bound, and ``type``/``fields`` is the data to be parsed by TFScript to generate a config file.
The full list of valid class names is as follows:
* Scout
* Soldier
* Pyro
* Demo
* Heavy
* Engi
* Medic
* Sniper
* Spy
* Default
As you may have noticed, there is a special class, "default", which specifies the default state of any and all keys. Any keybinds in this config are the defaults, and apply to all other classes unless specifically overwritten (that said, any classes which *do* have a different definition for that key will overwrite the previous "default" definition).
Names are not case sensitive, so "SoLDiER" will work just as well as "soldier".
If you are already familiar with TF2 scripting, every key that tf2 recognizes is also recognized by TFScript.
For the rest of us, the most relavent keys are:
* A to Z
* 0 to 9
* space
* tab
* capslock
* shift
* ctrl
* function
* alt
For the remaining symbol characters (like "\`", "[", or "\\"), just press the key that it appears on, on your keyboard. *Do not* hold shift, alt, or any other control keys. This does limit the keys you can use, for example if you wanted to use the \{ character, you would be stuck with \[. This is a limit imposed by TF2, but you can get around this using the ``double`` type, as explained later.
Some examples
For example, this config will bind "e" to call for medic, unless mouse4 is held, in which case it will call for an ÜberCharge:
.. code-block::
:caption: Example tfscript for binding ubercharge:
alias call_for_medic "voicemenu 0 0"
alias call_for_uber "voicemenu 1 6"
alias e_bind call_for_medic
bind e e_bind
alias +toggle_state "alias e_bind call_for_uber"
alias -toggle_state "alias e_bind call_for_medic"
bind mouse4 "+toggle_state"
There are some issues with this:
* It is quite verbose, and if several of these exist the file can become difficult to traverse
* There is a lack of clarity in the voicemenu command, only the bind name explains what it does
* If either "mouse4" or "e" had a prior function, it has now been overwritten
* The scope is dictated by what ``.cfg`` file this is located within, which can cause problems
The TFScript way of doing this is:
.. code-block::
:caption: Basic tfscript input file
impulse: voice medic
impulse: voice activate uber
condition: mouse4
There are several benefits to this:
* The indentation allows for easier scanning of the file
* The voicemenu commands have been replaced with the clearer "voice" impulse
* Since this is within the ``default`` section, it is clear that there are is no "prior function" to overwrite and this will apply to all classes unless specifically overwritten.
Known issues, problems, etc.
none everything is perfect and there are no problems it is all amazing
.. toctree::
.. meta::
:description: TFScript scripting tool for Team Fortress 2
:keywords: Team Fortress, TF2, tf2 script