Skip to content

Instantly share code, notes, and snippets.

@641i130
Created July 29, 2022 21:12
Show Gist options
  • Save 641i130/6ec8037343f1489eb6006babfdfa2d55 to your computer and use it in GitHub Desktop.
Save 641i130/6ec8037343f1489eb6006babfdfa2d55 to your computer and use it in GitHub Desktop.
Auto mine in terraria (AKA hold down buttons)
# Terraria Button Holder
# Written by 641i130
# (DVORAK KEYBOARD LAYOUT)
import pynput
import time
pm = pynput.mouse
pk = pynput.keyboard
mc = pm.Controller()
kc = pk.Controller()
def on_press(key):
try:
pass
except AttributeError:
pass
def on_release(key):
#print('{0}'.format(key),"\r")
if key == pk.Key.delete:
# Stop listener
#print("Ecc")
return False
if key == pk.Key.right:
kc.press("e") # D
if key == pk.Key.left:
kc.press("a") # A
if key == pk.Key.up:
kc.press(",") # W
if key == pk.Key.backspace:
mc.press(pm.Button.left)
# Collect events until released
with pynput.keyboard.Listener(on_press=on_press,on_release=on_release) as listener:
listener.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment