'Key Function In Cfg
my software works every time I press ''VK_LBUTTON'', but it only works on that key, I would like to put in the config a function called ''key'' so I can adjust in the config to work on any key of mouse or keyboard, like I do this ?
def load_config():
print("\n[!] Loading config", end=": ")
try:
with open("config.json") as f:
cfg = json.load(f)
for weapon in weapons:
weapon["x"] = abs(cfg[weapon["name"]]["x"])
weapon["y"] = abs(cfg[weapon["name"]]["y"])
except:
print("ERROR")
return False
print("OK")
return True
def perform_control(weapon):
magazine = weapon["magazine"]
pattern = weapon["pattern"]
delay = (60 / weapon["rpm"]) - 3/1000
x = weapon["x"]
y = weapon["y"]
shot_index = 0
while win32api.GetAsyncKeyState(win32con.VK_LBUTTON) and shot_index != magazine:
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(pattern[shot_index][0] * x), int(pattern[shot_index][1] * y), 0, 0)
time.sleep(delay)
shot_index += 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|