-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRomRoamer.py
54 lines (41 loc) · 1.23 KB
/
RomRoamer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from pynput.keyboard import Key, Controller
from time import sleep
"""
RomRoamer: automatically wander playing with
a GBC/GBA/NDS rom (E.G. to hatch
eggs in Pokémon games or level up
a Pokémon left at the Day Care).
"""
class RomRoamer:
def __init__(self) -> None:
sys.tracebacklimit = 0
self.data = input("\nHow many times do you want to roam in a square? ")
if not self.data.isdigit():
raise ValueError("Insert a valid number.\n")
self.times = int(self.data)
def main(self) -> None:
keyboard = Controller()
sleep(3)
while self.times > 0:
# Go down
keyboard.press(Key.down)
sleep(0.8)
keyboard.release(Key.down)
# Go right
keyboard.press(Key.right)
sleep(0.8)
keyboard.release(Key.right)
# Go up
keyboard.press(Key.up)
sleep(0.8)
keyboard.release(Key.up)
# Go left
keyboard.press(Key.left)
sleep(0.8)
keyboard.release(Key.left)
self.times -= 1
if __name__ == '__main__':
RomRoamer().main()