Keybinding
Quote from narsqrd on August 15, 2012, 5:34 pmI have an idea in the back of mind, but it would really only work under one particular condition:
Is there any way to bind a player's key to trigger an entity in a map? Not necessarily trigger I suppose -- sending outputs at all would be one thing -- but that if the player presses, for example, F a particular logic_relay would be triggered.
Is this something that can be done with Hammer wizardry? Or would that take more elaborate coding?
I have an idea in the back of mind, but it would really only work under one particular condition:
Is there any way to bind a player's key to trigger an entity in a map? Not necessarily trigger I suppose -- sending outputs at all would be one thing -- but that if the player presses, for example, F a particular logic_relay would be triggered.
Is this something that can be done with Hammer wizardry? Or would that take more elaborate coding?
Quote from FelixGriffin on August 15, 2012, 5:48 pmIt can be done with Hammer, although in multiplayer or in challenge maps it requires cheats (since the player could use this to activate a distant button or trigger, or even summon a cube from across a pit).
To look at standard keys (fire, use, jump, crouch) you can use a game_ui or logic_playerproxy. To use other ones, you can place a point_servercommand in your level (which lets you use the console), then have a logic_auto (or a trigger, perhaps?) OnMapSpawn > servercommand > Command > bind f ent_fire f_button_pressed trigger. Then whenever f is pressed, the f_button_pressed relay triggers. If you used a trigger or something to bind the key, you can take away that power later by disabling the relay or firing > servercommand > Command > unbind f.
It can be done with Hammer, although in multiplayer or in challenge maps it requires cheats (since the player could use this to activate a distant button or trigger, or even summon a cube from across a pit).
To look at standard keys (fire, use, jump, crouch) you can use a game_ui or logic_playerproxy. To use other ones, you can place a point_servercommand in your level (which lets you use the console), then have a logic_auto (or a trigger, perhaps?) OnMapSpawn > servercommand > Command > bind f ent_fire f_button_pressed trigger. Then whenever f is pressed, the f_button_pressed relay triggers. If you used a trigger or something to bind the key, you can take away that power later by disabling the relay or firing > servercommand > Command > unbind f.
Quote from Skotty on August 15, 2012, 8:01 pmJust for correctness, because it could maybe cause problems, use "" when using bind commands.
bind f "<COMMAND>", since the console maybe could see a space (for example between ent_fire and the targetname) as end of the whole command.
Just for correctness, because it could maybe cause problems, use "" when using bind commands.
bind f "<COMMAND>", since the console maybe could see a space (for example between ent_fire and the targetname) as end of the whole command.
Quote from Brainstone on August 16, 2012, 11:50 amWon't using ""-tags in hammer destroy the Hammer file, as it is built using the same system?
Won't using ""-tags in hammer destroy the Hammer file, as it is built using the same system?
Quote from narsqrd on August 16, 2012, 12:10 pmTrying this out I've run into trouble.
Entering bind f "ent_fire temp_relay trigger" straight into the console works fine. Pressing f then triggers temp_relay
However, when I add an output to an entity (this failed for both logic_auto and logic_relay) that goes OnTrigger > servercommand > Command > bind f "ent_fire temp_relay trigger" the console says "f" = "+mouse_menu"
I tried other letters, "q" = "+mouse_menu_taunt", "t" = "say", evidently these keys are already bound and trying to change them via in-map entities doesn't work
I tried to bind an unbound letter, it says "z" is not bound
Trying this out I've run into trouble.
Entering bind f "ent_fire temp_relay trigger" straight into the console works fine. Pressing f then triggers temp_relay
However, when I add an output to an entity (this failed for both logic_auto and logic_relay) that goes OnTrigger > servercommand > Command > bind f "ent_fire temp_relay trigger" the console says "f" = "+mouse_menu"
I tried other letters, "q" = "+mouse_menu_taunt", "t" = "say", evidently these keys are already bound and trying to change them via in-map entities doesn't work
I tried to bind an unbound letter, it says "z" is not bound
Quote from Alexander Bell on August 16, 2012, 2:25 pmq is gestures, t is say, and f (I think) is the new "play test" menu thing.
q is gestures, t is say, and f (I think) is the new "play test" menu thing.

Quote from ChickenMobile on August 17, 2012, 10:06 pmI wouldn't try to bind a certain key seeing as anyone could have a custom keybinding.
I would try to use the keys available to use in a game_ui. Perhaps you could have a key-combo instead of just one key. (using logic_branch etc)
I wouldn't try to bind a certain key seeing as anyone could have a custom keybinding.
I would try to use the keys available to use in a game_ui. Perhaps you could have a key-combo instead of just one key. (using logic_branch etc)
Quote from narsqrd on August 18, 2012, 6:56 amIt does seem like the "s are messing things up, because an entity calling <bind f "ent_fire temp_relay trigger"> appears to ignore everything in quotes so the command ends up looking like <bind f>
Using the default bindings via game_ui and logic_playerproxy (especially multiple keys) just feels like an unpleasant solution. "Yes player, I'm going to need you to crouch-jump every time you need to activate the thing". The best that could come of that is probably having them hit both moveleft and moveright at once do it, but that still feels weird.
I've tried using escape characters, like <bind f "..."> but apparently vbsp doesn't like that and it crashes the compiler
My last resort would probably be kindly asking the player to open up the console and type in the thing themselves, but obviously that has its own drawbacks. I'm assuming more than half the playerbase has never used the console and it would ruin the whole immersive gameplay experience
It does seem like the "s are messing things up, because an entity calling <bind f "ent_fire temp_relay trigger"> appears to ignore everything in quotes so the command ends up looking like <bind f>
Using the default bindings via game_ui and logic_playerproxy (especially multiple keys) just feels like an unpleasant solution. "Yes player, I'm going to need you to crouch-jump every time you need to activate the thing". The best that could come of that is probably having them hit both moveleft and moveright at once do it, but that still feels weird.
I've tried using escape characters, like <bind f "..."> but apparently vbsp doesn't like that and it crashes the compiler
My last resort would probably be kindly asking the player to open up the console and type in the thing themselves, but obviously that has its own drawbacks. I'm assuming more than half the playerbase has never used the console and it would ruin the whole immersive gameplay experience
Quote from FelixGriffin on August 18, 2012, 9:44 amYeah, I only use a playerproxy because crouching is half of the behavior I need.
Yeah, I only use a playerproxy because crouching is half of the behavior I need.
Quote from DaMaGepy on August 21, 2012, 5:37 am"F" is my right strafe key since I use ESDF for movement in every game, and A is use, G is next weapon, etc.... I would be really pissed off if something rebinds my keys. I also have a binding for all unused key, usually for mapmaking, turning things on/off.
"F" is my right strafe key since I use ESDF for movement in every game, and A is use, G is next weapon, etc.... I would be really pissed off if something rebinds my keys. I also have a binding for all unused key, usually for mapmaking, turning things on/off.