What I need is a way to make 1 mouse click to act as a key and a long mouse-click (same button) act as another key. For example:
left-click = r
long left-click = f
Basically I want to be able to set 2 separate keys to the same mouse button. Is there a way to do this? Thanks
Make a long mouse-click register as a separate key
Started by
ZIGS
, Aug 26 2012 01:26 AM
30 replies to this topic
#1
-
Posted 26 August 2012 - 01:26 AM
Hello ZIGS, welcome to the forum
~LButton:: KeyWait, Lbutton Send, % A_TimeSinceThisHotkey > 500 ? "f":"r" ; change 500 to suit your needs return
#2
-
Posted 26 August 2012 - 05:12 AM
Ok thanks, that's almost what I need. Is there a way to make it so it triggers while I still have the mouse button pressed instead of having to release it to register the key?
#3
-
Posted 26 August 2012 - 04:09 PM
~LButton:: SetTimer, check, -200 return check: if GetKeyState("Lbutton", "P") { Send,f return } Send, r return
#4
-
Posted 26 August 2012 - 06:55 PM
Humm, it doesn't seem to be working (the long click I mean). In fact, forget about the normal click, I can just use LButton::r. I just need a scrip for the long button. Maybe if I tell you what I need it for it might be easier to understand.
It's to use with a game. You have 2 attacks, light and heavy and I want to be able to use them both with just one mouse button. So say I have (in the game options) the light attack mapped to r and the heavy attack to f. I use LButton::r so clicking the left button results in a light attack and then I need a script so if I long-click the same mouse button, it results in a heavy attack. Sorry if this sounds confusing and for being a pain in the ass
It's to use with a game. You have 2 attacks, light and heavy and I want to be able to use them both with just one mouse button. So say I have (in the game options) the light attack mapped to r and the heavy attack to f. I use LButton::r so clicking the left button results in a light attack and then I need a script so if I long-click the same mouse button, it results in a heavy attack. Sorry if this sounds confusing and for being a pain in the ass
#5
-
Posted 26 August 2012 - 08:27 PM
That script worked for me redo your copy pasta and try again. There was one issue though the mouse click was still sent along with the hotkey that may be your problem if it isn't working with the game. test it out in notepad before you launch the game.
#6
-
Posted 26 August 2012 - 09:15 PM
~LButton:: KeyWait,LButton,T0.5 Send % ErrorLevel ? "f":"r" return
#7
-
Posted 26 August 2012 - 09:19 PM
If you take off the ~ at the begining of the script it may work better with the game, but there is the issue with not being able to click anymore so you may want to do this.
that way you can still use the 0 on the number pad to click the mouse.
LButton:: { SetTimer, check, -200 return check: KeyWait, Lbutton,) { if ErrorLevel Send,f else Send, r return } } Numpad0:: click
that way you can still use the 0 on the number pad to click the mouse.
#8
-
Posted 26 August 2012 - 09:34 PM
None of those work. In fact, I just realized it's impossible because when I click the button, that click registers immediately and the scrip can't possibly know I don't want it to register, I want to only register after the button is held down a while. So yeah, good idea in theory but it can't be done. The only way this would work is if the game itself was programmed to do it. Thanks anyway guys
EDIT: ok, I've been thinking and what about this: what if you guys made the normal click (light attack, key R) register not when the button clicks, but when the button "unclicks"? That way you could set the heavy attack (key R) the same way but make it register with a small delay, although this one(the long click) would have to register with the mouse button still pressed, like I pointed out earlier. Is this doable at all?
EDIT: ok, I've been thinking and what about this: what if you guys made the normal click (light attack, key R) register not when the button clicks, but when the button "unclicks"? That way you could set the heavy attack (key R) the same way but make it register with a small delay, although this one(the long click) would have to register with the mouse button still pressed, like I pointed out earlier. Is this doable at all?
#9
-
Posted 26 August 2012 - 10:51 PM
LButton:: KeyWait,LButton,T0.5 Send % ErrorLevel ? "f":"r" return ; with bettyj's idea NumpadIns::LButton Numpad0::LButton
#10
-
Posted 26 August 2012 - 11:03 PM
Buckaroo, that one works in notepad but doesn't work in the game. I think it's due to the reason I pointed out in my previous post's edit. But if it works in notepad, shouldn't it also work in the game? I mean it's the same thing right? Now I'm confused
#11
-
Posted 26 August 2012 - 11:12 PM
Try each of these at the top of your script after any # commands/directives such as #InstallKeybdHookBuckaroo, that one works in notepad but doesn't work in the game. I think it's due to the reason I pointed out in my previous post's edit. But if it works in notepad, shouldn't it also work in the game? I mean it's the same thing right? Now I'm confused
; Uncomment them first, Input is your best bet.
SendMode Input
;SendMode Play
;SendMode Event
;SendMode InputThenPlay
OR use SendInput or SendPlay in place of Send in the code that works in notepad, may then perhaps work in the game.
Oh, and, run the script as an administrator if the need be...
#12
-
Posted 26 August 2012 - 11:23 PM
I'm running it as administrator. Tried all of those. SendMode ImputThenPlay at the top and replacing Send with SentImput gave some sort of error and didn't let me save the scrip. None of the other options worked. Though I'm not sure I've done it right because I have no idea what # commands/directives and #InstallKeybdHook is
#13
-
Posted 26 August 2012 - 11:47 PM
Sorry, I'm confusing you there. What game is it? I'll get it working. Pm me if you want to keep the title private.
SendInput not SendImput by the way.
SendInput not SendImput by the way.
LButton:: KeyWait,LButton,T0.5 SendInput % ErrorLevel ? "f":"r" return NumpadIns::LButton Numpad0::LButton
#14
-
Posted 26 August 2012 - 11:52 PM
Tried that one, didn't work in the game. The game is Dark Souls (and now cue everyone and their mother telling me to play with a controller:))
#15
-
Posted 27 August 2012 - 12:07 AM