From cb3c24833595d97a3b9f9ddcbd5e17165f26fec6 Mon Sep 17 00:00:00 2001 From: Nicholas Hope Date: Fri, 12 Aug 2022 19:57:34 -0400 Subject: [PATCH] Added a lot of content --- README.md | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 158 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5710597..dd6ec17 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,155 @@ -# Hello and welcome to tfscript! +# Hello and welcome to TFScript! -## Basic overview +This is a little project I created over the summer of 2022 to aid those who might want to do complex things with tf scripting that they may not know is possible. -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. +# 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 Syntax Guide +2. Run `TFScript ` 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 TFScript Syntax section, otherwise, read the YAML Syntax section below, *then* read the TFScript Syntax section. + +  +# YAML Syntax + +  + +hehe + +  + +# TFScript Syntax + +A TFScript file is structured like this: +``` +class1: + key1: + type: + fields + key2: + type: + fields +... + +class2: + key1: +... +``` +where `class1`, `class2`, etc. refer to classes such as soldier, pyro, or any of the other lovable mercenaries. + +key1 and key2 are, rather obviously, 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. + +  + +## Classes + +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". + +  + +## Keys + +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. + +  + +## 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: + command: + +impulse: +``` + +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: + primary: + + secondary: + + condition: + type: <"held" or "toggle", default "held"> + cancel both: + solo: +``` + +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 +``` + +  + +## 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: @@ -24,15 +171,15 @@ There are some issues with this:   -The tfscript way of doing this is +The TFScript way of doing this is ``` default: e: double: primary: - impulse: voice "medic" + impulse: voice medic secondary: - impulse: voice "activate uber" + impulse: voice activate uber condition: mouse4 ``` @@ -41,5 +188,9 @@ There are several benefits to this: - 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 \ No newline at end of file +none everything is perfect and there are no problems it is all amazing + +  \ No newline at end of file