DNF刷怪的按键精灵脚本,很久前写的,效果不好。。



Rem begin


MoveTo 60, 60
LeftClick 1


dim begincolorPos,endcolorPos 
begincolorPos = "DD9900"
endcolorPos = "0022FF"


Dim speed
speed = 15
Dim colorMen
colorMen = "9CADFF"
Dim colorNameBound(5)
colorNameBound(0) = "EDD568"//蓝色
colorNameBound(1) = "FF6BB3"//紫色
colorNameBound(2) = "EDD568"//蓝色
colorNameBound(3) = "FF6BB3"//紫色
colorNameBound(4) = "FFFFFF"//白色


Dim beginPosX, beginPosY,endposx,endposy
beginPosX = 616
beginPosY = 57


FindColor 0, 0, 640, 480, begincolorPos,beginPosX,beginPosY
FindColor 0, 0, 640, 480, endcolorPos, endposx, endposy


Dim i
i = 0
i = cint((616 - beginPosX + 10)/19)
If i = 4 Then 
If beginPosY > 57 + 10 Then 
i=5
End If
ElseIf i > 4 Then
i=i+1
End If


For 9 - i


If i = 4 Then 
beginPosY = beginPosY + 19
ElseIf i = 7 Then
beginPosY = beginPosY + 19
ElseIf i<8
beginPosX = beginPosX - 19
End If

Call 刷怪(beginPosX, beginPosY)

Rem 刷怪结束

Call 捡取物品()
Delay 100
KeyPressH "Ctrl", 1
Delay 100
Call 捡取物品()
Delay 100

Rem 进入下关
If i = 4 Then 
Call 移动到(220, 340)
Call 移动到(220, 460)
ElseIf i = 3 Then
Call 移动到(100, 300)
Call 移动到(0, 300)
ElseIf i = 5 Then
Call 移动到(100, 320)
Call 移动到(0, 320)
ElseIf i = 6 Then
Call 移动到(100, 300)
Call 移动到(0, 300)
ElseIf i < 8
Call 移动到(0, 300)
Else 
Delay 2000
End If

Dim index

FindColor 0, 0, 640, 480, begincolorPos,beginPosX,beginPosY
index = cint((616 - beginPosX + 10)/19)
If index = 4 Then 
If beginPosY > 57 + 10 Then 
index=5
End If
ElseIf index > 4 Then
index=index+1
End If
If index = i Then 
Goto 进入下关
End If
i = i + 1


Next


MoveTo 460, 90
LeftClick 15
Delay 2000
KeyPressH 39, 3//右
Delay 100
KeyPressH 38, 3//上
Delay 1000
MoveTo 318, 380
LeftClick 1
Delay 2000


Goto begin


Dim oldcolor, newcolor
Sub 刷怪( flagposX,flagposY )

oldcolor = GetPixelColor(flagposX, flagposY)

KeyPressH 37,1
Delay 200

Dim flag
flag = 1

While (flag)
Call 刷怪结束判断(flagposX, flagposY)

KeyPress "A", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "S", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "D", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "F", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "G", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "H", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "T", 1
       
Call 捡取物品()
Delay 100
KeyPressH "Ctrl", 1
Delay 100
Call 捡取物品()
Delay 100


        KeyPress "Q", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "W", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "E", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "R", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "T", 1
        Call 刷怪结束判断(flagposX, flagposY)
        KeyPress "Y", 1
        Call 刷怪结束判断(flagposX, flagposY)


Call 捡取物品()
Delay 100
KeyPressH "Ctrl", 1
Delay 100
Call 捡取物品()
Delay 100


Wend

End Sub
Sub 刷怪结束判断(flagposX, flagposY)
For 8
newcolor = GetPixelColor(flagposX, flagposY)
If newcolor <> oldcolor Then 
Goto 刷怪结束
End If
Dim c1
c1 = "10FFFF"
If newcolor > c1 Then 
Goto 刷怪结束
End If
/*FindColor 0, 0, 640, 480, c1, endposx, endposy
If endposx > 0 Then 
Goto 刷怪结束
End If
c1 = "FFF6A3"
FindColor 0, 0, 640, 480, c1, endposx, endposy
If endposx > 0 Then 
Goto 刷怪结束
End If*/
Delay 100
Next
End Sub
Sub 捡取物品()
Dim wp
wp = 0

Dim flag
flag = 1
While (flag)


FindColor 0, 200, 640, 480,colorNameBound(wp), intX,intY
intY = intY +30 // 计算物品位子

If intX > 0 Then 
Call 移动到(intX,intY)
KeyPress 88, 1
Delay 200
ElseIf wp<1
wp = wp + 1
Else 
flag = 0
End If
Wend
End Sub


Sub 移动到(posX, posY)


Dim intX,intY
FindColor 0, 100, 640, 480, colorMen, intX, intY


intY = intY + 80 //计算脚的位置


If intX > 0 Then 
Dim offsetX
offsetX = intX-posX
Dim offsetY
offsetY = intY - posY

If offsetY > 0 Then 
KeyDownH 38,1
Delay offsetY * 100 / speed
KeyUpH 38,1
Else 
KeyDownH 40, 1
Delay -offsetY * 100 / speed
KeyUpH 40, 1
End If
If offsetX > 0 Then 
KeyDownH 37, 1
Delay offsetX * 100 / speed
KeyUpH 37, 1
Else 
KeyDownH 39, 1
Delay -offsetX * 100 / speed
KeyUpH 39, 1
End If

End If
End Sub


Sub 攻击技能()

//        KeyPress "X", 5
KeyPress 88, 1
Delay 100
KeyPress 88, 1
Delay 100
KeyPress 88, 1
Delay 100
KeyPress 88, 1
Delay 100
KeyPress 88, 1
Delay 100

End Sub


Sub 召唤技能()
        KeyPress "Q", 1
        Delay 1000
        KeyPress "W", 1
        Delay 1000
        KeyPress "E", 1
        Delay 1000
        KeyPress "R", 1
        Delay 1000
        KeyPress "T", 1
        Delay 1000
        KeyPress "Y", 1
        Delay 1000
        KeyPress "A", 1
        Delay 1000
        KeyPress "S", 1
        Delay 1000
        KeyPress "D", 1
        Delay 1000
        KeyPress "F", 1
        Delay 1000
        KeyPress "G", 1
        Delay 1000
        KeyPress "H", 1
        Delay 1000
        KeyPress "T", 1
        Delay 1000
End Sub

你可能感兴趣的:(创新)