Need help in getting this script to work.

Ask gaming related questions (AHK v1.1 and older)
thunderz123
Posts: 6
Joined: 24 May 2018, 11:59

Need help in getting this script to work.

25 May 2018, 00:53

Hi, lemme get this straight, im a noob. I spent alot of time making this script but it just doesnt seem to work in game (fortnite).
So what i wanted to do was, when i press the "m" key, it should press the "m" ingame first and then it should left click right after pressing the "m" key (M is to place a build and left mouse click confirms the build :3). Whenever i try this script on a browser or notepad, it seems to work just fine! In game however, it only registers the "m" key but not any left click after that. Also, i wanted the "m" key to be independent of all the other keys being pressed at that time. For example, any other key such as w a s d being pressed should not affect the action of "m" key (which is supposed to act as 2 other keys, m and LButton) which didnt work either. "m" doesnt work when any other key is being pressed, which makes sense since it makes the function "Key+m" instead of "m" itself. Can someone please help me in this? i'd be very thankful towards whoever helps :/
Thank you reading.

oh and i made this script (mainly, it doesn't consist of other keybinds which i made).

Code: Select all

{
$m:: 
SendInput {m}{LButton}
return
}
i also tried the keywait command in order to make the LButton work after m but that didnt work either :/
Rohwedder
Posts: 7610
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help in getting this script to work.

25 May 2018, 02:34

Hallo,
perhaps:

Code: Select all

~m::LButton
thunderz123
Posts: 6
Joined: 24 May 2018, 11:59

Re: Need help in getting this script to work.

27 May 2018, 02:25

Rohwedder wrote:Hallo,
perhaps:

Code: Select all

~m::LButton
Can you elaborate that a bit, please?
Rohwedder
Posts: 7610
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help in getting this script to work.

27 May 2018, 03:00

Hallo,
It's a Remapping with ~ prefix.
Tilde: ~ prefix when the Hotkey or Remapping fires, its key's native function will not be blocked.
Does it work or not?
thunderz123
Posts: 6
Joined: 24 May 2018, 11:59

Re: Need help in getting this script to work.

27 May 2018, 04:38

Rohwedder wrote:Hallo,
It's a Remapping with ~ prefix.
Tilde: ~ prefix when the Hotkey or Remapping fires, its key's native function will not be blocked.
Does it work or not?
It does trigger both m and left click together, thanks. But its still not working the way it should. Mostly the left click is pressed first and then the m key is pressed which is contrary to what i wanted. The m key needs to be pressed first and then the mouse click (in 0.3 seconds i guess).
Rohwedder
Posts: 7610
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help in getting this script to work.

27 May 2018, 04:59

Hallo,
then try:

Code: Select all

~m::
Sleep, 300
Send,{Blind}{LButton DownR}
Return
~m up::Send,{Blind}{LButton Up}
thunderz123
Posts: 6
Joined: 24 May 2018, 11:59

Re: Need help in getting this script to work.

27 May 2018, 09:39

Rohwedder wrote:Hallo,
then try:

Code: Select all

~m::
Sleep, 300
Send,{Blind}{LButton DownR}
Return
~m up::Send,{Blind}{LButton Up}
woah, it works way more perfectly now, the only issue is that it holds the Key for quite some time which i dont want, i only want it to 'spam' the m+left mouse button combo/command when i hold the m button. Secondly it doesnt work when shift is being pressed which i guess can be solved through the <+m command?
Rangerbot
Posts: 31
Joined: 02 Mar 2018, 10:33

Re: Need help in getting this script to work.

27 May 2018, 10:44

adjust the milliseconds of sleep from 300 to something lower.
you can omit the line or change it to Sleep -1 to allow for interrupts there as well.
Last edited by Rangerbot on 27 May 2018, 11:17, edited 1 time in total.
thunderz123
Posts: 6
Joined: 24 May 2018, 11:59

Re: Need help in getting this script to work.

27 May 2018, 10:57

Rangerbot wrote:adjust the milliseconds of sleep from 300 to something lower.
you can omit the line or change it to Sleep -1 to allow for interrupts there as well.
i did change the sleep, it works perfectly timing the left click right after the m key. Problem is that it holds the left click.
Rangerbot
Posts: 31
Joined: 02 Mar 2018, 10:33

Re: Need help in getting this script to work.

27 May 2018, 11:23

Code: Select all

~m::
Sleep, 300
click                                                            ; try this
Return                                                         ;this stops the program and sends it back to before ~m was called.
                                                                   ;therefore "Send,{Blind}{LButton Up}" was only being called on m up and not within 300ms of pressing m
                                                                   ;I dont think you needed the second declaration for M up

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 34 guests