找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7717|回复: 2

[已回复] 错误码611,求解

[复制链接]

3

主题

0

回帖

3

积分

学前班

鲜花
0
猫粮
16
发表于 2020-6-11 09:39:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
按紫猫大佬的天天星连萌课程,做了个连连看脚本,做完之后一直报错,刚学这个,找不到问题所在。错误:第53行:名称 Check 有重复。错误码=611

[按键精灵] 纯文本查看 复制代码
Dim MapVal(9, 11), MapX1(9, 11), MapY1(9, 11), MapX2(9, 11), MapY2(9, 11),Pic(0)
Dim DisX,DisY,StartX,StartY
Dim i,j,intX,intY,ImgID,s
Dim ClickXY,result,ijArr

DisX = (866 - 209) / 6
DisY = (1632 - 756) / 8

StartX = Round(209 - 2 * DisX)
StartY = Round(756 - 2 * DisY)

Pic(0)="Attachment:1.png|Attachment:2.png|Attachment:3.png|Attachment:4.png|Attachment:5.png|Attachment:6.png|Attachment:7.png|Attachment:8.png|Attachment:9.png|Attachment:10.png|Attachment:11.png|Attachment:12.png|Attachment:13.png|Attachment:14.png|Attachment:15.png|Attachment:16.png|Attachment:17.png|Attachment:18.png|Attachment:19.png|Attachment:20.png|Attachment:21.png|Attachment:22.png|Attachment:23.png|Attachment:24.png|Attachment:25.png"

For j = 0 To 11
	For i = 0 To 9
		MapX1(i, j) = Round(StartX + DisX * i)
		MapY1(i, j) = Round(StartY + DisY * j)
		MapX2(i, j) = Round(StartX + DisX * (i + 1))
		MapY2(i, j) = Round(StartY + DisY * (j + 1))
		MapVal(i, j) = ""
		TracePrint i, j,MapX1(i, j),MapY1(i, j),MapX2(i, j),MapY2(i, j)
	Next
Next
Do
KeepCapture 

For j = 0 To 11
	For i = 0 To 9
		MapVal(i, j)=FindPic(MapX1(i, j),MapY1(i, j),MapX2(i, j),MapY2(i, j), Pic(0), "303030", 1, 0.7, intX, intY)
		If MapVal(i, j) = -1 Then 
			MapVal(i, j) = "X"
		Else 
			ClickXY = Check(i, j, MapVal(i, j))
			result = Split(ClickXY, "|")
			If result(0) = "1" Then 
				ijArr = Split(result(1),",")
				Tap MapX1(i, j) + 50, MapY1(i, j) + 50
				Tap MapX1(CInt(ijArr(0)), CInt(ijArr(1))) + 50, MapY1(CInt(ijArr(0)), CInt(ijArr(1))) + 50
				MapVal(i, j) = "X"
				MapVal(CInt(ijArr(0)), CInt(ijArr(1))) = "X"
			End If
		
		End If
	Next
Next


ReleaseCapture 

loop


Function Check(i, j, val)
	Dim t1,tArr1,xy1,index1,xyArr1,t2,tArr2,index2,xy2,t3,tArr3
	
	Check ="0"
	
	t1 = getHeng(i, j, val)'第一次水平方向查找
	tArr1 = Split(t1, "|")
	If tArr1(0) = "1" Then 
		Check = t1 '第一次水平方向有结果了
		Exit Function
	ElseIf tArr1(0) = "0" Then 
		index1 = 0
		For Each xy1 In tArr1
			If index1 > 0 Then '从第二个元素开始,第一个是元素结果,非坐标
				xyArr1 = Split(xy1, ",")
				t2=getSu(Cint(xyArr1(0)),Cint(xyArr1(1)),val)'第二次垂直方向查找
				tArr2 = Split(t2, "|")
				If tArr2(0) = "1" Then 
					Check = t2 '第二次垂直向有结果了
					Exit Function
				ElseIf tArr2(0) = "0" Then
					index2 = 0
					
					For Each xy2 In tArr2
						If index2 > 0 Then
							xyArr2 = Split(xy2, ",")
							t3=getHeng(Cint(xyArr2(0)),Cint(xyArr2(1)),val)'第三次水平方向查找
							tArr3 = Split(t3, "|")
							If tArr3(0) = "1" Then 
								Check =t3'第三次水平方向有结果了
								Exit Function
							End If
						End If
						index2 = index2 + 1
					Next
				End If
				
			End If
			index1 = index1 + 1
		Next
	End If
	
	
	t1 = getSu(i, j, val)'第一次垂直方向查找
	tArr1 = Split(t1, "|")
	If tArr1(0) = "1" Then 
		Check = t1 '第一次垂直方向有结果了
		Exit Function
	ElseIf tArr1(0) = "0" Then 
		index1 = 0
		For Each xy1 In tArr1
			If index1 > 0 Then '从第二个元素开始,第一个是元素结果,非坐标
				xyArr1 = Split(xy1, ",")
				t2=getHeng(Cint(xyArr1(0)),Cint(xyArr1(1)),val)'第二次水平方向查找
				tArr2 = Split(t2, "|")
				If tArr2(0) = "1" Then 
					Check = t2 '第二次水平向有结果了
					Exit Function
				ElseIf tArr2(0) = "0" Then
					index2 = 0
					
					For Each xy2 In tArr2
						If index2 > 0 Then
							xyArr2 = Split(xy2, ",")
							t3=getSu(Cint(xyArr2(0)),Cint(xyArr2(1)),val)'第三次垂直方向查找
							tArr3 = Split(t3, "|")
							If tArr3(0) = "1" Then 
								Check =t3'第三次垂直方向有结果了
								Exit Function
							End If
						End If
						index2 = index2 + 1
					Next
				End If
				
			End If
			index1 = index1 + 1
		Next
	End If
	
End Function


Function getHeng(i, j, val)
	Dim s1,ss1,s2,ss2
	s1 = getLeft(i, j, val)
	ss1 = Split(s1, "|")
	If ss1(0) = "1" Then 
		getHeng = s1
		Exit Function
	End If
	
	s2=getRight(i, j, val)
	ss2 = Split(s2, "|")
	If ss2(0) = "1" Then 
		getHeng = s2
		Exit Function
	End If
	
	If ss1(0) = "-1" Then 
		getHeng = s2
	Else 
		If ss2(0) = "-1" Then 
			getHeng = s1
		Else 
			getHeng = s1 & Right(s2, Len(s2) - 1)
		End If
	End If
End Function
Function getSu(i, j, val)
	Dim s1,ss1,s2,ss2
	s1 = getUp(i, j, val)
	ss1 = Split(s1, "|")
	If ss1(0) = "1" Then 
		getSu = s1
		Exit Function
	End If
	
	s2=getDown(i, j, val)
	ss2 = Split(s2, "|")
	If ss2(0) = "1" Then 
		getSu = s2
		Exit Function
	End If
	
	If ss1(0) = "-1" Then 
		getSu = s2
	Else 
		If ss2(0) = "-1" Then 
			getSu = s1
		Else 
			getSu = s1 & Right(s2, Len(s2) - 1)
		End If
	End If
End Function

Function getLeft(ii, j, val)
	Dim i,s
	s = "-1"
	For i = ii - 1 To 0 step - 1
		If MapVal(i, j) = "X" Then 
			If s = "-1" Then 
				s="0|" & i & "," & j
			Else 
				s = s & "|" & i & "," & j
			End If
		Else 
			If MapVal(i, j) = val Then 
				s = "1|" & i & "," & j
			End If 
			Exit For 
		End If
	Next
	getLeft = s
End Function
Function getRight(ii, j, val)
	Dim i,s
	s = "-1"
	For i = ii + 1 To 9
		If MapVal(i, j) = "X" Then 
			If s = "-1" Then 
				s="0|" & i & "," & j
			Else 
				s = s & "|" & i & "," & j
			End If
		Else 
			If MapVal(i, j) = val Then 
				s = "1|" & i & "," & j
			End If 
			Exit For 
		End If
	Next
	getRight = s
End Function
Function getUp(i, jj, val)
//	Dim i,s
	s = "-1"
	For j = jj - 1 To 0 step - 1
		If MapVal(i, j) = "X" Then 
			If s = "-1" Then 
				s="0|" & i & "," & j
			Else 
				s = s & "|" & i & "," & j
			End If
		Else 
			If MapVal(i, j) = val Then 
				s = "1|" & i & "," & j
			End If 
			Exit For 
		End If
	Next
	getUp = s
End Function
Function getDown(i, jj, val)
//	Dim i,s
	s = "-1"
	For j = jj + 1 To 11
		If MapVal(i, j) = "X" Then 
			If s = "-1" Then 
				s="0|" & i & "," & j
			Else 
				s = s & "|" & i & "," & j
			End If
		Else 
			If MapVal(i, j) = val Then 
				s = "1|" & i & "," & j
			End If 
			Exit For 
		End If
	Next
	getDown = s
End Function

楼主热帖
  • 打卡等级:开宗立派

1087

主题

2141

回帖

4335

积分

院长

鲜花
9
猫粮
7413
QQ
发表于 2020-6-11 09:46:45 | 显示全部楼层
名称重复了, 如果找不到哪里重复的话, 那你把check函数改个名字, 比如改成check2之类的, 注意返回值部分也要一起修改

7

主题

91

回帖

105

积分

按键电脑班学员

鲜花
0
猫粮
485
QQ
发表于 2020-6-12 14:04:33 | 显示全部楼层
以查明,应该是些变量名以被按键命令占用了所以不能使用
12.png
22.png
支持紫猫老师,..接单[网页,下注,手游]办公 各种全自动脚本 QQ 330854145
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|紫猫编程学园

GMT+8, 2024-11-22 02:33

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表