Building a script to play Clicker Heroes.
If you haven't heard of Clicker Heroes then you can check it out here: http://store.steampowered.com/app/363970/Clicker_Heroes/
It is a free game that is more of a time killer than anything.
I got bored with the game pretty fast and started to wonder if I can make the computer play the game for me using python.
So I came up with the following script:
import win32api, win32con, sys
mode = sys.argv[1] #Tells what mode you want to use
clicks = int(sys.argv[2]) #Tells the numbers of clicks
clickct = 0
levelct = 0
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
if mode == '-r': # This mode will click in only one location
for _ in range(clicks):
clickct = clickct + 1
click(1300,405) #Coordinates of screen
print clickct
elif mode == '-L': # This mode will click in one location and every 100 clicks it will click a different location
for _ in range(clicks):
clickct = clickct + 1
levelct += 1
click(1305,351) #Coordinates of screen
if (levelct == 100):
click(1375,75) #Coordinates of screen
levelct = 0
print clickct
else:
print "Use -r or -L for mode"
Before you can run this script you wil need to install the win32api library using pip.
Once you have that installed. It is time to grab the coordinates of the locations you need clicked.
The script has 2 separate mode. It can click in a single area or it can click another location every 100 clicks this is useful when trying to upgrade heroes.
Once you have the coordinates of the locations that need to be clicked then place them in their areas within the script.
If you are only using the "-r" option then you only need the one location.
If you are using the "-L" option then you need to 2 locations and and you placed the second location after the if statement in the for loop.
Have fun!!
Congratulations @shadows! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Congratulations @shadows! You have received a personal award!
1 Year on Steemit
Click on the badge to view your Board of Honor.
Congratulations @shadows! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!