Age :44
Group: Administrator
Location: Portugal
Started playing Quakeworld in 1997. Always been active in the community. With strong opinions about the game and the path it should follow, always fought the conservative qw ideals. Lately has been involved in bringing new players into the game, making their life easier and promoting different game modes and maps.

know more @ http://wiki.quakeworld.nu/Mushi
Misc  /  11 Mar 2013, 17:54
T&T#5 Switch keys
Sometimes 5 fingers aren't enough. I bet you had situations in the past that you wish you had tentacles to press all the keys you want to
Fortunately there's an easy way to rebind the same key to do something different. I call them "Switch keys".
What are "Switch" keys
I call a switch key a key that is bound to an alias that changes other key's binds (which i call multi-bind keys), and restores them when the switch key is unpressed.

The binds in multi-bind keys are changed by the "switch" key. For example, in my cfg the key 4 is a multi bind key. When im playing, it "say_team Get quad". But when im pressing the switch key (the TAB key), it "say_team Get Quad at 32", being 32 the second that quad spawns (it's a timer script, which we will talk in later blogs). When i release TAB, it restores the original "Get Quad" message. What I mean is, the switch key changes the bind of the multi-bind keys, only during the period i'm pressing it. Then when I release the switch key, the binds in multi-bind keys are restored to their original values.

I felt the need of using multi-bind keys because i love teamplay, and I would like to have more fingers to be able to send more informative messages to my teammates. So, i started using multi-bind keys. This way, one key can have multiple meanings, and I control that.

How to create switch and multi-bind keys
Here's an example:

// when the switch is pressed, it binds the keys to the new meaning
alias +switch "con_notifylines 2; +showteamscores; bind SPACE _trick; bind MOUSE2 _packs"

//when the switch is released, the original binds are restored to the same keys
alias -switch "con_notifylines 5; -showteamscores; bind SPACE +jump ; bind MOUSE2 +lg"

(...)

//original binds
bind TAB +switch // the switch key
bind SPACE +jump // the normal space bind
bind MOUSE2 +lg // the normal mouse2 bind


In this example, TAB is the switch key, and SPACE and MOUSE2 are the keys affected by the switch key.
The normal binds for space and mouse2 are +jump and shoot lg respectively.

When i press the switch key, the following happens:
  • reduces the notifylines in the console;
  • shows the scores;
  • binds SPACE to a different alias;
  • binds MOUSE2 to a different alias;


When i release the switch key, the following happens:
  • increases the notifylines in the console to the default value;
  • hides the scores;
  • binds SPACE back to the original alias;
  • binds MOUSE2 back to the original alias;



In the next blog entry we will talk about setting the timer using a Switch key.

Can you find these "switches" useful? Post it in the comments!


Back to T&T index
Comments
2013-03-11, 22:55
Nice job Mushi. Its great that You put your free time into this rookie-friendly posts. I'm sure it helps alot!
2013-03-12, 11:26
Thanks er
I write this with lots of love and just a bit knowledge.
2013-03-13, 14:40
This "get quad 32" interests me. Can't wait to see the next blog where you reveal the script =)
2013-03-13, 20:52
There are numerous scripts on the forum.
i will just exemplify here
You have to be logged in to be able to post a comment.
Username:
Password: