If isdanger = 0 Then 
     stateinfo = "退出游戏"
     Else 
     stateinfo=stateinfo
     End If
     显示信息 
     KeyPress "-", 1
     Delay 5000+int(rnd*1000)
     d2state = 1
     xx = xx + 1
  End Sub
  sub onscriptexit
     Call Plugin.Window.SetText(d2_Hwnd,d2_winTip)
 End Sub
 Sub creatgame
 stateinfo="创建游戏"
  显示信息 
Call Plugin.Bkgnd.LeftClick(d2_hwnd,600, 460)	 //开创按钮   600 460
 //输入游戏名
 gamename = ""
 zz = ""
 i = 1
 jj = 4 + int(rnd * 4)
 namebaohan = "123era"
 text=Split(namebaohan,"",-1)

 
Do While i < jj
i = i + 1
   t=int(rnd*6)+1
	zz=mid(namebaohan,t,1)
	gamename = gamename & zz
	
Loop
 
 Delay 1000+int(rnd*100)
 SayString gamename
 xxy = xx
 Delay 500+int(rnd*100)
 Call Plugin.Bkgnd.LeftClick(d2_hwnd, 666, 414)
 Delay 2000+int(rnd*100)
 End Sub
 Sub pickup
 	stateinfo="拾取物品"
    显示信息 
     Delay 500
 	i=0
 	Do while i<5
 	MoveTo d2_pyx+100,d2_pyy+ 400
 	Delay 200+int(rnd*100)
 	KeyDown "Alt", 1
 	FindPic d2_pyx + 550 - 250, d2_pyy + 200 - 200, d2_pyx + 550 + 250, d2_pyy + 200 + 200,"Attachment:\暗金.bmp",0.6,intX,intY
 	FindPic d2_pyx + 550 - 250, d2_pyy + 200 - 200, d2_pyx + 550 + 250, d2_pyy + 200 + 200, "Attachment:\绿色.bmp", 0.6, intX1, intY1
 	FindPic d2_pyx + 550 - 250, d2_pyy + 200 - 200, d2_pyx + 550 + 250, d2_pyy + 200 + 200, "Attachment:\黄金.bmp", 0.6, intX2, intY2
 	FindPic d2_pyx + 550 - 250, d2_pyy + 200 - 200, d2_pyx + 550 + 250, d2_pyy + 200 + 200,"Attachment:\蓝色.bmp",0.6,intX4,intY4
 	FindPic d2_pyx + 550 - 250, d2_pyy + 200 - 200, d2_pyx + 550 + 250, d2_pyy + 200 + 200,"Attachment:\有用的.bmp", 0.6, intX3, intY3
 	Delay 500+int(rnd*100)
 	If intx > 0 Then 
 	Call Plugin.Msg.Tips("第" & xx & "次KP,打到暗金装备")
 	Call Plugin.File.WriteFileEx("..\zdkp_log.txt",ow&":第" & xx & "次KP,打到暗金装备")
  		MoveTo intx,inty
 	ElseIf intx1 > 0 Then
 	Call Plugin.Msg.Tips("第" & xx & "次KP,打到绿色物品")
 		Call Plugin.File.WriteFileEx("zdkp_log.txt",ow&":第" & xx & "次KP,打到绿色物品")
 		MoveTo intx1, inty1
 	ElseIf intx2 > 0  Then
 	Call Plugin.Msg.Tips("第" & xx & "次KP,打到黄金物品")
 		Call Plugin.File.WriteFileEx("zdkp_log.txt",ow&":第" & xx & "次KP,打到黄金物品")
 		MoveTo intx2, inty2
 	ElseIf intx4 > 0  Then
 	Call Plugin.Msg.Tips("第" & xx & "次KP,打到蓝色物品")
 		Call Plugin.File.WriteFileEx("zdkp_log.txt",ow&":第" & xx & "次KP,打到蓝色物品")
 		MoveTo intx4, inty4
 	ElseIf intx3 > 0 Then
 	Call Plugin.Msg.Tips("第" & xx & "次KP,打到宝有用的")
 		Call Plugin.File.WriteFileEx("zdkp_log.txt",ow&":第" & xx & "次KP,打到宝有用的")
 		moveto intx3,inty3
 	Else 
 	Call Plugin.Msg.Tips("第" & xx & "次KP,一无所获")
 		Call Plugin.File.WriteFileEx("zdkp_log.txt",now&":第" & xx & "次KP,一无所获")
 	 	KeyUp "ALT", 1
  	Exit do
 	End If
 	Delay 100
 	LeftClick 1
 	Delay 1000+int(rnd*200)
 	KeyUp "ALT", 1
 	i=i+1
 	Loop
 	If i = 5 Then 
 	 isfull = 1
 	 End if
 End Sub
Function dangerBack()
     //Pet HP是否过低,过低自动回城,等待20
     FindColor d2_pyx, d2_pyy, d2_pyx + 200, d2_pyy + 200, "008400", intX, intY
     getcolor = GetPixelColor(d2_pyx + 75, d2_pyy + 555)
    If getcolor = "5c" Then 
     Else 
           KeyPress "2", 1