Trying to build a nice flask macro.

Ask gaming related questions (AHK v1.1 and older)
friendlygamer28
Posts: 2
Joined: 12 Apr 2021, 05:49

Trying to build a nice flask macro.

12 Apr 2021, 08:59

Hello Everyone,
im trying to build a nice macro for gaming and could need some help.

I wanna press "1" and that should press 1 2 3 4 5 for me and idealy use a rnd delay of some ms between those key presses.

I started out like this:

Code: Select all

1::

Send {1 down}{2 down}{3 down}{4 down}{5 down}

KeyWait, 1

Send {1 up}{2 up}{3 up}{4 up}{5 up}
one problem is that it only presses 2 3 4 5 when i use 1 as trigger. how do i fix that?

the 2nd thing is how do i add rnd generated delay between those key presses?

I would apreaciate help very much <3

Best Regards
Friendly Gamer
User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Trying to build a nice flask macro.

12 Apr 2021, 09:28

Add $ before the hotkey when you are planning to send the same key.

Explained: Hotkey modifier symbols

For random sleep: RandomSleep

Multi-line hotkey routines should (generally) end in Return.
User avatar
jasc2v8
Posts: 59
Joined: 10 Dec 2020, 12:24
Contact:

Re: Trying to build a nice flask macro.

12 Apr 2021, 09:48

There are a few ways to do this.
Open Notepad and run this script to test.
Modify for your needs:

Code: Select all

~1:: ;send 1 may have to use $1:: but try and see
KeyWait, 1, T0.5  ;Wait for key to be physically released.
Loop, 4
{
	Send % A_Index + 1 ;send 2 through 5
	Random, OutputVar , 30, 100 ; RND 30ms to 100ms
	Sleep, % OutputVar ; random pause
}

Return
friendlygamer28
Posts: 2
Joined: 12 Apr 2021, 05:49

Re: Trying to build a nice flask macro.

12 Apr 2021, 09:53

hey i worked out a version that seems to be working fine:

Code: Select all

$1::
 {
   sendinput, 1
   sleep, % ran(50, 100)
   sendinput, 2
   sleep, % ran(50, 100)
   sendinput, 3
   sleep, % ran(50, 100)
   sendinput, 4
   sleep, % ran(50, 150)
   sendinput, 5
   sleep, % ran(50, 175)
 }
return

ran(min, max)
 {
   random, ran, min, max
   return ran
 }
now im wondering what is the difference between

Code: Select all

sendinput, 1
and

Code: Select all

Send {1 down}
Send {1 up}
im trying to make this macro as undetectable by the game as possible. so im wondering what the difference between those 2 versions would be.
User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Trying to build a nice flask macro.

12 Apr 2021, 09:56

See Send. Send is SendEvent by default. SendInput has less delay and is less interruptible. Otherwise, I think that you are seeing essentially the same sequence. KeyHistory can be informative for understanding this in more detail.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 55 guests