Help with code

Ask gaming related questions
BigLion
Posts: 6
Joined: 10 Oct 2018, 07:36

Help with code

10 Oct 2018, 08:15

Hi,
i found those scripts on this forum and i put all together

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir, % A_ScriptDir
#SingleInstance, Force

toggle = 0
#MaxThreadsPerHotkey 2

F2::
	toggle:=!toggle
	while (toggle)
	{
		sleep,200
		send, r
	}
Return

~$3::
    while GetKeyState("3","P")
    {
        Send {LButton}
	sleep 10
    }
return

~$4::
    while GetKeyState("4","P")
    {
        Send {RButton}
	sleep 10
    }
return
is this correct? or i should write in a better way?
If anyone can help ill appreciate it.

Regards
Onimuru
Posts: 35
Joined: 08 Sep 2018, 18:35
GitHub: Onimuru

Re: Help with code

10 Oct 2018, 16:51

Here you go:

Code: Select all

#NoEnv
#SingleInstance Force
SetWorkingDir, % A_ScriptDir
SendMode Input
CoordMode, Mouse, Screen

If !A_IsAdmin	;Always run your script as admin.
{
	Run *RunAs "%A_ScriptFullPath%"
	ExitApp
}

Exit	;End auto-execute section.

;----------; Labels/Functions ;----------;

Toggle_Loop:
	Send r
	Return

;----------; Hotkeys ;----------;

#If WinActive(A_ScriptName)	;If script is open in editor.
~^s::
	Sleep 200
	Reload
	Return

Esc::ExitApp
#If	;End if.

F2::SetTimer, Toggle_Loop, % ((Toggle_Variable := !Toggle_Variable) ? "200" : "Off")	;Toogle on/off with a 200ms delay.

~$3::
	KeyWait, 3, T0.250	;Optional, make sure 3 is actually being held down.
	If ErrorLevel
	{
		While GetKeyState("3", "P")
		{
			Click
			Sleep 10
		}
	}
	Return

~$4::
	KeyWait, 4, T0.250
	If ErrorLevel
	{
		While GetKeyState("4", "P")
		{
			Click, , Right
			Sleep 10
		}
	}
	Return
BigLion
Posts: 6
Joined: 10 Oct 2018, 07:36

Re: Help with code

10 Oct 2018, 17:02

Amazing, thanks for the comment on the code and the help.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 14 guests