Key Duplicate Error

Ask gaming related questions (AHK v1.1 and older)
Altug
Posts: 3
Joined: 14 Aug 2022, 11:34

Key Duplicate Error

Post by Altug » 14 Aug 2022, 11:42

I found an autoclicker and fastplacer for minecraft on internet. If autoclicker is assigned to V and fastplacer assigned to X it works perfectly, but i want to assign them to one key. But if i do it i get Hotkey Duplicate Error, I want to assign them to only V but i cant do it. I need your help. There is the code:

Code: Select all

;Autoclicker
V::Hotkey, *LButton, Toggle
*LButton::
Send,{LButton}
While GetKeyState("LButton", "P")
{
Send,{LButton}
Random, delay, %Min%, %Max%
Sleep %delay%
}
return

;FastPlace
X::Hotkey, *RButton, Toggle
*RButton::
Send,{RButton}
While GetKeyState("RButton", "P")
{
Send,{RButton}
Random, delay, %MinBuild%, %MaxBuild%
Sleep %delay%
}
return

User avatar
mikeyww
Posts: 26598
Joined: 09 Sep 2014, 18:38

Re: Key Duplicate Error

Post by mikeyww » 14 Aug 2022, 12:30

Welcome to this AutoHotkey forum!

Code: Select all

min      = 15
max      = 150
minBuild = 15
maxBuild = 150

v::
Hotkey, ~*LButton, Toggle
Hotkey, ~*RButton, Toggle
SoundBeep, 1500
Return

~*LButton::
SoundBeep, 1000
While GetKeyState("LButton", "P") {
 Click
 Random, delay1, min, max
 Sleep , delay1
}
SoundBeep, 900
Return

~*RButton::
SoundBeep, 1900
While GetKeyState("RButton", "P") {
 Click, R
 Random, delay2, minBuild, maxBuild
 Sleep , delay2
}
SoundBeep, 900
Return

Altug
Posts: 3
Joined: 14 Aug 2022, 11:34

Re: Key Duplicate Error

Post by Altug » 14 Aug 2022, 13:28

@mikeyww
Thanks for your great welcoming, i dont know much about autohotkey but this is the all code

Code: Select all

Hotkey, *LButton, Toggle
Hotkey, *RButton, Toggle

Gui, Add, Tab, x2 y-1 w297 h225 , About|Autoclicker|FastPlace|Help|Credits
Gui, Tab, About
Gui, Font, S30 CDefault, Impact
Gui, Add, Text, x65 y70 w200 h70 , ahkClicker
Gui, Font, S20 CDefault, Verdana
Gui, Add, Text, x65 y110 w200 h40 , Formerly Tap
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x5 y205 w210 h17 , Version: 2.0
Gui, Tab, Autoclicker
Gui, Add, Text, x10 y29 w277 h20 , Minimum Delay (milliseconds)
Gui, Add, Slider, x10 y49 w277 h30 vMin gMin ToolTip Range0-500, 21
Gui, Add, Text, x10 y89 w277 h20 , Maximum Delay (milliseconds)
Gui, Add, Slider, x10 y109 w277 h30 vMax gMax ToolTip Range0-500, 116
Gui, Tab, FastPlace
Gui, Add, Text, x10 y29 w277 h20 , Minimum Delay (milliseconds)
Gui, Add, Slider, x10 y49 w277 h30 vMinBuild gMinBuild ToolTip Range0-500, 25
Gui, Add, Text, x10 y89 w277 h20 , Maximum Delay (milliseconds)
Gui, Add, Slider, x10 y109 w277 h30 vMaxBuild gMaxBuild ToolTip Range0-500, 62
Gui, Tab, Help
Gui, Add, Text, x12 y29 w220 h30 , Autoclicker Toggle: V
Gui, Add, Text, x12 y49 w220 h30 , Autoclicker Use: Hold Left Click
Gui, Add, Text, x12 y69 w220 h30 , FastPlace Toggle: X
Gui, Add, Text, x12 y89 w220 h30 , FastPlace Use: Hold Right Click
Gui, Add, Text, x12 y129 w220 h32 , You can change these keys in the script. (exmaples below)
Gui, Add, Text, cBlue gAExample, Autoclicker Hotkey Example (click)
Gui, Add, Text, cBlue gFExample, FastPlace Hotkey Example (click)
Gui, Tab, Credits
Gui, Add, Text, cBlue gWebsite, Website (click)
Gui, Add, Text, cBlue gSource, Source code (click)
;string:RXIoGYvt39c2skj8UnTy
Gui, Show, x50 y50 h225 w300, nTyoGTIoG584DXyRXIskj
Gui, Submit, NoHide
Return

Min:
{
Gui, Submit, NoHide
}
return

Max:
{
Gui, Submit, NoHide
}
return

MinBuild:
{
Gui, Submit, NoHide
}
return

MaxBuild:
{
Gui, Submit, NoHide
}
return

;Autoclicker
V::Hotkey, *LButton, Toggle
*LButton::
Send,{LButton}
While GetKeyState("LButton", "P")
{
Send,{LButton}
Random, delay, %Min%, %Max%
Sleep %delay%
}
return

;FastPlace
X::Hotkey, *RButton, Toggle
*RButton::
Send,{RButton}
While GetKeyState("RButton", "P")
{
Send,{RButton}
Random, delay, %MinBuild%, %MaxBuild%
Sleep %delay%
}
return

AExample:
run https://gyazo.com/1a92e27086d312400bf62735adc21f73
return

FExample:
run https://gyazo.com/57a6b2b6c6d471aee47e9bfbd30e9733
return

Website:
run https://tapclient.weebly.com
return

Source:
run https://gist.github.com
return

GuiClose:
ExitApp

may you please edit it on here

User avatar
mikeyww
Posts: 26598
Joined: 09 Sep 2014, 18:38

Re: Key Duplicate Error

Post by mikeyww » 14 Aug 2022, 13:49

You can change the V hotkey routine so that it toggles two hotkeys instead of just one. You can use the example of that from my script if you like. My V hotkey routine starts on line 6. You would delete your V hotkey routine and use this one instead. Delete the tilde characters there if your button hotkeys will not include a tilde.

You can click on commands and functions in your posted script to learn more about them.

Explained: Hotkey

Altug
Posts: 3
Joined: 14 Aug 2022, 11:34

Re: Key Duplicate Error

Post by Altug » 14 Aug 2022, 14:25

When i use your hotkey routine i get the error: the same variable cannot be used for more than one control. I really dont know what do to

User avatar
mikeyww
Posts: 26598
Joined: 09 Sep 2014, 18:38

Re: Key Duplicate Error

Post by mikeyww » 14 Aug 2022, 14:40

So far, you have not posted any scripts that generate error messages when they are run. You can post your revised script below.

Post Reply

Return to “Gaming Help (v1)”