Making an id system for controlclick to run in background

Ask gaming related questions
Apollo11cz
Posts: 1
Joined: 28 Apr 2021, 11:50

Making an id system for controlclick to run in background

Post by Apollo11cz » 03 May 2021, 04:21

Hey, I'm trying to make an id system to select any window and for control-click to send clicks to that window.
I'm pretty new to ahk and I was learning from a Minecraft clicker created by xisumavoid, I'm gonna post both codes here.
I tried to copy it, but it didn't work.
Hope that I posted everything, thanks in advance.

My code:

Code: Select all

#NoEnv
#SingleInstance Force
wintitle := Roblox Shindo life afk farm
targettitle := none
targetwinclass := GLFW30
ModeText := Empty
id := 0
ProgState := 0
Hotkey  !^w,    SelectWindow
Menu, ProgMenu, Add, Menu, progmenu
Menu, AfkMenu, Add, AFK, menuAFK
Menu, ProgramMenu, Add, Menu, :ProgMenu
Menu, ProgramMenu, Add, Afk, :AfkMenu
Gui, Show, w500 h750, Shortcuts
Gui, Show,, Roblox Shindo life afk farm
Gui, Add, Text,, Shindo not connected
return

SelectWindow:
{
MouseGetPos, , , id, control
WinGetTitle, targettitle, ahk_id %id%
WinGetClass, targetclass, ahk_id %id%
if InStr(targetclass, targetwinclass)
Gui, destroy
Gui, Show, w500 h750
Gui, Menu, ProgramMenu
Gui, Show,, Roblox Shindo life afk farm
Gui, Add, Text,, Menu
Gui, Add, Text,, Shindo connected
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
return
}

progmenu:
{
Gui, destroy
Gui, Show, w500 h750
Gui, Menu, ProgramMenu
Gui, Show,, Roblox Shindo life afk farm
Gui, Add, Text,, Menu
Gui, Add, Text,, Shindo connected
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
return
}

menuAFK:
{
Hotkey  !^s,    Click
Gui, destroy
Gui, Show, w500 h750,
Gui, Menu, ProgramMenu
Gui, Show,, Roblox Shindo life afk farm
Gui, Add, Text,, Afk menu
Return
}

Click:
{
loop
{
sleep 1s
ControlClick, ,ahk_id %id%, ,Left, , NA
}
return
}

GuiClose:
ExitApp
xisuma's code:

Code: Select all

#NoEnv
SetBatchLines -1
SetTitleMatchMode 2
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
wintitle := Minecraft X-AHK V0.4
targettitle := none
targetwinclass := GLFW30
ModeText := Empty
id := 0
ProgState := 0
Hotkey	!^f,	Fishing
Hotkey  !^e,	JumpFly
Hotkey  !^c,	Concrete
Hotkey  !^m,	MobGrind
Hotkey	!^s,	Stop
Hotkey  !^w,    SelectWindow
Menu, FileMenu, Add, Open, MenuFileOpen
Menu, FileMenu, Add, Exit, MenuHandler
Menu, HelpMenu, Add, About, MenuHandler
Menu, OptionsMenu, Add, Fishing, MenuFishing
Menu, OptionsMenu, Add, AFK Mob, MenuAFK
Menu, OptionsMenu, Add, Concrete, MenuConcrete
Menu, OptionsMenu, Add, JumpFlying, MenuJumpFly
Menu, ClickerMenu, Add, File, :FileMenu
Menu, ClickerMenu, Add, Help, :HelpMenu
Menu, ClickerMenu, Add, Options, :OptionsMenu
if %ProgState% != 0
Return
Gui, Show, w300 h300, Shortcuts
Gui, Add, Pic, w280 h290 vpic_get, welcomepic.png
Gui, Show,, Minecraft X-AHK V0.4
return
SelectWindow:
{
MouseGetPos, , , id, control
WinGetTitle, targettitle, ahk_id %id%
WinGetClass, targetclass, ahk_id %id%
if InStr(targetclass, targetwinclass)
{
ProgState = 1
Gui, Destroy
Gui, Show, w500 h500, Temp
Gui, Menu, ClickerMenu
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
Gui, Add, Text,, To change mode of opperation please select from Option menu.
Gui, Add, Text,, MODE:
Gui, Add, Text, vMode w30, None
Gui, Show,, Minecraft X-AHK V0.4
ControlClick, , ahk_id %id%, ,Right, , NAU
ControlClick, , ahk_id %id%, ,Left, ,NAU
sleep 500
}
Else
{
MsgBox, You do not seam to have selected a Minecraft window. Please check before you continue.
}
Return
}
MenuFileOpen:
{
ModeText := JumpFlying
GuiControl,,Mode, %ModeText%
Return
}
MenuHandler:
{
Return
}
MenuFishing:
{
BreakLoop := 1
Gui, Destroy
Gui, Show, w500 h500, Temp
Gui, Menu, ClickerMenu
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
Gui, Add, Text,, o- Pressing ctrl + alt + f will start fishing
Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
Gui, Add, Text,,
Gui, Add, Slider, vMySlider w200 ToolTip Range0-1000 TickInterval100, 500
Gui, Show,, Minecraft X-AHK V0.4
ProgState := 2
Return
}
MenuAFK:
{
BreakLoop := 1
Gui, Destroy
Gui, Show, w500 h500, Temp
Gui, Menu, ClickerMenu
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
Gui, Add, Text,, o- Pressing ctrl + alt + m will start Mod Grinding
Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
Gui, Show,, Minecraft X-AHK V0.4
ProgState := 4
Return
}
MenuConcrete:
{
BreakLoop := 1
Gui, Destroy
Gui, Show, w500 h500, Temp
Gui, Menu, ClickerMenu
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
Gui, Add, Text,, o- Pressing ctrl + alt + c will start concrete farming
Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
Gui, Show,, Minecraft X-AHK V0.4
ProgState := 3
Return
}
MenuJumpFly:
{
BreakLoop := 1
Gui, Destroy
Gui, Show, w500 h500, Temp
Gui, Menu, ClickerMenu
Gui, Add, Text,, Target Window Title : %targettitle%
Gui, Add, Text,, Windows HWIND is : %id%
Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
Gui, Add, Text,, o- Pressing ctrl + alt + e will dubble hit space and fire a rocket in main hand
Gui, Show,, Minecraft X-AHK V0.4
ProgState := 1
Return
}
JumpFly:
{
if (ProgState != 1)
Return
Sleep 500
Send {Space down}
Sleep 75
Send {Space up}
Sleep 200
Send {Space down}
Sleep 75
Send {Space up}
Sleep 50
ControlClick, , ahk_id %id%, ,Right, , NAD
Sleep 100
ControlClick, , ahk_id %id%, ,Right, , NAU
Return
}
Concrete:
{
if (ProgState != 3)
Return
BreakLoop := 0
ControlClick, , ahk_id %id%, ,Right, , NAD
Sleep 500
ControlClick, , ahk_id %id%, ,Left, , NAD
sleep 100
While (BreakLoop = 0)
{
if BreakLoop = 1)
{
sleep 10
}
}
ControlClick, , ahk_id %id%, ,Left, , NAU
Sleep 100
ControlClick, , ahk_id %id%, ,Right, , NAU
Return
}
Fishing:
{
if (ProgState != 2)
Return
BreakLoop := 0
Loop
{
if (BreakLoop = 1)
{
BreakLoop := 0
break
}
Sleep 100
ControlClick, , ahk_id %id%, ,Right, , NAD
Sleep 500
ControlClick, , ahk_id %id%, ,Right, , NAU
}
Return
}
MobGrind:
{
if (ProgState != 4)
Return
BreakLoop := 0
Delay := 0
Sleep 500
While (BreakLoop = 0)
{
ControlClick, , ahk_id %id%, ,Right, , NAD
if (BreakLoop = 1)
{
ControlClick, , ahk_id %id%, ,Right, , NAU
Return
}
Sleep 100
if (Delay >= 12)
{
Delay := 0
sleep 50
ControlClick, , ahk_id %id%, ,Left, ,NAD
Sleep 50
ControlClick, , ahk_id %id%, ,Left, ,NAU
}
else
Delay++
}
Sleep 100
ControlClick, , ahk_id %id%, ,Right, , NAU
ControlClick, , ahk_id %id%, ,Left, ,NAU
Return
}
Stop:
{
BreakLoop := 1
ControlClick, , ahk_id %id%, ,Right, , NAU
ControlClick, , ahk_id %id%, ,Left, ,NAU
sleep 500
return
}
ESC:
GuiClose:
GuiEscape:
ExitApp
Last edited by Apollo11cz on 03 May 2021, 04:45, edited 2 times in total.

Rohwedder
Posts: 4364
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Making an id system for controlclick to run in background

Post by Rohwedder » 07 May 2021, 17:05

Hallo,
I cannot see any code! Better use the code box: [​code][​/code]


Last bumped by Apollo11cz on 07 May 2021, 17:05.

Post Reply

Return to “Gaming”