Use Python to be King Glory hanging machine Brush Gold Script

Source: Internet
Author: User
principle:Because every time through the adventure model will have gold coins, and this action is very repetitive, even image recognition does not need to consider the use of procedures to replace artificial. to put it simply, repeat the following steps:Interface open to challenge level: The fall of waste are-the witch recalls "click Next" click to start entry into the challenge interface. "Click on the top right-hand corner-auto-wait for the challenge to finish" to enter the challenge completion interface. "Click on the screen to continue" into the level reward interface. "Click again to challenge" again we need a program to replace our hand-click, you can think of using the ADB tool in the Android SDK, to send a clicking command to the phone.
ADB shell input tap x y
This is the command, if executed in the cmd command line
ADB shell input TAP 500 500
Will be in the mobile phone 500,500 position simulation click. Environment Preparation: download Android's platform-tools:
http://www.androiddevtools.cn/
Visit this URL to find here
After downloading your operating system, unzip it. then configure the environment variables:
At the end of path plus the directory you extracted just now, D:\platform-tools is the directory I just unzipped. With the preceding string to be in English semicolon;
Code:Open the IDE to paste the following code:
#-*-Coding:utf-8-*-
import os from time
import sleep
repeat_times =
def tap_screen (x, y):
    os.s Ystem (' adb shell input Tap {} {} '. format (x, y))
if __name__ = = ' __main__ ': for
    I in range (repeat_times):
        if (i > 0:
            tap_screen (2489, 1307)  # Challenge Print Again (
            "Challenge start Again") Sleep
            (5)
        Tap_screen (2155, 1218) #闯关
        print (Start through) sleep (
        2764, tap_screen) #自动
        print ("Auto button click")
        TAP_ Screen (500,500) #点击屏幕继续
        print ("Click to continue") Sleep
        (5)
        Tap_screen (2489, 1307)  # Challenge Sleep again
        (1)
        Print (i)
Os.system's effect is the same as your command in CMD. Because now the strange proportion of mobile phones in endlessly, I use the 18.5:9 of Samsung S8, so all the coordinates are written dead, can be based on their own mobile phone to modify the above various coordinates and dormant time. Opening the display pointer position in the phone's developer mode will display the coordinates of the area you are currently touching.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.