天天爱消除辅助-按键精灵⼿机安卓版-天天爱消除辅助Android
源码-按键精灵脚本
⽆意中看到按键精灵出Android版了,想了解⼀下,所以加⼊了内测,
由于脚本语法和VB差不多,所以上⼿很快,写了个天天爱消除的脚本来练习⼀下,
很早就知道按键精灵了,但⼀直没写过其脚本,这个算是我的第⼀个按键精灵脚本吧!
/****
测试⼿机⼩⽶1S
分辨率 480*854
游戏⽅格 68*68
起始点 3,223
**/
Dim baseX,baseY,boxW,boxH
Dim I,X,Y,maxX,maxY,ret,Box(8, 8)
baseX = 3
baseY = 223
boxW = 68
boxH = 67.5
maxX = 7
maxY = 7
ret = 0
KeepScreen(true)
TracePrint "开始消除。。。"
'还没加⼊判断开始与结束的条件,使⽤时⼿⼯点停⽌
For I = 1 To 200
'TracePrint I
Call ReadBox()
For Y = 1 To maxY
For X = 1 To maxX
ret = CheckMove(X, Y, maxX, maxY)
Select Case ret
Case 1 '上移
Tap baseX+(X-1)*boxW+30,baseY+(Y-1)*boxH+30
Tap baseX+(X-1)*boxW+30,baseY+(Y-2)*boxH+30
Case 2 '右移
Tap baseX+(X-1)*boxW+30,baseY+(Y-1)*boxH+30
手机游戏源码论坛Tap baseX+X*boxW+30,baseY+(Y-1)*boxH+30
Case 3 '下移
Tap baseX+(X-1)*boxW+30,baseY+(Y-1)*boxH+30
Tap baseX+(X-1)*boxW+30,baseY+(Y)*boxH+30
Case 4 '左移
Tap baseX+(X-1)*boxW+30,baseY+(Y-1)*boxH+30
Tap baseX+(X-2)*boxW+30,baseY+(Y-1)*boxH+30
End Select
Next
Next
Next
TracePrint "消除结束"
KeepScreen(false)
KeepScreen(false)
EndScript
'确定⽅块往哪个⽅向移动(返回:0-⽆,1-上,2-右,3-下,4-左)Function CheckMove(x, y, maxX, maxY)
Dim ret
ret = 0
'往上移
If ret=0 And y>1 Then
If x>2 And BoxMatch(x-2,y-1, x-1,y-1, x,y) Then
ret = 1
End If
If x>1 And x<maxX And BoxMatch(x-1,y-1, x,y, x+1,y-1) Then ret = 1
End If
If x<maxX-1 And BoxMatch(x,y, x+1,y-1, x+2,y-1) Then
ret = 1
End If
If y>3 And BoxMatch(x,y-3, x,y-2, x,y) Then
ret = 1
End If
End If
'往右移
If ret=0 And x<maxX Then
If y>2 And BoxMatch(x+1,y-2, x+1,y-1, x,y) Then
ret = 2
End If
If y>1 And y<maxY And BoxMatch(x+1,y-1, x,y, x+1,y+1) Then ret = 2
End If
If y<maxY-1 And BoxMatch(x,y, x+1,y+1, x+1,y+2) Then
ret = 2
End If
If x<maxX-2 And BoxMatch(x,y, x+2,y, x+3,y) Then
ret = 2
End If
End If
'往下移
If ret=0 And y<maxY Then
If x>2 And BoxMatch(x-2,y+1, x-1,y+1, x,y) Then
ret = 3
End If
If x>1 And x<maxX And BoxMatch(x-1,y+1, x,y, x+1,y+1) Then ret = 3
End If
If x<maxX-1 And BoxMatch(x,y, x+1,y+1, x+2,y+1) Then
ret = 3
End If
If y<maxY-2 And BoxMatch(x,y, x,y+2, x,y+3) Then
ret = 3
End If
End If
'往左移
If ret=0 And x>1 Then
If y>2 And BoxMatch(x-1,y-2, x-1,y-1, x,y) Then
ret = 4
End If
If y>1 And y<maxY And BoxMatch(x-1,y-1, x,y, x-1,y+1) Then ret = 4
End If
If y<maxY-1 And BoxMatch(x,y, x-1,y+1, x-1,y+2) Then
ret = 4
End If
If x>3 And BoxMatch(x-3,y, x-1,y, x,y) Then
ret = 4
ret = 4
End If
End If
CheckMove = ret
End Function
'判断三个⽅块能否连线
Function BoxMatch(x1, y1, x2, y2, x3, y3)
Dim b1, b2, b3
b1 = Box(x1, y1)
b2 = Box(x2, y2)
b3 = Box(x3, y3)
If BoxEquals(b1, b2) And BoxEquals(b1, b3) Then
BoxMatch = True
Else
BoxMatch = False
End If
End Function
'判断两个⽅块是否⼀样
Function BoxEquals(box1, box2)
If ColorDiff(box1,box2)<50 Then
BoxEquals = True
Else
BoxEquals = False
End If
End Function
'读⼊⽅块布局
Sub ReadBox()
KeepCapture
Dim X,Y
For Y = 1 To maxY
For X = 1 To maxX
Box(X,Y)=GetPixelColor(baseX+(X-1)*boxW+30, baseY+(Y-1)*boxH+30) Next
Next
ReleaseCapture
End Sub
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论