其實這篇文章好早就像寫了,可是我這種拖延症晚期的人啊,做什么事都是拖拖拉拉的,最近玩火號被封了,才想起這件事…好了好了,廢話不說了。
首先是按鍵精靈,經常玩游戲的人可能會認識,一個神奇的腳本軟件,可以說是完全基於圖形化的,稍微有一點編程基礎,就能輕松駕馭。
《陰陽師》這一款手游,可以說是一個卡牌游戲,就是點點點,屏幕出現什么就點什么,所以需要干干干,就很累,但對於程序來說,就很輕松了。
我們需要用的軟件有,一個安卓模擬器,模擬器裝上陰陽師,還有就是按鍵精靈的圖形識別功能。
介紹一下,按鍵精靈的圖形識別是指當電腦屏幕出現某一個圖案時,就可以識別出來,可以具體識別出圖形在屏幕中的位置(坐標)。
所以我們編程的思路是,當陰陽師出現某個圖形時,我們鼠標就去點擊它就行了。然后重復運行這個程序,就可以掛機一直干干干。先來一段源碼解說。
Rem a
FindPic 0,0,1320,751,”Attachment:\勝利勾玉.bmp”,0.8,intX,intY
If intX > 0 And intY > 0 Then
MoveTo intX+60,intY+60
Delay 1000
LeftClick 2
Goto a
第一行是定義一個 a 的函數 ,然后下面是函數的內容 ,最后面有一個Goto a ,然后就可以重復運行 這個 a 函數。
第二行 ,FindPic 函數 ,這是一個識別圖形的函數。 0,0,1320,751 這表達的是一個區域。屏幕最左上角的坐標是 0,0 ,然后一個矩形區域,到 1320,751.。 后面“勝利勾玉.bmp” 是附件中添加的一張圖片,要查找的就是這張圖片。 “0.8” 是指在屏幕查找這張圖片的相似度,1.0是最大,相似度越高 ,查找越快,但有可能出現,找不到的情況。后面“int X,int Y”,是如果在屏幕中查找到這張圖片,就儲存下這張圖片在屏幕上的坐標 。
后面 move to 是指鼠標移動到 intX+60,int Y+60,這個位置,就是前面儲存的圖片的坐標位置 再+60
Delay 1000 延遲1000ms
leftclick 2 點擊兩下
這只是程序的一個小部分,而整個腳本,大部分的代碼類似這個。也懶得多寫,稍微花點時間就能搞懂。
我的六星鳥呀…..被封了…願賭服輸,退坑慶祝。
當然,這個是不會被封號的,我被封號是因為我修改數據,比如攻擊力無限大….
博客原發布時間:2017年2月20日
2017 9 21 更新
貼一段代碼
Rem a FindPic 0,0,1320,751,"Attachment:\勝利勾玉.bmp",0.8,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 1000 LeftClick 2 Delay 3000 MoveTo 611, 676 LeftClick 2 Delay 3000 MoveTo 611, 676 LeftClick 2 Delay 1000 End If FindPic 550,470,1320,751,"Attachment:\組隊.bmp",0.7,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+30 Delay 1000 LeftClick 1//點擊組隊 End If FindPic 930,550,1320,751,"Attachment:\創建隊伍.bmp",0.5,intX,intY//創建組隊 If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 1000 LeftClick 1 //創建組隊 End If/// FindPic 760,450,1320,751,"Attachment:\創建.bmp",0.8,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 1000 LeftClick 2 End If///創建 FindPic 0,0,1308,751,"Attachment:\確定.bmp",0.7,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 500 LeftClick 2 End If FindPic 850,600,1320,751,"Attachment:\開始戰斗.bmp",0.7,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 1000 LeftClick 1 //開始戰斗 Delay 13000 MoveTo 1185, 565 Delay 1000 LeftClick 1 End If //結界突破 FindPic 500,280,770,550,"Attachment:\紅達摩2.bmp",0.65,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+60,intY+60 Delay 1000 LeftClick 1//點擊紅達摩 Delay 2000 LeftClick 1 End If FindPic 0,0,1920,1080,"Attachment:\1.bmp",0.5,intX,intY If intX > 0 And intY > 0 Then MoveTo intX+30,intY+30 Delay 1000 LeftClick 1// Delay 1000 MoveTo intX+100,intY+100 Delay 1000 LeftClick 1 //開始戰斗 Delay 11000 MoveTo 1185, 570 Delay 1000 LeftClick 1 End If Goto a