Python: script gets stuck on Keyboard.wait()

465 Views Asked by At

So it just breaks when holding down while holding down SHIFT ALT or CTRL While the function is running, When It does break I do try tapping SHIFT ALT and CTRL to see if they are stuck down and they aren't so I'm all out of ideas.

import time
import pyautogui
import random

def feint():
    number = random.randint(1,4)
    print('1')
    if number == 1:
        pyautogui.keyDown('LEFT')
        pyautogui.mouseDown()
        pyautogui.keyUp('LEFT')
        time.sleep(0.1)
        pyautogui.keyDown('ctrl')
        pyautogui.keyUp('ctrl')
        pyautogui.mouseUp()
    if number == 2:
        #ETC

The feint2() Is just the same code twice with already used options out of play and the attack is the same as the feint() without the pyautogui.keyDown('ctrl') pyautogui.keyUp('ctrl')

import pyautogui
import random
import feinter
from attacker import attack
import keyboard

pyautogui.FAILSAFE = False

def feintmarco():
    number = random.randint(1,2)
    if number == 1:
        feinter.feint()
        print('0')
        attack()
    if number == 2:
        feinter.feint2()
        print('0')
        attack()
keyboard.add_hotkey('Num -', feintmarco)
keyboard.wait()
0

There are 0 best solutions below