DimEnv shuliang,time1,time2,time3,time4,ktjc,feyjy
Dim hwnd,hwnd1,hwnd2
DimEnv kaiguan
kaiguan=0
hwnd=Plugin.Window.MousePoint
x=Plugin.Window.Move(hwnd,0,0)
'Delay 1000
time1=plugin.sys.GetTime //获取脚本运行时系统初始时间
'ktjc=1
'set ws=createobject("wscript.shell")
'ws.run "c:\testfile.txt",5,ture
'Delay 500
'hwnd2=Plugin.Window.Foreground
'y=Plugin.Window.Move(hwnd2,0,480)
gosub 站街自动喊话
Rem kaitou
Sub 站街自动喊话 //站街喊话脚本
UserVar fdys=15 "防掉线设置"
MoveTo 603,439
gosub 检查是否有交易
time3=plugin.sys.GetTime
If int(time3-time1)>fdys*60*1000 then //15分钟后开启防掉线,只支持站街的时候
gosub 防掉线
End If
KeyPressS "Enter", 1
Delay 200
NUM =plugin.Color.CountColor(60, 398,92, 407, "AADDEE",1) //查找喊话窗口是否存在
If NUM > 0 Then
Goto 喊话
Rem 喊话
End If
UserVar szhhjs=5 "设置喊话句数(最多五句)"
If szhhjs= 1 Then
KeyPressS "B", 1
Delay 20
KeyPressS "A", 1
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 1200
ElseIf szhhjs= 2 Then
KeyPressS "B", 1
Delay 20
KeyPressS "A", 1
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 2
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 1200
ElseIf szhhjs= 3 Then
KeyPressS "B", 1
Delay 20
KeyPressS "A", 1
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 2
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "C", 1
Delay 20
KeyPressS "Enter", 1
Delay 1200
ElseIf szhhjs= 4 Then
KeyPressS "B", 1
Delay 20
KeyPressS "A", 1
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 2
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "C", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "D", 1
Delay 20
KeyPressS "Enter", 1
Delay 1200
ElseIf szhhjs= 5 Then
KeyPressS "B", 1
Delay 20
KeyPressS "A", 1
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 2
Delay 20
KeyPressS "1", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "C", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "D", 1
Delay 20
KeyPressS "Enter", 1
Delay 3200
KeyPressS "B", 1
Delay 20
KeyPressS "E", 1
Delay 20
KeyPressS "Enter", 1
Delay 1200
End if
feyjy=0
gosub 等待交易 //跳到等待交易
End Sub
Sub 等待交易
//找图
x=Plugin.Window.Active(hwnd)
FindPic 455,305,636,419,"Attachment:\公告按钮.bmp",0.9,intX,intY //扫描交易框
If intX > 0 And intY > 0 Then
MoveTo 523,403
LeftClick 2
Delay 300
FindPic 0,0,1024,768,"Attachment:\11.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then
gosub 等待放入物品
Else
gosub 站街自动喊话
End If
Else
gosub 站街自动喊话
End If
End Sub
//================================================================================
//MessageBox "正在初始话请稍等"
Call Plugin.Msg.Tips("正在加载
…")
DqTime = lib.网络.获取网络时间()
//获取网络时间,得到的时间格式为:2000-1-1 12:00:00
zzsj="2011-11-1 23:59:59"
//zzsj=终止时间 终止时间为脚本使用限定的最后时间!
If CDate(DqTime)
0 And intY > 0 Then
i=i+1
Else
gosub 检查并交易
End If
Loop
If i>0
KeyPress "esc",1
Delay 100
gosub 站街自动喊话
End If
End Sub
Sub 输入金钱
Dim qian,x,cishu
Rem jiaqian
qian=jiage(100)
If qian<>0 then
'MsgBox "总价钱为:"&qian
MoveTo 197,301
Delay 250
LeftClick 1
Delay 250
KeyPress "BackSpace", 15 //金钱输入清零
Delay 50
x=1
Dim shu
cishu=len(qian)
For cishu
shu=left(qian,1) //取qian的左起第一个数字
qian=right(qian,cishu-x) //取qian的右起第I个数字
KeyPress shu,1
i=0
Delay 250
x=x+1
Next
Else
i=i+1
If i<30 //30秒内金钱为0则跳转喊话
Goto jiaqian
Delay 1000
Else
KeyPress "esc",1
Delay 100
gosub 站街自动喊话
End If
End if
Delay 100
LeftClick 1
Delay 200
gosub 检查并交易
End Sub
Sub 检查并交易
Rem jiancha
gosub 检查交易是否提前结束
//检查己方输入的金钱
Dim no(9) //数字特征码
no(0)="0111010001100011000110001100011000101110"
no(1)="0001000011000100001000010000100001000111" //自取特征码,DNF己方金钱框专用
no(2)="0111010001100010100000100000100000111111"
no(3)="0111010001100000110010000100001000101110"
no(4)="0100001100010100101001001111100100011000"
no(5)="1111100001000010111110000100001000101110"
no(6)="0111001001000010111110001100011000101110"
no(7)="1111101001010000010000100001000010000100"
no(8)="0111010001100010111010001100011000101110"
no(9)="0111010001100011000111110100001001001110"
Dim colo(3) //颜色十六进制值 10月7日版
colo(1)="008CFF"
colo(0)="0050FF"
colo(2)="00F0FF"
MoveTo 603,439
rightx=296 //初始x坐标
righty=299 //初始Y坐标
rx=rightx
ry=righty
jici=0
jine=""
y=0
For 3 //千万位数字扫描
rightx=296-21*y
for 3 //百位数字扫描
i=0
For 8 //单个数字扫描
rx=rightx-jici*6 //后退6个像素点
For 5
ifcolor rx,ry,colo(y),0
nob="1"
Else
nob="0"
End If
rx=rx-1
number=number&nob
Next
ry=ry+1
Next
For 10
If number=no(i)
jine=i&jine
Exit For
End If
i=i+1
Next
jici=jici+1
number=""
ry=righty //循环一次结束后初始化ry坐标
Next //修改初始化值
jici=0
y=y+1
Next
'MsgBox jine
Delay 100
feyjy=feyjy+1
If feyjy>120 Then //若一段时间内没有成功交易则取消交易,慎重!!!
KeyPress "Esc",1
Delay 100
gosub 站街自动喊话
End If
If int(jine)=jiage(1000) Then
'MsgBox "价格正确可以进行下一步交易"
ifcolor 167,269,"44EEFF",0 //检查对方是否先点击了交易
MoveTo 161,426 //交易逐步点击
Delay 400
LeftClick 2
Delay 400
LeftClick 2
Delay 150
Else
Goto jiancha
End If
Else
'MsgBox "价格不符合"
gosub 输入金钱
Delay 500
Gosub 检查并交易
End If
End Sub
Sub 检查交易是否提前结束
i=0
Rem star
FindPic 0,0,1024,768,"Attachment:\11.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then
Delay 500 //2分钟内未交易完成则关闭交易框
Else
gosub 站街自动喊话
Goto jiewei
End If
rem jiewei
End Sub
Sub 检查是否有交易
Rem star
FindPic 0,0,1024,768,"Attachment:\11.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then
gosub 检查并交易
Delay 100
Else
' Goto jiewei
End If
' rem jiewei
End Sub
Sub 防掉线
kaiguan=0
For 2
MoveTo 33,439
Delay 600
KeyPress "w", 1
Delay 100
KeyPress "q", 1
Delay 100
MoveTo 89,202
Delay 100
LeftClick 1
Delay 1000
IfColor 143,437,"6DA2B9",1 then
//接受任务
Delay 1000
MoveTo 143,437
Delay 100
LeftClick 1
Delay 100
KeyPress "Esc", 1
Delay 100
MoveTo 419,405
Delay 600
LeftClick 2
Else
Delay 1000
//放弃任务
MoveTo 419,402
Delay 100
LeftClick 1
Delay 100
MoveTo 336,407
Delay 100
LeftClick 1
Delay 100
End If
KeyPress "Esc", 1
Next
EndScript
End Sub
Sub 输出信息
Call Plugin.Bkgnd.SendString(Hwnd2, "内容")
Plugin.Window.Active hwnd2
KeyPress "enter",1
End Sub
Function xiejiage(geshu,jq,wupin)
Set fso = CreateObject("Scripting.FileSystemObject")
b=Plugin.File.ExistFile("c:\testfile.txt")
If b=0 Then
Set c= fso.CreateTextFile("c:\testfile.txt")
set a=fso.opentextfile("c:\testfile.txt",8)
Else
set a=fso.opentextfile("c:\testfile.txt",8)
End If
a.writeline(now&"————"&"第"&geshu&"格单价:"&wupin&"价钱"&jq)
a.close
End Function
Function jiage(yanshi)
Delay yanshi
Dim ss(100)
ss(0)="3131CE" //强韧
ss(1)="52423A" //威严
ss(2)="84C6C6" //狂乱
ss(3)="6B6B63" //灵魂
ss(4)="528429" //灾难
ss(5)="4A4A5B" //眼睛
ss(6)="D69473" //小篮
ss(7)="848484" //无色
ss(8)="AD73D6" //碳 175,191
ss(9)="BDB5C6" // 蓝冰
ss(10)="73194A" //小黑
ss(11)="7B7BEF" //小红
ss(12)="B5B5B5" //小白
//这里使用查找颜色来获取物品 不知道在别的电脑上是否能使用 反正在我自己的电脑上是可以用的 请教一下
uservar sss0= 23000 "强韧恶魔的邀请函"
uservar sss1= 23000 "威严"
uservar sss2= 23000 "狂乱"
uservar sss3= 3800 "灵魂"
uservar sss4= 3200 "灾难"
uservar sss5= 25000 "眼睛"
uservar sss6= 100 "小篮"
uservar sss7= 50 "无色"
uservar sss8= 50 "碳"
uservar sss9= 9000 "蓝冰"
uservar sss11= 250 "小红"
uservar sss12= 80 "小白"
uservar sss10= 120 "小黑"
Dim n,m,i,j,qian
qian=0
n=0
geshu=1
Dim kx
kx=85 //第一格物品x取色点
ux=kx
Dim ky
ky=191 //第一个物品y取色点
//扫描第一行物品,共8个物品格
for 8
// 单格物品扫描
For 13
IfColor ux,ky,ss(n),0
sss=0
If n=0
sss=sss0
ElseIf n=1
sss=sss1
ElseIf n=2
sss=sss2
ElseIf n=3
sss=sss3
ElseIf n=4
sss=sss4
ElseIf n=5
sss=sss5
ElseIf n=6
sss=sss6
ElseIf n=7
sss=sss7
ElseIf n=8
sss=sss8
ElseIf n=9
sss=sss9
ElseIf n=10
sss=sss10
ElseIf n=11
sss=sss11
ElseIf n=12
sss=sss12
End If
jiag=wupin(geshu,sss) //获取物品价钱
'Call xiejiage(geshu,jiag,sss)
'BeginThread 输出信息
Exit For
End If
n=n+1
Next
qian=qian+jiag //计算总价格
jiag=0 //价格清零
ux=ux+30 //x坐标加30,扫描下一个框内物品
geshu=geshu+1 //个数循环
n=0
Next
jiage=qian //参数传递
End Function
Function wupin(GS,JQ) //计算物品总价格 LX 查找类型
//代码太他妈有才了
//此代码论坛中有,个人觉得很好。
dim a(100)
dim b(100)
dim q(100)
number0="Attachment:\0.bmp"
number1="Attachment:\1.bmp"
number2="Attachment:\2.bmp"
number3="Attachment:\3.bmp"
number4="Attachment:\4.bmp"
number5="Attachment:\5.bmp"
number6="Attachment:\6.bmp"
number7="Attachment:\7.bmp"
number8="Attachment:\8.bmp"
number9="Attachment:\9.bmp"
cishu=1
leftx=72+(GS-1)*30 //132
upy=174 //155
rightx=99+(GS-1)*30 //162
downy=185 //235
Similar=1
lx=leftx
Dim n,m,p,i,j
n=0
m=1
p=1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number0,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=0
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number1,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=1
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number2,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=2
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number3,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=3
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number4,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=4
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number5,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=5
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number6,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=6
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number7,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=7
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number8,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=8
EndIf
wend
leftx=lx
m=m-1
While n<>m
m=n
FindPic leftx,upy,rightx,downy,number9,Similar,fx,fy
If fx>=0 and fy>=0
n=n+1
leftx=fx+1
a(n)=fx
b(n)=9
EndIf
wend
leftx=lx
m=m-1
While pa(i)
Else
j=a(i)
h=i
EndIf
i=i+1
wend
a(h)=0
q(p)=h
p=p+1
wend
g=1
u=1
num=0
//读取到有数字返回值为 num, 没读取到有数字返回值为0
If n=0 then
num=1
Else
For n
num=num+b(q(g))*10^(g-1)
g=g+1
Next
End If
'jiaqian(cishu)=num //这些都是测试时用的,可以不必理
'lx=leftx+30
'leftx=leftx+30
'rightx=rightx+30
'cishu=cishu+1
wupin=JQ*num //改初始坐标
End Function