剑灵挂机脚本(慢慢完善中)

2014/07/1700:04:13 发表评论
Dim vBlood
vBlood=0
Hwnd = Plugin.Window.Find(0, "剑灵")
sRect = Plugin.Window.GetClientRect(Hwnd)
MyArray = Split(sRect, "|")
Ux1 = CLng(MyArray(0))
Uy1 = CLng(MyArray(1))

/*
Ux2 = CLng(MyArray(2))
Uy2 = CLng(MyArray(3))

MessageBox "x坐标:" & Ux1 & "y坐标:" & Uy1
MessageBox "x坐标:" & Ux2 & "y坐标:" & Uy2
*/

Function ViewRight(num)
	KeyPress 39,num
End Function

Function ViewLeft(num)
	KeyPress 37,num
End Function


Function IsHaveMonster

    IsHaveMonster = 0

    //FindColor Ux1 + 648, Uy1 + 593, Ux1 + 1024, Uy1 + 768, "3878EE", intX, intY
    FindColor Ux1+662,Uy1+558,Ux1+929,Uy1+677, "3878EE",intX,intY
 	If intX > 0 And intY > 0 Then 
  	 	IsHaveMonster=1
 	End If
 	
End Function

Function PickUp
 	FindPic Ux1+648,Uy1+421,Ux1+690,Uy1+470,"Attachment:\pickup.bmp",0.8,intX,intY
 	If intX > 0 And intY > 0 Then 
  	KeyPress "f", 1
  	Delay 500
  	KeyPress "f", 1
 	End If
 
End Function

Function TurnRight
	For i = 1 To 20
 	    PickUp
  		If IsHaveMonster Then 
  			TracePrint "发现怪物!"
   			Exit Function
  		Else 
   			ViewRight(2)
  		End If
 	Next
 	
 	KeyDown "w", 1
 	Delay 1300
 	KeyUp "w", 1
End Function

Function TurnLeft
	For i = 1 To 20
 	    PickUp
  		If IsHaveMonster Then 
  			TracePrint "发现怪物!"
   			Exit Function
  		Else 
   			ViewLeft(2)
  		End If
 	Next
 	
 	KeyDown "w", 1
 	Delay 1300
 	KeyUp "w", 1
End Function

/*找怪函数*/
Function FindMonster
/*向右旋转屏幕,未发现怪则向前走1.5秒*/
	TurnRight 
	Delay 50
	TurnLeft 
	Delay 50
	TurnLeft 
	Delay 50
	TurnRight 
	Delay 50
End Function

Function AttackMonster
    RightClick 1
		Delay 30
	KeyPress "q",1	
    While IsHaveMonster and vBlood = 0
    	KeyPress "1",1
    	Delay 10
    	KeyPress "2",1
		Delay 10
		LeftClick 1
		Delay 10
		KeyPress "2",1
		Delay 10
		FindPic Ux1+648,Uy1+421,Ux1+690,Uy1+470,"Attachment:\huitianjiao.bmp",0.6,intX,intY
		If intX > 0 And intY > 0 Then 
			KeyPress "f", 1
			Delay 50
		End If	
		LeftClick 1
		Delay 20
    	RightClick 1
		Delay 30
	Wend
End Function

/*被怪攻击判断*/
Function AttackByMonster

	IfColor Ux1 + 82, Uy1 + 50, "5AB99A", 0 Then
		FindMonster
		Delay 300
	End If
	
End Function


Function BloodNotEnough
		BloodNotEnough=0
		FindColor Ux1,Uy1,Ux1+97,Uy1+18,"393534",intX,intY
		If intX > 0 And intY > 0 Then 
			BloodNotEnough=1
		End If
End Function

/*
BeginThread IsRepairWeapon
BeginThread Main
*/
BeginThread IsBloodNotEnough

Function IsRepairWeapon
		KeyPress "i", 1
		Delay 100
		IfColor Ux1+579,Uy1+122,"000000",0 Then
			KeyPress "7", 1
			Delay 20000
		End If
		Delay 200
		KeyPress "i", 1

End Function

Function IsDead
	FindPic Ux1+552,Uy1+607,Ux1+591,Uy1+648,"Attachment:\dead.bmp",0.7,intX,intY
	If intX > 0 And intY > 0 Then 
		KeyPress "4", 1
		Delay 120000
	End If
End Function

Sub IsBloodNotEnough
		If BloodNotEnough Then 
			vBlood=1
			KeyPress "6", 1
			Delay 200
			vBlood=0
		End If
		Delay 100

End Sub

LogStart "d:\JL.log"

While True
	//IsRepairWeapon
	IsDead
    IsBloodNotEnough
	PickUp 
	If IsHaveMonster Then 
		AttackMonster	
	Else
		FindMonster 
	End If
	
	Delay 200
Wend

 

  • 微信扫码赞助
  • weinxin
  • 支付宝赞助
  • weinxin

发表评论

您必须才能发表评论!