|
马上加入TC
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 自由的风 于 2014-3-2 01:12 编辑
- namespace 自游代答
- 答题对象, 题号, 发送时间, 答案
- 主帐号, 主帐号密码
- 子帐号, 子帐号密码
- 答题卡, 文件路径, 超时最小值
- function 初始化()
-
- //注册插件
- if(help.regdll(system.getprocesspath() & "\\zydd.dll",true)==false)
- help.messagebox("答题插件注册失败")
- help.exit()
- endif
-
- //创建对象
- 答题对象 = com("zy.zydd")
-
-
- //********************
- 主帐号 = "测试" //网站注册的帐号
- 主帐号密码 = "123456"
- 子帐号 = "test"
- 子帐号密码 = "123456"
- 答题卡 = "ADDIQZOLZDRCUGCBFCHBMHSE"
- 文件路径 = help.getrcpath("rc:yzm.bmp")
- 超时最小值 = 60
- //********************
-
- //初始设置
- //********************
- //调用一次即可,非必要
- //参数1:请求方式 0异步(默认) 1同步
- //参数2:异步等待时间 默认10000毫秒
- //参数3:日志路径 默认插件同级目录
- ret = 答题对象.InitialSet(0, 10000, "D:\\zydd.log")
- if(ret==1)
- list.addstring("list1","初始设置成功")
- else
- list.addstring("list1","初始设置失败")
- endif
-
- endfunction
- function button1_click()//发送文件(答题卡),该函数调用最小间隔时间为1秒
- 题号 = 答题对象.SendFile(主帐号, "", "", "", 答题卡, 1001, 文件路径, 超时最小值)
- if ( str.strleng(题号) == 16)
- list.addstring("list1","发送成功,题目编号:" & 题号)
- list.addstring("list1","答题卡当前剩余题分:" & 答题对象.GetCredits(题号))
- else
- list.addstring("list1","发送失败,错误信息:" & 答题对象.GetErrInfo(题号))
- endif
- 发送时间 = datetime.now()
- endfunction
- function button2_click()//发送文件(子帐号),该函数调用最小间隔时间为1秒
- 题号 = 答题对象.SendFile(主帐号, "", 子帐号, 子帐号密码, "", 1001, 文件路径, 超时最小值)
- if ( str.strleng(题号) == 16)
- list.addstring("list1","发送成功,题目编号:" & 题号)
- list.addstring("list1","子帐号当前剩余题分:" & 答题对象.GetCredits(题号))
- else
- list.addstring("list1","发送失败,错误信息:" & 答题对象.GetErrInfo(题号))
- endif
- 发送时间 = datetime.now()
- endfunction
- function button3_click()//发送文件(主帐号),该函数调用最小间隔时间为1秒
- 题号 = 答题对象.SendFile(主帐号, 主帐号密码, "", "", "", 1001, 文件路径, 超时最小值)
- if ( str.strleng(题号) == 16)
- list.addstring("list1","发送成功,题目编号:" & 题号)
- list.addstring("list1","主帐号当前剩余题分:" & 答题对象.GetCredits(题号))
- else
- list.addstring("list1","发送失败,错误信息:" & 答题对象.GetErrInfo(题号))
- endif
- 发送时间 = datetime.now()
- endfunction
- function button4_click()//获取答案
- if ( str.strleng(题号) == 16)
- 答案 = "#STA001"
- 循环 (答案 == "#STA001")
- 答案 = 答题对象.GetAnswer(题号)
- if (datetime.diff("s", 发送时间, datetime.now()) > 超时最小值)
- 答案 = "答题超时"
- endif
- help.sleep(500)
- 循环结束
- list.addstring("list1","收到答案:" & 答案)
- else
- list.addstring("list1","题号错误")
- endif
- endfunction
- function button5_click()//答案报错
- //调用Report前先须判断答案对错,只有答案错误的才能调用
- //每个项目判断方式各有不同,如:
- //有的是出现新的验证码
- //有的是角色进入监狱
- //有的是角色掉线
- //……
- //……
- ret = 答题对象.Report(题号)
- if (ret == 1)
- list.addstring("list1","报错成功")
- else
- list.addstring("list1","报错失败")
- endif
- endfunction
- function button6_click()//子帐号注册
- list.addstring("list1",答题对象.Register(主帐号, 子帐号, 子帐号密码, 答题卡))
- endfunction
- function button7_click()//子帐号充值
- list.addstring("list1",答题对象.Pay(子帐号, 答题卡))
- endfunction
- function button8_click()//子帐号改密
- list.addstring("list1",答题对象.Password(子帐号, 子帐号密码, "654321"))
- endfunction
- endnamespace
复制代码 插件下载 http://dd.zyyou.com/doc/zydd.zip |
|