Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer'检测按键状态
Dim key
key = 65'A
t = 1000
Do
Dim n
n = GetAsyncKeyState(key)
If n < 0 Then '如果状态为按下
If t >= 200 Then
T1 = Plugin.Sys.GetTime
t = 0
//TracePrint "准备按键"
Randomize
x = int(2 * rnd + 1)'随机数1前进和2后退
//Randomize
//y = int((2 - 1 + 1) * rnd + 1)'随机循环攻击次数
If x=1 Then'前进攻击
//z = 1
//While z<=y
//z=z+1
Call front()
//Wend
End If
If x=2 Then'后退攻击
//z = 1
//While z<=y
//z=z+1
Call back()
//Wend
End If
While 200>= t
T2 = Plugin.Sys.GetTime
t = T2 - T1
Wend
Randomize
y = int((50 - 40 + 1) * rnd + 40)
Delay y
//Randomize
//c = int((0 - 100 + 1) * rnd + 100)
//Delay 10
//TracePrint t
End If
End If
Loop
Sub front()'前进攻击
KeyDown "=", 1
Randomize
a = int((35 - 31 + 1) * rnd + 31)
Delay a
KeyPress "End", 1
Randomize
b = int((35 - 31 + 1) * rnd + 31)
Delay b
KeyPress "X", 1
c =320-a-b
Delay c
KeyUp "=", 1
Delay 10
KeyPress "C", 1
End Sub
Sub back()'后退攻击
KeyDown "-", 1
Randomize
d = int((35 - 31 + 1) * rnd + 31)
Delay d
KeyPress "End", 1
Randomize
e = int((35 - 31 + 1) * rnd + 31)
Delay e
KeyPress "X", 1
f =320-d-e
Delay f
KeyUp "-", 1
Delay 10
KeyPress "C", 1
End Sub
Dim key
key = 65'A
t = 1000
Do
Dim n
n = GetAsyncKeyState(key)
If n < 0 Then '如果状态为按下
If t >= 200 Then
T1 = Plugin.Sys.GetTime
t = 0
//TracePrint "准备按键"
Randomize
x = int(2 * rnd + 1)'随机数1前进和2后退
//Randomize
//y = int((2 - 1 + 1) * rnd + 1)'随机循环攻击次数
If x=1 Then'前进攻击
//z = 1
//While z<=y
//z=z+1
Call front()
//Wend
End If
If x=2 Then'后退攻击
//z = 1
//While z<=y
//z=z+1
Call back()
//Wend
End If
While 200>= t
T2 = Plugin.Sys.GetTime
t = T2 - T1
Wend
Randomize
y = int((50 - 40 + 1) * rnd + 40)
Delay y
//Randomize
//c = int((0 - 100 + 1) * rnd + 100)
//Delay 10
//TracePrint t
End If
End If
Loop
Sub front()'前进攻击
KeyDown "=", 1
Randomize
a = int((35 - 31 + 1) * rnd + 31)
Delay a
KeyPress "End", 1
Randomize
b = int((35 - 31 + 1) * rnd + 31)
Delay b
KeyPress "X", 1
c =320-a-b
Delay c
KeyUp "=", 1
Delay 10
KeyPress "C", 1
End Sub
Sub back()'后退攻击
KeyDown "-", 1
Randomize
d = int((35 - 31 + 1) * rnd + 31)
Delay d
KeyPress "End", 1
Randomize
e = int((35 - 31 + 1) * rnd + 31)
Delay e
KeyPress "X", 1
f =320-d-e
Delay f
KeyUp "-", 1
Delay 10
KeyPress "C", 1
End Sub