|
3 | 3 | import time
|
4 | 4 | import sys
|
5 | 5 |
|
6 |
| -print('Press Space to begin') |
7 |
| -keyboard.wait("space") |
| 6 | +def main(): |
| 7 | + print('Press Space to begin') |
| 8 | + keyboard.wait("space") |
8 | 9 |
|
9 |
| -while (True): |
10 |
| - if keyboard.is_pressed('Esc'): |
11 |
| - print("Exiting...") |
12 |
| - sys.exit(0) |
| 10 | + while (True): |
| 11 | + if keyboard.is_pressed('Esc'): |
| 12 | + print("Exiting...") |
| 13 | + sys.exit(0) |
13 | 14 |
|
14 |
| - # Generate Int for Decision Making |
15 |
| - randInt = random.randint(0, 181) |
16 |
| - # Lowercase Letter Inputs |
17 |
| - if randInt < 52 : |
18 |
| - randInt = randInt % 26 |
19 |
| - if randInt == 7 : # Keys to avoid (history) |
20 |
| - randInt = randInt + 1 |
21 |
| - key = ord('a') + randInt |
22 |
| - keyboard.press(chr(key)) |
23 |
| - time.sleep(0.1) |
24 |
| - keyboard.release(chr(key)) |
25 |
| - # Uppercase Letter Inputs |
26 |
| - elif randInt < 104 : |
27 |
| - randInt = randInt % 26 |
28 |
| - if randInt == 14 or randInt == 18 or randInt == 21: # Keys to avoid (save, options) |
29 |
| - randInt = randInt + 1 |
30 |
| - key = ord('a') + randInt |
31 |
| - keyboard.press('shift') |
32 |
| - keyboard.press(chr(key)) |
33 |
| - time.sleep(0.1) |
34 |
| - keyboard.release('shift') |
35 |
| - keyboard.release(chr(key)) |
36 |
| - # Directions (numbers) |
37 |
| - elif randInt < 154 : |
38 |
| - randInt = randInt % 10 #Doesn't put them in order, but gets 0-9 at 5 randInt chances |
39 |
| - key = ord('0') + randInt |
40 |
| - keyboard.press(chr(key)) |
41 |
| - time.sleep(0.1) |
42 |
| - keyboard.release(chr(key)) |
43 |
| - # Exit Menus |
44 |
| - elif randInt < 169 : |
45 |
| - keyboard.press('space') |
46 |
| - time.sleep(0.1) |
47 |
| - keyboard.release('space') |
48 |
| - # Pick up Item |
49 |
| - elif randInt < 174 : |
50 |
| - keyboard.press(',') |
51 |
| - time.sleep(0.1) |
52 |
| - keyboard.release(',') |
53 |
| - # Direction at Self |
54 |
| - elif randInt < 176 : |
55 |
| - keyboard.press('.') |
56 |
| - time.sleep(0.1) |
57 |
| - keyboard.release('.') |
58 |
| - else : |
59 |
| - keyboard.press('enter') |
60 |
| - time.sleep(0.1) |
61 |
| - keyboard.release('enter') |
62 |
| - time.sleep(0.01) |
| 15 | + # Generate Int for Decision Making |
| 16 | + randInt = random.randint(0, 181) |
| 17 | + # Lowercase Letter Inputs |
| 18 | + if randInt < 52 : |
| 19 | + randInt = randInt % 26 |
| 20 | + if randInt == 7 : # Keys to avoid (history) |
| 21 | + randInt = randInt + 1 |
| 22 | + key = ord('a') + randInt |
| 23 | + keyboard.press(chr(key)) |
| 24 | + time.sleep(0.1) |
| 25 | + keyboard.release(chr(key)) |
| 26 | + # Uppercase Letter Inputs |
| 27 | + elif randInt < 104 : |
| 28 | + randInt = randInt % 26 |
| 29 | + if randInt == 14 or randInt == 18 or randInt == 21: # Keys to avoid (save, options) |
| 30 | + randInt = randInt + 1 |
| 31 | + key = ord('a') + randInt |
| 32 | + keyboard.press('shift') |
| 33 | + keyboard.press(chr(key)) |
| 34 | + time.sleep(0.1) |
| 35 | + keyboard.release('shift') |
| 36 | + keyboard.release(chr(key)) |
| 37 | + # Directions (numbers) |
| 38 | + elif randInt < 154 : |
| 39 | + randInt = randInt % 10 #Doesn't put them in order, but gets 0-9 at 5 randInt chances |
| 40 | + key = ord('0') + randInt |
| 41 | + keyboard.press(chr(key)) |
| 42 | + time.sleep(0.1) |
| 43 | + keyboard.release(chr(key)) |
| 44 | + # Exit Menus |
| 45 | + elif randInt < 169 : |
| 46 | + keyboard.press('space') |
| 47 | + time.sleep(0.1) |
| 48 | + keyboard.release('space') |
| 49 | + # Pick up Item |
| 50 | + elif randInt < 174 : |
| 51 | + keyboard.press(',') |
| 52 | + time.sleep(0.1) |
| 53 | + keyboard.release(',') |
| 54 | + # Direction at Self |
| 55 | + elif randInt < 176 : |
| 56 | + keyboard.press('.') |
| 57 | + time.sleep(0.1) |
| 58 | + keyboard.release('.') |
| 59 | + else : |
| 60 | + keyboard.press('enter') |
| 61 | + time.sleep(0.1) |
| 62 | + keyboard.release('enter') |
| 63 | + time.sleep(0.01) |
| 64 | + |
| 65 | +if __name__ == '__main__': |
| 66 | + main() |
0 commit comments