help meee

Ask gaming related questions (AHK v1.1 and older)
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

help meee

23 Apr 2017, 06:21

i wan a button to be hold when i click the macro button and the button to be released when i release the macro button . for example , i hold G and right click will also be held and when i release the G button the Right click will be released too.i want the $*Enter::Suspend part to work as a normal enter key and also to disable the script.for example if i want to send a message to my team in a game i click enter and it should allow me to type my message and at the same type pause the script from functioning so that when im typing , the script will not interfere with my message.after that i click enter to send the message in game and the macro continues to function normally


$G::
Loop, 2
{
if GetKeyState("G", "p")
break
Send {5 Down}
Sleep 10
Send {Space Down}
Sleep 10
Send {Space Up}
Sleep 10
Send {F down}
Sleep 10
Send {Space down}
Sleep 10
Send {F Up}
Sleep 10
Send {Space Up}
Sleep 10
Send {5 Up}
Sleep 10
}
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}
return



$*Enter::Suspend
User avatar
PipeDreams
Posts: 165
Joined: 19 Dec 2015, 00:20

Re: help meee

23 Apr 2017, 22:26

Here's a script I made to use in Masseffect Andromeda, it has many examples of what you're asking for plus some others you might find useful. Feel free to play with it and modify it to your heart's content. Make sure to read comments in the script for hints as to what things do.

Also have a look at this if you haven't already.
https://autohotkey.com/docs/Tutorial.htm

Code: Select all


#NoEnv
#Persistent
#SingleInstance Force
#MaxHotkeysPerInterval 200
Menu, Tray, Icon, D:\Origin Games\Mass Effect Andromeda\MassEffectAndromeda.exe ;Set the Icon path on this line.
;<======================================== Run ==============================================>
WinChk: ;Checks for game to be running/Launches the game if not running/ If game is running the scrip will skip the pop up box/ Auto Close script when the game has stopped.
{	IfWinExist ahk_class Mass Effect™: Andromeda
	{	WinWaitClose, ahk_class Mass Effect™: Andromeda
		ExitApp
	} Else
	IfWinNotExist, ahk_class Mass Effect™: Andromeda
	{	MsgBox, 4,, Launch Mass Effect Andromeda?
		IfMsgBox No
		{	ExitApp
		} Else
		IfMsgBox Yes
		{	Run, "steam://rungameid/10980548350020943872" ;Set Game exe path or lnk shortcut you want to run.
			WinWaitActive, ahk_class Mass Effect™: Andromeda
			GoSub, WinChk
}	}	} Return
;<======================================= Switches ============================================>
*$~Esc:: ;Kills App if held for 2 sec. and suspends script if hit one time.
Suspend, Permit ;Permits the Esc key to be excluded from suspension.
{	KeyWait, Esc, T2
	If (ErrorLevel = 1)
	{	ExitApp ;Kills App if held for 2 sec.
	} Else 
	IfWinActive, ahk_class Mass Effect™: Andromeda ;Suspends script if hit one time.
	{	If (!SteamOverlay) ;If SteamOverlay is NOT up.
		{	If (!TogSwhEnter) ;Suspend OFF, HotKeys are functional.
			{	TogSwhEnter := !TogSwhEnter ;Script Toggle Switch
				Suspend, ON
				SoundBeep, 100, 10
		}	} Else
		If (SteamOverlay) ;If SteamOverlay is up.
		{	SteamOverlay := !SteamOverlay ;SteamOverlay Toggle Switch
			SendInput, {Shift Up} ;Because my shift key gets stuck sometimes, you can delete this line.
}	}	} Return
#IfWinActive, Mass Effect™: Andromeda ;Script will only function while in selected game.

;1nd half of double tap and hold W for sprint.
*$~w:: ;Double-tap and hold to sprint, will also unsuspend the script if suspend.
Suspend, Permit ;Allows the macro to function when suspend.
{	If (!SteamOverlay) ;If SteamOverlay is NOT up.
	{	If ButtonCount > 0  ;Double press checker.
		{	ButtonCount += 1 ;Double press counter.
			Return
		} ButtonCount = 1
		SetTimer, Trigger, 300 ;Sets the timer.
		If (TogSwhEnter) ;Suspend ON, ;If HotKeys are non-functional for typing in-game.
		{	KeyWait, w, T.4 ;Waits for w to be held to unsuspend the script.
			If (ErrorLevel = 1)
			{	Suspend, OFF ;Suspend OFF, HotKeys are functional again.
				TogSwhEnter := !TogSwhEnter ;Script Toggle Switch
				SoundBeep, 700, 10
}	}	}	} Return

*$~+Tab:: ;Shift + Tab Steam Overlay, and suspend script.
Suspend, Permit
{	SteamOverlay := !SteamOverlay
	{	If (SteamOverlay)
		{	If (!TogSwhEnter)
			{	TogSwhEnter := !TogSwhEnter
				SoundBeep, 100, 10
			} Suspend, ON
		} If (!SteamOverlay)
		{	TogSwhEnter := !TogSwhEnter
			SoundBeep, 700, 10
			Suspend, OFF
}	}	} Return

*$~Enter:: ;Suspend script in game for typing.
Suspend, Permit
{	If (GetKeyState("Enter", "P") AND !GetKeyState("Alt", "P"))
	{	If (SteamOverlay)
		{	SoundBeep, 100, 10
			Return
		} Else 
		If (!SteamOverlay)
		{	TogSwhEnter := !TogSwhEnter 
			{	If (TogSwhEnter) ;ON
				{	Suspend, ON ;Suspend ON, HotKeys are non-functional for typing in-game.
					SoundBeep, 100, 10
				} If (!TogSwhEnter) ;OFF
				{	Suspend, OFF ;Suspend OFF, HotKeys are functional again.
					SoundBeep, 700, 10
}	}	}	}	} Return
;<======================================== Hot-Keys ===========================================>
*$~LButton::GoSub, LChk ;you can hotkey like this.
LChk: ;L_Click_Counter ;Double-click and hold for turbo clicker.
{	If (A_TimeSincePriorHotkey < 400) AND (A_PriorHotkey = "*$~LButton")
	{	KeyWait, LButton, T 0.2 ;Held wait time after double click.
		If (ErrorLevel = 1)
		{	While, (GetKeyState("LButton", "P"))
			{	Click
				Sleep, 10
}	}	}	} Return ;<<< L_Click_Counter / LChk

*$~MButton:: ;Or you can hotkey like this.
{	SendInput, {Shift DownTemp}
	KeyWait, MButton
	SendInput, {Shift Up}
	Sleep, 7
	SendInput, {x DownTemp}
	Sleep, 77
	SendInput, {x Up}
	Sleep, 7
} Return

*$~RButton:: ;Or like this.
{	Sleep, 300
	SendInput, {z DownTemp}
	Sleep, 700
	SendInput, {z Up}
} Return

*$~v:: ;Combines one key into two or more.
{	SendInput, {e DownTemp}
	KeyWait, v ;Wait for V up first, then E will come up.
	SendInput, {e Up}
} Return

*$~g::
{	SendInput, {8 DownTemp}
	KeyWait, g
	SendInput, {8 Up}
} Return

Trigger: ;2nd half of double tap and hold W for sprint.
{	SetTimer, Trigger, OFF
	If ButtonCount = 2 
	{	SendInput, {Shift DownTemp}
		Sleep, 77
		SendInput, {Shift Up}
	} ButtonCount = 0
} Return
#If
;<========================================== END ==============================================>

Last edited by PipeDreams on 02 May 2017, 08:43, edited 5 times in total.
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

24 Apr 2017, 00:03

thx . what about the i wan a button to be hold when i click the macro button and the button to be released when i release the macro button . for example , i hold G and right click will also be held and when i release the G button the Right click will be released too. part ?
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

24 Apr 2017, 00:13

cant find that in the script u gave
User avatar
PipeDreams
Posts: 165
Joined: 19 Dec 2015, 00:20

Re: help meee

24 Apr 2017, 01:16

bryantan179 wrote:thx . what about the i wan a button to be hold when i click the macro button and the button to be released when i release the macro button . for example , i hold G and right click will also be held and when i release the G button the Right click will be released too. part ?
cant find that in the script u gave
Yes it is, take a look at the V Hotkey.

Code: Select all

*$~v:: ;Combines one key into two or more.
{	SendInput, {e DownTemp}
	KeyWait, v ;Wait for V up first, then E will come up.
	SendInput, {e Up}
} Return
Here's what you asked for.
Spoiler
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

24 Apr 2017, 01:36

how do i put that into the script ? if i hold G the right click will all be held and i release it the right click release at same time too ?

$G::
Loop, 2
{
if GetKeyState("G", "p")
break
Send {5 Down}
Sleep 10
Send {Space Down}
Sleep 10
Send {Space Up}
Sleep 10
Send {F down}
Sleep 10
Send {Space down}
Sleep 10
Send {F Up}
Sleep 10
Send {Space Up}
Sleep 10
Send {5 Up}
Sleep 10
}
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}
return
User avatar
PipeDreams
Posts: 165
Joined: 19 Dec 2015, 00:20

Re: help meee

24 Apr 2017, 02:00

bryantan179 wrote:how do i put that into the script ? if i hold G the right click will all be held and i release it the right click release at same time too ?

$G::
Loop, 2
{
if GetKeyState("G", "p")
break
Send {5 Down}
Sleep 10
Send {Space Down}
Sleep 10
Send {Space Up}
Sleep 10
Send {F down}
Sleep 10
Send {Space down}
Sleep 10
Send {F Up}
Sleep 10
Send {Space Up}
Sleep 10
Send {5 Up}
Sleep 10
}
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}
return

I'm not sure what you are asking for sorry. Do you want keys 5, Space, and F, to fire as well as the right mouse? maybe you can use one of these?

Code: Select all

$g::
{	SendInput, {5 Down}
	Sleep 10
	SendInput, {Space Down}
	Sleep 10
	SendInput, {Space Up}
	Sleep 10
	SendInput, {F down}
	Sleep 10
	SendInput, {Space down}
	Sleep 10
	SendInput, {F Up}
	Sleep 10
	SendInput, {Space Up}
	Sleep 10
	SendInput, {5 Up}
	Sleep 10
	SendInput, {RButton Down}
	KeyWait, g ;Wait for g up first, then Right Mouse will come up.
	SendInput, {RButton Up}
} Return

Code: Select all

*$~g:: ;Combines one key into two or more.
{	SendInput, {D DownTemp}
	Sleep 10
	SendInput, {Space DownTemp}
	Sleep 10
	SendInput, {RButton DownTemp}
	KeyWait, g ;Wait for g up first, then Right Mouse will come up.
	Sleep 10
	SendInput, {D Up}
	Sleep 10
	SendInput, {Space Up}
	Sleep 10
	SendInput, {RButton Up}
} Return
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

24 Apr 2017, 02:25

what i wan is when i hold the G button , it will send some keys down and also hold the right click button , then when i release the G button the right click will also be released . for example i hold G for 5 seconds it will send ''5 f 5 f 5 f ...'' and also hold right click for 5 second.that means right click will be held until i release the G button
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

24 Apr 2017, 06:09

yes this is correct but it only click the following keys once . how can i make it spam as long as i hold G button ?
$g::
{ SendInput, {5 Down}
Sleep 10
SendInput, {Space Down}
Sleep 10
SendInput, {Space Up}
Sleep 10
SendInput, {F down}
Sleep 10
SendInput, {Space down}
Sleep 10
SendInput, {F Up}
Sleep 10
SendInput, {Space Up}
Sleep 10
SendInput, {5 Up}
Sleep 10
SendInput, {RButton Down}
KeyWait, g ;Wait for g up first, then Right Mouse will come up.
SendInput, {RButton Up}
} Return
User avatar
PipeDreams
Posts: 165
Joined: 19 Dec 2015, 00:20

Re: help meee

24 Apr 2017, 09:37

Like this?

Code: Select all

#MaxHotkeysPerInterval 200
#SingleInstance Force
#Persistent
#NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
~$*g::
{	SendInput, {RButton Down}
	SetTimer, Spam, 10 ;1000 = 1sec.
	KeyWait, g ;Wait for g up first, then Right Mouse will come up.
	SetTimer, Spam, OFF
	SendInput, {RButton Up}
} Return
Spam:
{	SendInput, {5 Down}
	Sleep 10
	SendInput, {Space Down}
	Sleep 10
	SendInput, {Space Up}
	Sleep 10
	SendInput, {F down}
	Sleep 10
	SendInput, {Space down}
	Sleep 10
	SendInput, {F Up}
	Sleep 10
	SendInput, {Space Up}
	Sleep 10
	SendInput, {5 Up}
	Sleep 10
	;SoundBeep, 200, 50 ;for testing
} Return
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

25 Apr 2017, 06:55

Here is my 2 scripts that i made with your help:
but it is not good enough because when i hold capslock , it will also hold right click and i manually hold right click and my character in game still hold right click but when i release capslock and i still remain holding right click manually , my character in game stops holding right click . what should i add to make my character in game remain holding right click when i release capslock while still holding right click manually ?





#MaxHotkeysPerInterval 200
#SingleInstance Force
#Persistent
#NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
~$*Capslock::
{ SendInput, {RButton Down}
SetTimer, Spam, 0 ;1000 = 1sec.
KeyWait, Capslock ;Wait for b up first, then Right Mouse will come up.
SetTimer, Spam, OFF
SendInput, {RButton Up}
} Return
Spam:
{ SendInput, {4 Down}
Sleep 10
SendInput, {Space Down}
Sleep 10
SendInput, {Space Up}
Sleep 10
SendInput, {d down}
Sleep 10
SendInput, {Space down}
Sleep 10
SendInput, {d Up}
Sleep 10
SendInput, {Space Up}
Sleep 10
SendInput, {4 Up}
Sleep 10
} Return




and



#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input

~$*CapsLock::
{ SendInput, {RButton Down}
SetTimer, Spam, 0 ;1000 = 1sec.
KeyWait, CapsLock ;Wait for b up first, then Right Mouse will come up.
SetTimer, Spam, OFF
SendInput, {RButton Up}
} Return

Spam:
;ensuring that the player doesn't interfere with the macro
Send {SC011 Up} ;W
Send {SC01E Up} ;A
Send {SC01F Up} ;S
Send {SC020 Up} ;D
Send {SC021 Up} ;F
Loop
{
if not GetKeyState("CapsLock","P")
break
Send {Space Down}
DllCall("Sleep","UInt",16.1)
Send {Space Up}
DllCall("Sleep","UInt",16.1)
Send {Space Down}
DllCall("Sleep","UInt",16.1)
Send {Space Up}
DllCall("Sleep","UInt",16.1)
Send {Space Down}
DllCall("Sleep","UInt",16.1)
Send {Space Up}
DllCall("Sleep","UInt",16.1)
Send {4 Down}
DllCall("Sleep","UInt",16.1)
Send {4 Up}
DllCall("Sleep","UInt",16.1)
Send {SC020 Down}
DllCall("Sleep","UInt",16.1)
Send {Space Down}
DllCall("Sleep","UInt",16.1)
Send {SC020 Up}
DllCall("Sleep","UInt",16.1)
Send {Space Up}
DllCall("Sleep","UInt",16.1)
;ensuring that the macro doesn't interfere with the player
if GetKeyState("SC011","P")
Send {SC011 Down}
if GetKeyState("SC01E","P")
Send {SC01E Down}
if GetKeyState("SC01F","P")
Send {SC01F Down}
if GetKeyState("SC020","P")
Send {SC020 Down}
if GetKeyState("SC021","P")
Send {SC021 Down}
DllCall("kernel32.dll\Sleep", "UInt", 10)
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}
}
return
bryantan179
Posts: 74
Joined: 29 Mar 2017, 01:55

Re: help meee

28 Apr 2017, 03:22

when i hold the b button , it spams "b
3s b3bs b b b b3bs b b b b3bs b b b 3bsb b b b 3bsb b b b3b b b b3sb bb b b3sb bs bb b b3bs b b b b3bs b 3s
b b3bsb b b b3bs bb b b3bs b" . what should i do to make it spam only the keys in the script in other words it remove the ''b'' letter ? it should spam only '' 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s 3s "







#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input

~$*b::
{ SendInput, {RButton Down}
SetTimer, Spam, 0 ;1000 = 1sec.
KeyWait, b ;Wait for b up first, then Right Mouse will come up.
SetTimer, Spam, OFF
SendInput, {RButton Up}
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}

} Return

Spam:
;ensuring that the player doesn't interfere with the macro
Send {SC011 Up} ;W
Send {SC01E Up} ;A
Send {SC01F Up} ;S
Send {SC020 Up} ;D
Send {SC021 Up} ;F
Loop
{
if not GetKeyState("b","P")
break
Send {Space Down}
DllCall("Sleep","UInt",12)
Send {Space Up}
DllCall("Sleep","UInt",12)
Send {Space Down}
DllCall("Sleep","UInt",12)
Send {Space Up}
DllCall("Sleep","UInt",12)
Send {Space Down}
DllCall("Sleep","UInt",12)
Send {Space Up}
DllCall("Sleep","UInt",12)
Send {3 Down}
DllCall("Sleep","UInt",12)
Send {3 Up}
DllCall("Sleep","UInt",12)
Send {SC01F Down}
DllCall("Sleep","UInt",12)
Send {Space Down}
DllCall("Sleep","UInt",12)
Send {SC01F Up}
DllCall("Sleep","UInt",12)
Send {Space Up}
DllCall("Sleep","UInt",12)
;ensuring that the macro doesn't interfere with the player
if GetKeyState("SC011","P")
Send {SC011 Down}
if GetKeyState("SC01E","P")
Send {SC01E Down}
if GetKeyState("SC01F","P")
Send {SC01F Down}
if GetKeyState("SC020","P")
Send {SC020 Down}
if GetKeyState("SC021","P")
Send {SC021 Down}
DllCall("kernel32.dll\Sleep", "UInt", 0)
if GetKeyState("RButton","P")
Send {Click Right Down}
else
Send {Click Right Up}
}
return

$*Ins::Suspend

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 40 guests