0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ガチャマクロ

Last updated at Posted at 2019-03-31
import pyautogui
import cv2

def kinsure(x):
    pyautogui.screenshot('filename.png')
    img = cv2.imread("filename.png", 0)
    temp = cv2.imread(x, 0)
    result = cv2.matchTemplate(img, temp, cv2.TM_CCOEFF_NORMED)
    min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
    if max_val >= 0.95:
        pyautogui.click(max_loc)
    
pyautogui.FAILSAFE = True
pyautogui.PAUSE = 2

while 1:
    kinsure("test7.png")
    
    pyautogui.screenshot('filename.png')
    img = cv2.imread("filename.png", 0)
    temp = cv2.imread("test8.png", 0)
    result = cv2.matchTemplate(img, temp, cv2.TM_CCOEFF_NORMED)
    min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result)
    if max_val >= 0.95:
        pyautogui.PAUSE = 10
        pyautogui.click(max_loc)
        kinsure("test9.png")
        kinsure("test10.png")
        kinsure("test11.png")
        kinsure("test12.png")
        kinsure("test13.png")
        kinsure("test14.png")
        
    pyautogui.PAUSE = 2

2秒ごとにtest7.pngかtest8.pngを探す
test7.pngが見つかったらそこをクリックしてまた2秒ごとの監視を続ける
test8.pngが見つかったら(つまりカバンがいっぱいになったら)、10秒間隔でtest9~14.pngをクリックする
以下test7.png〜test14.png

test7.png
test8.png
test9.png
test10.png
test11.png
test12.png
test13.png
test14.png

カバンがいっぱいになるまでガチャを回して、カバンがいっぱいになったら一括分解して、またガチャを回してくれる、というマクロがこれで出来る
while文の中を書き換えて自分だけのマクロを作ろう!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?