-
-
Save cwage/8ef16ea4212b2f79fc22e123a685c385 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
from autopilot.input import Mouse | |
from autopilot.input import Keyboard | |
import random | |
import time | |
xmin = 640 | |
xmax = 720 | |
ymin = 364 | |
ymax = 404 | |
mouse = Mouse.create() | |
kbd = Keyboard.create() | |
forb = 'w' | |
lorr = 'a' | |
xto = random.randrange(xmin, xmax) | |
yto = random.randrange(ymin, ymax) | |
toggle = 1 | |
xold = 1 | |
yold = 1 | |
# time to prepare | |
time.sleep(10) | |
while 1: | |
randsleep = random.randrange(1,15) | |
randrate = random.randrange(1,5) | |
jumpchance = random.randrange(1,5) | |
jumptimes = random.randrange(1,4) | |
if (toggle): | |
# store old location and move to new | |
xold = xto | |
yold = yto | |
#print("Storing old location: ", xold, ",", yold) | |
xto = random.randrange(xmin, xmax) | |
yto = random.randrange(ymin, ymax) | |
print("Moving to new location: ", xto, ",", yto) | |
mouse.move(xto, yto, animate=True, rate=randrate) | |
else: | |
# move back to old location | |
print("Moving to prev location: ", xold, ",", yold) | |
mouse.move(xold, yold, animate=True, rate=randrate) | |
kbd.press_and_release(forb, delay=0.001) | |
kbd.press_and_release(lorr, delay=0.001) | |
if (forb is 'd'): | |
forb = 'w' | |
else: | |
forb = 's' | |
if (lorr is 'a'): | |
lorr = 'd' | |
else: | |
lorr = 'a' | |
toggle = not toggle | |
time.sleep(randsleep) | |
if (jumpchance == 1): | |
print("Jumping ", jumptimes, " times") | |
x = 1 | |
while(x <= jumptimes): | |
kbd.press_and_release('Space', delay=0.001) | |
x += 1 | |
time.sleep(random.randrange(1,5)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment