I'm trying to build a macro for a fighting game and I think I'm going about this the wrong way. Can I store these series of actions as their own objects? I have it set up to perform the series of keys to perform a skill but what if I want to combine the skills with a single hotkey? Like:
keyboard.is_pressed('1'):
Skill1(), Skill2()
This is my code;
def Skills():
while True:
#Skill 1
if keyboard.is_pressed('1'):
keyboard.press_and_release("q")
time.sleep(0.1)
keyboard.press_and_release("q")
time.sleep(0.1)
keyboard.press_and_release("q")
time.sleep(0.1)
keyboard.press_and_release("r")
time.sleep(0.1)
keyboard.press_and_release("d")
#Skill 2
if keyboard.is_pressed('2'):
keyboard.press_and_release("e")
time.sleep(0.1)
keyboard.press_and_release("e")
time.sleep(0.1)
keyboard.press_and_release("e")
time.sleep(0.1)
keyboard.press_and_release("r")
time.sleep(0.1)
keyboard.press_and_release("d")
Skills()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…