Minecraft Help Pls

Ask gaming related questions (AHK v1.1 and older)
Melodic_Pattern
Posts: 3
Joined: 15 Feb 2024, 10:22

Minecraft Help Pls

Post by Melodic_Pattern » 16 Feb 2024, 12:19

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 :/
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.
louistully
Posts: 3
Joined: 16 Feb 2024, 12:48

Re: Minecraft Help Pls

Post by louistully » 16 Feb 2024, 13:14

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
User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Minecraft Help Pls

Post by boiler » 16 Feb 2024, 22:13

louistully wrote: I'm 100% sure it could be written better...
One way to make it more concise:

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
Melodic_Pattern
Posts: 3
Joined: 15 Feb 2024, 10:22

Re: Minecraft Help Pls

Post by Melodic_Pattern » 18 Feb 2024, 10:03

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.

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
}
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Minecraft Help Pls

Post by boiler » 18 Feb 2024, 13:20

Where is MCPID defined? Do you normally hold down the Enter key while you type a slash and a bunch of dots?
Post Reply

Return to “Gaming Help (v1)”