def buy(): keyboard.ReleaseAllKeys() # B keyboard.PressKey(0x30) time.sleep(0.1) keyboard.ReleaseKey(0x30) buy_list = [AKM4, DEAGLE] for scancode in ARMOR: keyboard.PressKey(scancode) time.sleep(0.1) keyboard.ReleaseKey(scancode) keyboard.PressKey(0x30) time.sleep(0.1) keyboard.ReleaseKey(0x30) for item in buy_list: for scancode in item: keyboard.PressKey(scancode) time.sleep(0.1) keyboard.ReleaseKey(scancode) for _ in range(3): keyboard.PressKey(0x30) time.sleep(0.1) keyboard.ReleaseKey(0x30)
def counter_strafe(): hold_time = 0.05 relax_time = 0.05 counter = [] wasd = [0x11, 0x1E, 0x1F, 0x20] for i in range(4): if wasd[i] in keyboard.PRESSED: keyboard.ReleaseKey(wasd[i]) counter.append(wasd[(i + 2) % 4]) if counter: for key in counter: keyboard.PressKey(key) time.sleep(hold_time) for key in counter: keyboard.ReleaseKey(key) time.sleep(relax_time)
def PressKey(hexKeyCode): keyboard.HoldKey(hexKeyCode) keyboard.ReleaseKey(hexKeyCode)
import keyboard # imports all of the keyboard commands import mouse # imports all of the mouse commands import utils # imports random utility commands # hold and releases the key with hex code 0x48 # basicly a single press keyboard.HoldKey(0x48) keyboard.ReleaseKey(0x48) # or we can wrap those 2 lines in a method ! def PressKey(hexKeyCode): keyboard.HoldKey(hexKeyCode) keyboard.ReleaseKey(hexKeyCode) # and call it a bunch of times PressKey(0x45) PressKey(0x4C) PressKey(0x4C) PressKey(0x4F) PressKey(0x20) PressKey(0x57) PressKey(0x4F) PressKey(0x52) PressKey(0x4C) PressKey(0x44) # saves the x,y coordinates of the mouse position # in a list of length 2, where the first element represents # x location and the second element the y location
minfo = midi.get_device_info(ID) print(minfo[1].decode('utf-8'), "- input -" if minfo[2] else "- output -", ID) printMIDIDeviceList() INPUT = midi.Input(1) NOTES = [36, 37, 46, 47] # Note numbers in MIDI notes KEYS = [KEYBOARD.A, KEYBOARD.S, KEYBOARD.W, KEYBOARD.D] noteToKey = dict(zip(NOTES, KEYS)) PRESS = [153, 144, 159] RELEASE = [137, 128, 143] while True: if INPUT.poll(): data = INPUT.read(1) print(data) note, stat = data[0][0][1], data[0][0][0] if note in noteToKey: key = noteToKey[note] if stat in RELEASE: # pyautogui.keyUp(key) # win32api.keybd_event(VK_CODE[key], 0,win32con.KEYEVENTF_KEYUP,0) keyboard.ReleaseKey(key) elif stat in PRESS: # pyautogui.keyDown(key) # win32api.keybd_event(VK_CODE[key], 0,0,0) keyboard.PressKey(key)
import time import ctypes import keyboard as keybd input("press enter to start") left = 0xCB up = 0xC8 right = 0xCD down = 0xD0 a = 0x1E for i in range(10): print(i) time.sleep(1) keybd.PressKey(right) for i in range(100): keybd.PressKey(a) time.sleep(0.25) keybd.ReleaseKey(a) time.sleep(0.25) print("punch") keybd.ReleaseKey(right) input("exit")
__author__ = 'Ugrend' import win32gui import keyboard import time # https://msdn.microsoft.com/en-us/library/dd375731?f=255&MSPPError=-2147217396 for keys KEY_C = 0x43 x_pixel = 1915 # X cord of pixel to look at , im looking at top right of screen in the clouds y_pixel = 213 # Y cord time.sleep(3) # give me time to get ffx in focus print "BOT STARTED" dodge_count = 0 while True: try: color = win32gui.GetPixel(win32gui.GetDC(win32gui.GetActiveWindow()), x_pixel, y_pixel) if color > 11000000: print color print "LIGHTNING" dodge_count += 1 print dodge_count keyboard.PressKey(KEY_C) time.sleep(1) keyboard.ReleaseKey(KEY_C) time.sleep(2) except: pass