I am creating a bot that should always press W, Shift, and F. Then it should press A for 63 seconds, sleep for 63 seconds, and during those 63 seconds, D should be pressed. This should repeat for 19 rounds, with D being pressed for 10 rounds and A being pressed for 9 rounds. At the end of the 19 rounds, the bot should manually go into chat and execute the command /garden. I have timed it so that this command should be written every 1198 seconds. However, nothing is working. I am seeking help, please help me. The code before the #*** section is not mine; I saw it in a video where it worked. I don’t know what I did wrong, please help me.
import time
from threading import Thread
SendInput = ctypes.windll.user32.SendInput
# C struct redefinitions
PUL = ctypes.POINTER(ctypes.c_ulong)
class KeyBdInput(ctypes.Structure):
_fields_ = [("wVk", ctypes.c_ushort),
("wScan", ctypes.c_ushort),
("dwFlags", ctypes.c_ulong),
("time", ctypes.c_ulong),
("dwExtraInfo", PUL)]
class HardwareInput(ctypes.Structure):
_fields_ = [("uMsg", ctypes.c_ulong),
("wParamL", ctypes.c_short),
("wParamH", ctypes.c_ushort)]
class MouseInput(ctypes.Structure):
_fields_ = [("dx", ctypes.c_long),
("dy", ctypes.c_long),
("mouseData", ctypes.c_ulong),
("dwFlags", ctypes.c_ulong),
("time",ctypes.c_ulong),
("dwExtraInfo", PUL)]
class Input_I(ctypes.Union):
_fields_ = [("ki", KeyBdInput),
("mi", MouseInput),
("hi", HardwareInput)]
class Input(ctypes.Structure):
_fields_ = [("type", ctypes.c_ulong),
("ii", Input_I)]
# Actuals Functions
def PressKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput( 0, hexKeyCode, 0x0008, 0, ctypes.pointer(extra) )
x = Input( ctypes.c_ulong(1), ii_ )
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
def ReleaseKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput( 0, hexKeyCode, 0x0008 | 0x0002, 0, ctypes.pointer(extra) )
x = Input( ctypes.c_ulong(1), ii_ )
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
#***********************************************************************************************
#Allways Walk, Sneak, Break
def W(): # Walk
while True:
PressKey(17) #W
def F(): # Break
while True:
PressKey(33) #F
def Shift(): # Sneaken
while True:
PressKey(42) # Shift
#***********************************************************************************************
def Left():
for 1 in range(9):
time.sleep(63)
PressKey(30) # Left (A)
def Right():
for 1 in range(10):
PressKey(32) # Right (B)
time.sleep(63)
def Home(): # /warp Garden
while True:
time.sleep(1197)
PressKey(20) #T
PressKey(53) #/
PressKey(17) #W
PressKey(30) #A
PressKey(19) #R
PressKey(25) #P
PressKey(57) #Space
PressKey(30) #G
PressKey(30) #A
PressKey(19) #R
PressKey(30) #D
PressKey(18) #E
PressKey(49) #N
PressKey(30) #Enter
#***********************************************************************************************
# Create threads
thread1 = Thread(target=W)
thread2 = Thread(target=F)
thread3 = Thread(target=Shift)
thread4 = Thread(target=Left)
thread5 = Thread(target=Right)
thread6 = Thread(target=Home)
#***********************************************************************************************
# Start threads
thread1.start()
thread2.start()
thread3.start()
thread4.start()
thread5.start()
thread6.start()
#***********************************************************************************************