broke types out to its own doc file

Paco Hope 2022-08-13 16:50:56 -04:00
parent d12ce0d4f2
commit 3d059c72e1
1 changed files with 66 additions and 0 deletions

docs/source/types.rst Normal file
View File

@ -0,0 +1,66 @@
TFScript Types
The moment we've all been waiting for, the types. These are the crux of any TFScript file, and the bulk of what's important. In fact, they're so important I'm just going to write the important bits right now and leave the rest to be completed by release 1.0.0
.. function:: impulse
Bind a key to a simple command
:param command: the command to do when the key is pressed
Binds the associated key to the command provided by ``text``.
Also has shortcuts for ``voice``, ``build``, and ``destroy``
.. code-block::
:caption: impulse example
impulse: voice medic
.. function:: double
This creates a double thingie
:param primary: <type and body>
:param secondary: <a second type and body>
:param condition: <key>
:param type: <"held" or "toggle", default "held">
:param cancel both: <true or false, default false>
:param solo: <true or false, default false>
While the ``condition`` is satisfied, the associated key behaves as ``secondary``, otherwise it behaves as ``primary``. ``primary`` and ``secondary`` are both types defined above, like ``impulse`` or ``hold``, and follow the exact same syntax.
If the type is "held", the condition is satified while the ``condition`` key is held down, but if the type is "toggle" then the condition will be satisfied when the condition button is pushed, and continue being satisfied until it is pushed again (so the ``condition`` key toggles the associated key between the secondary and primary behaviours).
If ``cancel both`` is true and either of ``primary`` or ``secondary`` are of the type ``hold``, releasing the associated key will execute the ``release`` block of both keys or otherwise stop both actions from continuing. Otherwise the two keys will behave completely independently of each other.
If the ``condition`` key already has other keys that change with it, then the ``condition`` key will change *all* of them to their secondary action. However, if ``solo`` is set to true, it will only toggle the given key and not any of the others.
.. code-block::
:caption: double example
impulse: voice medic
impulse voice activate uber
condition: mouse4