tfscript/docs/source/types.rst

2.4 KiB

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

Impulse

Overview:

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

Example

e:
  impulse: voice medic

Double

Overview:

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.

Example

double:
  primary:
    impulse: voice medic
  secondary:
    impulse voice activate uber
  condition: mouse4