I'll use this daily +rep
awesome work.
I added this to make it stop after X games:
After screenGrab() definition:
Code:
currentGame = 1
maxGames = 5
print "Will play %s games" % maxGames
And at the end of replay() (inside):
Code:
if 7000 < b < 8000:
mousePos(replaybutton)
time.sleep(2)
click()
global currentGames
print "Game Number %s Completed" % currentGames
currentGames = currentGames + 1
if currentGames <= maxGames:
time.sleep(1.5)
go()
else:
print "Played %s games." % maxGames
sys.exit(0)
else:
pass
I don't know where they are but you should probably increase the times between movements a bit for when sudden combos happen and you cant click the screen (those "supernatural" and "fiendishly clever" things).
-------------------------
About an alternative for CTRL+ALT+DEL, that would be signal handlers.
Code:
import signal
import sys
def signal_handler(signal, frame):
print 'Ctrl+C detected'
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
print 'Infinite loop, pres CTRL+C to stop program'
while True:
continue
Inside signal_handler() you would close the program cleanly.
This wont work though, since you lose focus of the python shell. (You would still have to quickly press the shell and then CTRL + C, better than CTRL+ALT+DEL still)