Hi, I created a script for MC with AHK V1 that automatically presses W, presses Space, and presses D, then after 60sec (60000) presses W, presses Space, and presses A.
The script goes that far, he only executes the two lines of code, then he only presses W and Space and no longer the D key. Actually I have more problems but first one at a time if anyone can help. So again
loop
send W,Space,D 60sec ---- W,Space,A 60sec----- Error and end?
And I use ControlSend so I can run the script and I can tab out of it. But that's another story, for later^^
I ask for help :/
Minecraft Help Pls
-
- Posts: 3
- Joined: 15 Feb 2024, 10:22
Minecraft Help Pls
Last edited by gregster on 16 Feb 2024, 12:48, edited 2 times in total.
Reason: Moved topic from 'Ich brauche Hilfe > Spiele' due to used language.
Reason: Moved topic from 'Ich brauche Hilfe > Spiele' due to used language.
-
- Posts: 3
- Joined: 16 Feb 2024, 12:48
Re: Minecraft Help Pls
It's kind of clunky but for MC I went with an approach like this. I'm 100% sure it could be written better but it works. I set it so that the F9 key runs the script. You can change the sleep 100 duration between the up and down commands to simulate longer or shorter key presses if you need your character to move in those directions more or less.
Code: Select all
F9::
Send {w down}
sleep 100
Send {w up}
sleep 100
Send {Space down}
sleep 100
Send {Space up}
sleep 100
Send {d down}
sleep 100
Send {d up}
sleep 60000
Send {w down}
sleep 100
Send {w up}
sleep 100
Send {Space down}
sleep 100
Send {Space up}
sleep 100
Send {a down}
sleep 100
Send {a up}
Return
Re: Minecraft Help Pls
One way to make it more concise:louistully wrote: ↑ I'm 100% sure it could be written better...
Code: Select all
F9::
for Each, Key in ["w","Space","d","w","Space","a"] {
Send {%Key% down}
Sleep 100
Send {%Key% up}
Sleep 100
}
return
-
- Posts: 3
- Joined: 15 Feb 2024, 10:22
Re: Minecraft Help Pls
OK, thanks in advance for the help, unfortunately I have another problem right now, namely I have the code here and it just doesn't want to execute it, it presses the Enter key but it doesn't do the rest. The script is supposed to give me a chat input with /...., but it doesn't do anything.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Code: Select all
f4::
Gui, Submit, NoHide
Loop
{
SetKeyDelay, 50
; Chat open and .....
Controlsend,, {Enter down}, ahk_pid %MCPID%
sleep 1000
WinActivate, ahk_pid %MCPID%
Controlsend,, /.........., ahk_pid %MCPID%
Controlsend,, {Enter up}, ahk_pid %MCPID%
sleep 1000
}
Re: Minecraft Help Pls
Where is MCPID defined? Do you normally hold down the Enter key while you type a slash and a bunch of dots?