forked from datehoer/studygoodcountry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path挑战答题.mq
142 lines (141 loc) · 5.02 KB
/
挑战答题.mq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// 简单开源一下这个挑战答题的功能,因为我发现这个其实很好想,但是挺难做的。
// 请勿将它使用到商业用途,因为会被抓。
// 仅供学习交流。
Function 挑战答题
Dim num = 1
Swipe 364, 1161, 364, 735
Delay 1500
Swipe 364, 1161, 364, 935
Delay 1500
Dim intX,intY
FindPic 0,0,0,0,"Attachment:挑战答题识别.png","000000",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
Tap intX+500,intY
TracePrint "挑战答题"
Delay 5000
Else
Tap 41, 102
Delay 1000
Exit Function
End If
Import "shanhai.lua"
Import "zm.luae" //导入插件,只需执行一次
zm.Init //初始化插件,只需执行一次
Dim t(),题目
If Not zm.OcrBaiDuInit("api""密钥") Then
TracePrint "初始化设置百度云识别失败"
EndScript
End If
//全屏识别文字
Do
For 9
题目 = zm.OcrBaiDu(443,290,676,349)
TracePrint 题目
dim a = zm.HttpGet("http://www.syiban.com/search/index/init.html?modelid=1&q="&题目)
TracePrint a
//LUA模式匹配,返回数组
dim RegexArr = shanhai.RegexFind(a,"答案:(.-)%<")
TracePrint RegexArr(0)
If RegexArr(0) = null Then
//76,294,323,343
题目 = zm.OcrBaiDu(76,294,323,343)
TracePrint 题目
a = zm.HttpGet("http://www.syiban.com/search/index/init.html?modelid=1&q="&题目)
TracePrint a
//LUA模式匹配,返回数组
RegexArr = shanhai.RegexFind(a,"答案:(.-)%<")
If RegexArr(0) = null Then
// 349,349,531,394
题目 = zm.OcrBaiDu(349,349,531,394)
TracePrint 题目
a = zm.HttpGet("http://www.syiban.com/search/index/init.html?modelid=1&q="&题目)
TracePrint a
TracePrint RegexArr(0)
If RegexArr(0) = null Then
TracePrint "null"
Tap 51, 90
Delay 1500
Tap 220, 756
Delay 1500
Exit For
End If
End If
End If
Dim newanswer = shanhai.RegexFind(RegexArr(0),"[A-Z]")
TracePrint newanswer(0)
If num > 7 Then
Tap 341, 785
Delay 1500
End If
//判断选项位置
FindPic 0,0,0,0,"Attachment:句号判断1.png","000000",2,0.9,intX,intY
If intX > -1 And intY > -1 Then
Tap intX,intY
TracePrint "a"&intX,intY
Delay 1500
Else
FindPic 0, 0, 0, 0, "Attachment:句号判断2.png", "000000", 2, 0.9, intX, intY
If intX > -1 And intY > -1 Then
TracePrint "b"&intX,intY
Delay 1500
Else
FindPic 0,0,0,0,"Attachment:句号判断3.png","000000",2,0.9,intX,intY
If intX > -1 And intY > -1 Then
TracePrint "c"&intX,intY
Delay 1500
End If
End If
End If
If newanswer(0) = "A" Then
TracePrint "a"
Tap intX, intY + 170
TracePrint intX, intY + 170
Delay 1500
ElseIf newanswer(0) = "B" Then
TracePrint "b"
Tap intX, intY + 290
TracePrint intX, intY + 290
Delay 1500
ElseIf newanswer(0) = "C" Then
TracePrint "c"
Tap intX, intY + 410
TracePrint intX, intY + 410
Delay 1500
ElseIf newanswer(0) = "D" Then
TracePrint "d"
Tap intX, intY + 540
TracePrint intX, intY + 540
Delay 1500
Else
Tap 341, 785
Delay 1500
End If
FindPic 0,0,0,0,"Attachment:挑战答题意外结束.png","000000",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
Tap 217,886
Delay 1500
Tap 51, 92
Delay 1500
Exit For
End If
Next
FindPic 0,0,0,0,"Attachment:挑战答题意外结束.png","000000",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
Tap 217,886
Delay 1500
Tap 51, 92
Delay 1500
End If
Delay 3000
FindPic 0,0,0,0,"Attachment:挑战答题识别.png","000000",0,0.9,intX,intY
If intX > -1 And intY > -1 Then
Tap intX+500,intY
TracePrint "挑战答题"
Delay 5000
Else
Tap 41, 102
Delay 1000
Exit Function
End If
Loop
End Function