Macro script help

Ask gaming related questions (AHK v1.1 and older)
shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Macro script help

Post by shush12345 » 19 Jul 2021, 13:48

When I press the following buttons I want it to type out a phrase and press enter as quickly as possible:

When I press F1 I want it to type ":pull x" and press enter after
When I press F2 I want it to type ":hit x" and press enter after
When I press F3 I want it to type ":locktarget" and press enter after
When I press F4 I want it to type "@x @x @x @x @x @x @x @x @x @x" and press enter after
When I press F5 I want it to type ":throwknife x" and press enter after
When I press Esc I want it to type ":escort x" and press enter after
When I press Del I want it to type ":heal" and press enter after

I want all of these to happen instantly so there is no delay.
I edited this post to make it more clearer.
These macros need to work while holding shift.
Last edited by gregster on 19 Jul 2021, 18:07, edited 4 times in total.
Reason: I merged your two topics which are obviously about the same thing.

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 15:14

Can someone pls make a script for this ASAP?

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

keyboard macro script help (Simple fix)

Post by shush12345 » 19 Jul 2021, 17:23

Im usning this scipt for a game:

F1::Send, `:pull x
F2::Send, `:hit x
F3::Send, `:locktarget
F4::Send, `@x @x @x @x @x @x @x @x @x @x
F5::Send, `:throwknife x
Esc::Send, `:escort x
Del::Send, `:heal x

and I need it to press enter everytime i press a macro and I need it to be instant. For example, I press F1 and it instantly types :pull x and enter button
Also theses macros dont work while I hold shift so can you make them work while holding shift

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: keyboard macro script help (Simple fix)

Post by shush12345 » 19 Jul 2021, 17:39

I changed it to this:

Shift & F1::Send, `:pull x
Shift & F2::Send, `:hit x
Shift & F3::Send, `:locktarget
Shift & F4::Send, `@x @x @x @x @x @x @x @x @x @x
Shift & F5::Send, `:throwknife x
Shift & Esc::Send, `:escort x
Shift & Del::Send, `:heal x

But when i use it, you can see each letter being typed out but i dont want that, i want it to be instant (like when you copy and paste stuff). Also, I need to make it press enter after each one I press

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 18:11

You could try

Code: Select all

+F1::SendInput, `:pull x{enter}
+ acts as the Shift modifier - this way is preferable.
If SendInput mode doesn't work for your game, you might try to set the clipboard to the string you want, and paste it via send ^v.

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:29

gregster wrote:
19 Jul 2021, 18:11
You could try

Code: Select all

+F1::SendInput, `:pull x{enter}
+ acts as the Shift modifier - this way is preferable.
If SendInput mode doesn't work for your game, you might try to set the clipboard to the string you want, and paste it via send ^v.
Thanks it works. Would you say that the clipboard thing would enter the phrase faster than the sendinput or are they same speed because the game that I play, every milisecond counts

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 18:34

Probably pasting is faster, but if there's a noticeable difference for such short strings, I don't know. I am no gamer, and I usually don't look at milliseconds. 8-)

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:35

gregster wrote:
19 Jul 2021, 18:34
Probably pasting is faster, but if there's a noticeable difference for such short strings, I don't know. I am no gamer, and I usually don't look at milliseconds. 8-)
Can you do the same script you did but make it paste please?

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 18:41

It might depend on the game

Code: Select all

+F1::
	clipboard := ":pull x`n"
	SendInput ^v
return
or perhaps:

Code: Select all

+F1::
	clipboard := ":pull x"
	SendInput ^v
	; sleep 10		; optional
	SendInput {Enter}
return

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:43

gregster wrote:
19 Jul 2021, 18:41

Code: Select all

+F1::
	clipboard := ":pull x`n"
	SendInput ^v
return
or perhaps:

Code: Select all

+F1::
	clipboard := ":pull x"
	SendInput ^v
	; sleep 10		; optional
	SendInput {Enter}
return
which is faster?

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 18:44

No idea - might depend on the game, if it works at all. Potentially the first one.
Try it and see...

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:47

gregster wrote:
19 Jul 2021, 18:44
No idea - might depend on the game, if it works at all.
Try it and see...
Ok thanks just 1 more question. I want macros for f2,f3,f4 etc... so do i leave a space under it and type the script again for example:

+F1::
clipboard := ":pull x`n"
SendInput ^v
return

+F2::
clipboard := ":hit x`n"
SendInput ^v
return

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 18:50

Yes, that's a way. You could wrap that into a function, I guess. It wouldn't be faster, just less lines.

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:52

gregster wrote:
19 Jul 2021, 18:50
Yes, that's a way. You could wrap that into a function, I guess. It wouldn't be faster, just less lines.
wouldnt know how to do that but thanks anways!

shush12345
Posts: 33
Joined: 26 Jun 2021, 07:29

Re: Macro script help

Post by shush12345 » 19 Jul 2021, 18:58

shush12345 wrote:
19 Jul 2021, 18:43
gregster wrote:
19 Jul 2021, 18:41

Code: Select all

+F1::
	clipboard := ":pull x`n"
	SendInput ^v
return
or perhaps:

Code: Select all

+F1::
	clipboard := ":pull x"
	SendInput ^v
	; sleep 10		; optional
	SendInput {Enter}
return
which is faster?
The first script out of the 2 doesnt enter when i press f1 @gregster

gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Macro script help

Post by gregster » 19 Jul 2021, 19:30

gregster wrote:
19 Jul 2021, 18:44
might depend on the game, if it works at all.
Try it and see...
Yeah, that's surely possible. I could only test it in an editor.
Does the second one work? Then, use that.

Post Reply

Return to “Gaming Help (v1)”