Garry's Mod

Garry's Mod

View Stats:
This topic has been locked
A_King_Doggo Jan 15, 2017 @ 6:04pm
Multi-Key Binding?
So, I don't have many more free keys to use on my keyboard for bindings, so I wanted to know if I can use combo-keys to bind to a specific function.

Like let's say I use a drop weapon addon, and instead of binding it to say, key G;

(bind G drop_weapon)

is there any way I could do it like;

(bind G+E drop_weapon) or

(bind SHIFT+G drop_weapon)

or are binds only one key specific?
< >
Showing 1-15 of 20 comments
NotSoMewwo Jan 15, 2017 @ 8:02pm 
https://www.reddit.com/r/gmod/comments/2jtbvq/i_want_to_bind_a_two_key_combo_to_a_command/

Originally posted by jackwilsdon:

You can try something like this;
// What to do when CTRL+R is pressed
alias action "say Hi"

// Used for enabling/disabling the bind
alias do_action "action"

alias +bind_action "alias do_action action" // Enable do_action
alias -bind_action "alias do_action" // Disable do_action

bind CTRL "+bind_action"
bind R "do_action"
A_King_Doggo Jan 15, 2017 @ 8:43pm 
Okay uh.. Am I just stupid or what?
Mailer Jan 15, 2017 @ 9:57pm 
Presumably, that's what you need to enter into your autoexec.cfg

If you don't have an earthly idea of what that is, then I'm here to explain the best I can.
A_King_Doggo Jan 15, 2017 @ 10:19pm 
No I've never really touched my autoexec config file, I kind of assumed it'd be as easy as binding a single key in the console.
Mailer Jan 15, 2017 @ 10:40pm 
You might be able to do that, but that would require you to redo the commands into the console every time you play. It's way better to include it into an autoexec file.
What you do is, you open note pad, make a document and paste all the commands into it.
In this case, someone suggested the following:
"
You can try something like this;
// What to do when CTRL+R is pressed
alias action "say Hi"

// Used for enabling/disabling the bind
alias do_action "action"

alias +bind_action "alias do_action action" // Enable do_action
alias -bind_action "alias do_action" // Disable do_action

bind CTRL "+bind_action"
bind R "do_action"
"
Once you got this pasted and edited to your liking, go and "save it as".
There, you will be able to save it as "all files" and not just as a document. Name the file to "autoexec.cfg" (don't forget the .cfg-part!)

(Make sure that it is a .cfg file at this state. If it isn't, then you didn't save it correctly.)

So where do you put this cfg file then? Go to the Garry's Mod local files, and there should be a folder called "cfg".
(Someone correct me on this but you might need to open a folder inside of that one called "autorun" as well)
Next to a bunch of other cfg files, paste it there, if there isn't already one there.
If there is, you could just paste the coding into that one without making a new one, lol

Hope I made it clear, and I hope it works. Don't forget to restart Garry's Mod to test it.
(I'm on the phone as I'm writing this so I can't confirm a lot of the details right now)
Last edited by Mailer; Jan 15, 2017 @ 10:49pm
A_King_Doggo Jan 16, 2017 @ 12:20am 
Huh, I was told to just go to garrysmod > garrysmod > config and edit the config CFG file where all the bindings are.

And by told I mean that's what I found on Google, is this any different?
Last edited by A_King_Doggo; Jan 16, 2017 @ 12:21am
Mailer Jan 16, 2017 @ 12:25am 
That is the equal of editing your autoexec.cfg.
However, if you haven't done anything with autoexec before then chances are you don't even have an autoexec.cfg

If you don't have a autoexec file, follow my instructions, if you do, just edit the one you have and paste in the coding suggested above

And the correct pathing is Garrysmod/garrysmod/*cfg* (not "config")

The "config CFG" you are describing from that tutorial has to be the autoexec in question.
It could be some other file but I think you are better off doing this in an autoexec.
Last edited by Mailer; Jan 16, 2017 @ 12:29am
A_King_Doggo Jan 16, 2017 @ 10:39am 
I'm sorry, I'm just trying to make sense of all of this. I go to my C:\Program Files (x86)\Steam\SteamApps\common\GarrysMod\garrysmod\cfg > config.cfg and I edit in Notepad ++ and I see things like;

unbindall
bind "0" "slot0"
bind "1" "slot1"

and such.
Mailer Jan 16, 2017 @ 10:41am 
You actually don't need to do ANYTHING to the config.cfg file. Just leave it alone and follow my instructions if you are ever unsure.
Its way better to just make an autoexec.cfg file and just put it in there.
The game doesn't need it, so if you ever screw something up, just delete the autoexec.Thats why its so preferable.
Last edited by Mailer; Jan 16, 2017 @ 10:42am
A_King_Doggo Jan 16, 2017 @ 10:43am 
Okay, so what's this autoexec.cfg file do? I have one in the folder but the file has no code in it when I look at it in Notepad ++.
Mailer Jan 16, 2017 @ 10:44am 
Then paste the code that you recieved above into it, and change the "say Hi" to whatever you actually want it to do.

The autoexec file does what it says. It performs itself (executes itself) when you start the game (automatically). So you don't need to do it yourself.

You can try something like this; // What to do when CTRL+R is pressed alias action "say Hi" // Used for enabling/disabling the bind alias do_action "action" alias +bind_action "alias do_action action" // Enable do_action alias -bind_action "alias do_action" // Disable do_action bind CTRL "+bind_action" bind R "do_action"
Last edited by Mailer; Jan 16, 2017 @ 10:45am
A_King_Doggo Jan 16, 2017 @ 10:47am 
So if I wanted to say, use Spy's Bullet Time mod, I'd change

alias action "say Hi" to alias action "bt_toggle"

and stuff like that?
Mailer Jan 16, 2017 @ 10:54am 
presumably, yes. If that is the command you used for keys before then you are obviously going to want to use it for these keys too.
A_King_Doggo Jan 16, 2017 @ 10:58am 
So that basically makes it so when I hit CTRL+R it activates bt_toggle?
Mailer Jan 16, 2017 @ 10:59am 
Yes. Yes. You have the game. Go and test it. I just want to know if you got it working like you want to.
Also, make sure that you don't have anything you don't want bound to those keys already as the binds in the control-scheme will still work.
< >
Showing 1-15 of 20 comments
Per page: 1530 50

Date Posted: Jan 15, 2017 @ 6:04pm
Posts: 20