Created
March 3, 2025 11:02
-
-
Save williamyang98/c49346abe2ef20e48712459b97b8e92e to your computer and use it in GitHub Desktop.
Script to automate minigame for Jame's 183 pullups in Citadel DLC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pynput | |
| import threading | |
| import time | |
| class App: | |
| def __init__(self): | |
| self.is_running = True | |
| self.is_pullup = False | |
| self.pullup_thread = None | |
| self.keyboard_thread = None | |
| self.mouse = pynput.mouse.Controller() | |
| def start(self): | |
| if self.pullup_thread != None: return | |
| if self.keyboard_thread != None: return | |
| self.is_running = True | |
| self.pullup_thread = threading.Thread(target=self._pullup_runner, args=[]) | |
| self.keyboard_thread = pynput.keyboard.Listener(on_press=lambda key: self._on_press(key)) | |
| self.pullup_thread.start() | |
| self.keyboard_thread.start() | |
| def join(self): | |
| if self.pullup_thread == None: return | |
| if self.keyboard_thread == None: return | |
| self.pullup_thread.join() | |
| self.keyboard_thread.stop() | |
| self.keyboard_thread.join() | |
| self.pullup_thread = None | |
| self.keyboard_thread = None | |
| def _on_press(self, key): | |
| if key == pynput.keyboard.Key.f3: | |
| self.is_running = False | |
| self.debug(f"Exiting from keyboard thread") | |
| return False | |
| if key == pynput.keyboard.Key.f2: | |
| self.is_pullup = not self.is_pullup | |
| self.debug(f"Toggling pullup: {self.is_pullup}") | |
| return True | |
| def _pullup_runner(self): | |
| is_left_click = True | |
| total_ticks = 0 | |
| total_pullups = 0 | |
| click_rate = 5 | |
| while self.is_running: | |
| if self.is_pullup and total_ticks >= click_rate: | |
| button = pynput.mouse.Button.left if is_left_click else pynput.mouse.Button.right | |
| self.mouse.click(button) | |
| self.debug(f"Pullup {total_pullups}: {button}") | |
| total_pullups += 1 | |
| is_left_click = not is_left_click | |
| if total_ticks >= click_rate: | |
| total_ticks = 0 | |
| total_ticks += 1 | |
| time.sleep(0.1) | |
| self.debug(f"Exiting pullup thread") | |
| def debug(self, *args, **kwargs): | |
| kwargs.setdefault("flush", True) | |
| print(*args, **kwargs) | |
| def main(): | |
| app = App() | |
| app.start() | |
| app.join() | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment