From 10bec8a6295c8a2c0d73245e342030274dfa1d7c Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Fri, 26 Jan 2024 22:43:24 +1100 Subject: [PATCH 1/3] add article boilerplate --- README.md | 4 ++++ .../20240126_cs_surf_-_toggle_all_saveloc_keybinds.md | 1 + 2 files changed, 5 insertions(+) create mode 100644 articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md diff --git a/README.md b/README.md index 8282869..68fdc3c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ my blog --- +### [20240126 CS Surf - Toggle all saveloc keybinds](articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md) + +> _Use one key to toggle all of your saveloc keybinds on and off_ + ### [20231105 CS2 Surf](articles/20231105_cs2_surf/20231105_cs2_surf.md) > _The configs that I use for CS2 surf, currently a WIP_ diff --git a/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md new file mode 100644 index 0000000..2d627e6 --- /dev/null +++ b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md @@ -0,0 +1 @@ +# 20240126 CS Surf - Toggle all saveloc keybinds From 8e791b6fe700fa20f4d308bcf5aabb5b52d44f6f Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Fri, 26 Jan 2024 23:17:25 +1100 Subject: [PATCH 2/3] write article for toggling cs keybinds --- ...6_cs_surf_-_toggle_all_saveloc_keybinds.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md index 2d627e6..88c76e5 100644 --- a/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md +++ b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md @@ -1 +1,125 @@ # 20240126 CS Surf - Toggle all saveloc keybinds + +- [20240126 CS Surf - Toggle all saveloc keybinds](#20240126-cs-surf---toggle-all-saveloc-keybinds) + - [What is saveloc?](#what-is-saveloc) + - [How do I use saveloc?](#how-do-i-use-saveloc) + - [What do I need?](#what-do-i-need) + - [The CFGs](#the-cfgs) + - [The Magic](#the-magic) + +## What is saveloc? + +When surfing in CS Source/GO/2, the `saveloc` keybinds are essential! + +This is the name given to the checkpoint system used to +- add a checkpoint as you progress through the map +- teleport to that checkpoint at any time to practice the map + +If you've ever played Trackmania (or any other racing game), you'll be familiar with such a system - if you drive off the track or wipe out, then you can teleport to a previous checkpoint and then try the same section again. + +In surf this system is the same, except that you have to manually add the checkpoint yourself while surfing! (_TODO: do an article in future to implement something automatic?_) + +There is a quick YouTube video that you can check outt for an overview of this plugin if you are new to it: + +[![Pro Surfers do THIS to Learn 1000+ Maps](https://img.youtube.com/vi/0LbAwLliMvk/0.jpg)](https://www.youtube.com/watch?v=0LbAwLliMvk) + +--- + +## How do I use saveloc? + +I use saveloc the way that most people do, and only use a handful of keybinds + +1. save checkpoint +2. teleport to checkpoint +3. switch to previous checkpoint +4. switch to next checkpoint + +In addition, I'm also including 2 other teleport commands in this article which are + +5. teleport to beginning of map +6. teleport to beginning of stage + +## What do I need? + +I find that I need to be very careful whenever I use `saveloc`, as accidentally hitting the "teleport to checkpoint" keybind means that you enter "practice" mode and your map time can no longer be counted as a leaderboard entry. + +- This means that accidentally hitting the `sm_tele` keybind is catastrophic. +- Putting this keybind on a hard-to-reach key means that it would be much harder to actually practice as each teleport is harder to press + +So, my aim is + +> *Toggle all teleport & saveloc keybinds on and off with a single key* +> i.e. +> - saveloc is enabled by default +> - press '.' to **disable** all teleport/saveloc keybinds ("leaderboard mode") +> - press '.' to **re-enable** all teleport/saveloc keybinds ("practice mode") + +--- + +## The CFGs + +My solution relies on "one weird trick™", but first it's easier to build up the required cfg files for the enable/disable actions. + +- `surf_savelog.cfg` + ```json + // This file contains all SurfTimer saveloc keybinds + + // set teleport location + bind q "sm_saveloc"; + // teleport to location + bind e "sm_tele"; + bind mwheeldown "sm_tele"; + + // change to previous/next teleport location + bind 1 "sm_teleprev"; + bind p "sm_teleprev"; + bind 2 "sm_telenext"; + + say "saveloc enabled"; + ``` + +- `surf_nosaveloc.cfg` + ```json + // This file _disables_ all SurfTimer saveloc keybinds + + // set teleport location + unbind q; + // teleport to location + unbind e; + unbind mwheeldown; + + // change to previous/next teleport location + unbind 1; + unbind p; + unbind 2; + + say "saveloc disabled"; + ``` + +## The Magic + +The `alias` command points one cfg command -> another one. + +Using this, we can create 2+ state commands, and then one main command that is "aliased" to one of the state commands by default, e.g. + +- one command to "bind all saveloc keybinds" +- one command to "unbind all the saveloc keybinds" +- and a third that "toggles" the binds, that initially defaults to "bind" + +*The bind/unbind commands need to include a 2nd command that assigns a new alias!* This allows the bind/unbind commands to be called, and then set the shared alias to point to the other command. + +This can be used for a simple toggle like I've done here, but can also be used to increment/cycle through 2+ states (e.g. I've used this to iterate through `host_timescale` on my home server in 5 stages). + +After creating the two CFG files above^, I have the following section in my `surf_online.cfg` config file + +```json +// saveloc (bind by default) +exec surf_saveloc.cfg; +alias savelocon "exec surf_saveloc.cfg; alias saveloc savelocoff"; +alias savelocoff "exec surf_nosaveloc.cfg; alias saveloc savelocon"; +alias saveloc "savelocoff"; +// toggle saveloc +bind . "saveloc"; +``` + +This means that I can press the `.` button toggle between practice/attempt modes easily! Hope you enjoy :) \ No newline at end of file From 826c10bb516983ed17c0b813a7b60641be33eb32 Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Fri, 26 Jan 2024 23:21:09 +1100 Subject: [PATCH 3/3] try js for code formatting --- .../20240126_cs_surf_-_toggle_all_saveloc_keybinds.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md index 88c76e5..39f4ca0 100644 --- a/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md +++ b/articles/20240126_cs_surf_-_toggle_all_saveloc_keybinds/20240126_cs_surf_-_toggle_all_saveloc_keybinds.md @@ -61,7 +61,7 @@ So, my aim is My solution relies on "one weird trick™", but first it's easier to build up the required cfg files for the enable/disable actions. - `surf_savelog.cfg` - ```json + ```javascript // This file contains all SurfTimer saveloc keybinds // set teleport location @@ -79,7 +79,7 @@ My solution relies on "one weird trick™", but first it's easier to build up th ``` - `surf_nosaveloc.cfg` - ```json + ```javascript // This file _disables_ all SurfTimer saveloc keybinds // set teleport location @@ -112,7 +112,7 @@ This can be used for a simple toggle like I've done here, but can also be used t After creating the two CFG files above^, I have the following section in my `surf_online.cfg` config file -```json +```javascript // saveloc (bind by default) exec surf_saveloc.cfg; alias savelocon "exec surf_saveloc.cfg; alias saveloc savelocoff";