Script for Minecraft :)

Ask gaming related questions (AHK v1.1 and older)
MamieSeen
Posts: 4
Joined: 14 May 2024, 16:56

Script for Minecraft :)

14 May 2024, 17:02

Hello to you !

I would like to have a little help from you, I would like a script for the game Minecraft which allows that when I activate it ("P"), the player moves forward and sprints constantly ("A" and "Z") and the mouse moves to the right while looking at the sky, add to that, every 12 seconds, the "X" key executes.

I don't know if I was clear, but thank you!
User avatar
mikeyww
Posts: 27215
Joined: 09 Sep 2014, 18:38

Re: Script for Minecraft :)

14 May 2024, 20:37

Welcome to this AutoHotkey forum! Ideas are below; adjust as needed.

Code: Select all

#Requires AutoHotkey v1.1.33.11
#MaxThreadsPerHotkey 2
SoundBeep 2500
SetKeyDelay 25, 25
SLOW := 0

p::
If on := !on {
 SetTimer X, 12000
 Loop {
  SendEvent az
  MouseMove 15, 0, SLOW, R
 }
} Else Reload
Return

X:
SendEvent x
Return
If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.
MamieSeen
Posts: 4
Joined: 14 May 2024, 16:56

Re: Script for Minecraft :)

15 May 2024, 01:51

@mikeyww

Hi ! Thank you for the welcome :)

Thanks for the script :) Just, the "A" and "Z" keys are not held down, I would like this to remain until the script is deactivated.

I also want to add a permanent left click if possible.

You could add notes on almost each line so that I understand how it works and its usefulness, the goal is also to learn, that interests me :)
User avatar
mikeyww
Posts: 27215
Joined: 09 Sep 2014, 18:38

Re: Script for Minecraft :)

15 May 2024, 05:20

While the LButton is held, I think that the X is unlikely to be triggered or to be visible (I'm not sure which). Adjust to get what you want.

Code: Select all

#Requires AutoHotkey v1.1.33.11
#MaxThreadsPerHotkey 2
SLOW := 0 ; Speed of moving mouse cursor (0=fastest, 100=slowest)

p::
If !on := !on {                     ; Toggle off
 SetTimer X, Off
 SetTimer Move, Off
 Send {LButton up}{z up}{a up}      ; Reset
 SoundBeep 1000
 Return
}
; Toggle on
Send {a down}{z down}{LButton down}
SetTimer X, 12000                   ; Call subroutine whenever timer expires
SetTimer Move, 50
Move:
MouseMove 15, 0, SLOW, R            ; Move the mouse cursor 15 pixels to the right
Return

X:
SetKeyDelay 25, 25                  ; Delay and press duration (ms)
SendEvent x                         ; Send a key
Return
MamieSeen
Posts: 4
Joined: 14 May 2024, 16:56

Re: Script for Minecraft :)

15 May 2024, 06:00

@mikeyww

Oh ! Okay thanks you :)


If I want to add a system that ensures that every 5 seconds the t-chat opens with the "T" key then it says "/hub" then the enter key? While deactivating the functionality of the "p" key for the time to make the command, then does it reactivate?
User avatar
mikeyww
Posts: 27215
Joined: 09 Sep 2014, 18:38

Re: Script for Minecraft :)

15 May 2024, 06:29

You can test these things to see what happens. Add a timer, add a Send command, etc.
MamieSeen
Posts: 4
Joined: 14 May 2024, 16:56

Re: Script for Minecraft :)

15 May 2024, 06:33

Okay, but how can I disable and re-enable the script?

The X key also doesn't work
User avatar
mikeyww
Posts: 27215
Joined: 09 Sep 2014, 18:38

Re: Script for Minecraft :)

15 May 2024, 07:11

I have already mentioned that keys might not be sent as you expect them to be sent while a mouse button is down or held. You can test this in Notepad to see what happens. That would be a fast way to troubleshoot your script initially. How you disable the script will depend on exactly what you want the disabling to do, and when you want it to happen.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: mikeyww and 23 guests