python梦幻西游鼠标偏移_【按键盒子】梦幻西游解决鼠标漂移问题

Gosub GetFbl

//

Gosub 点击任务红名

///

//获取窗口分辨率

///

Sub GetFbl

//左上角找图

FindPic 0, 0, 1024, 768, "Attachment:\zsj.bmp", 0.9, intX1, intY1

If intX1 < 0

MessageBox "未找到窗口左上角"

Else

//定位窗口右下角

Delay 10

FindPic 0, 0, 1024, 768, "Attachment:\yxj.bmp", 0.9, intX2, intY2

If intX2 < 0

MessageBox "未找到窗口右下角"

Else

intX2 = intX2 + 20

intY2 = intY2 + 19

//计算分辨率 640X480

fx = intX2 - intX1

fy = intY2 - intY1

//MessageBox "分辨率"&fx&"X"&fy

End If

End If

End Sub

///

//点击任务中的红色名字

///

Sub 点击任务红名

Gosub GetCk

FindColorEx cx + 480,cy + 127 ,cx + 637 ,cy + 277 , &H0000F8,0,0.9,intXr,intYr

If intXr > 0

MoveToEx intXr, intYr

Delay 200

//确定漂移范围在可控范围内--找手型鼠标

FindPic 0, 0, 1024, 768, "Attachment:\shou.bmp", 0.9, intXs, intYs

If intXs > 0

Delay 500

LeftClick 1

Else

//获取鼠标实际位置,进行坐标纠正

Delay 100

//调用定位鼠标子程序

Gosub MouseDw

//计算坐标差

tmx = intXr - mx + 4

tmy = intYr - my + 4

TracePrint "相对移动鼠标,位移为:" & tmx & "," & tmy

Delay 500

MoveR tmx, tmy

Delay 200

LeftClick 1

End If

Else

MessageBox "红名坐标为:"&intXr & "," & intYr

MessageBox "未找到颜色"

End If

End Sub

///

//获取窗口坐标

///

Sub GetCk

FindPic 0, 0, 1024, 768, "Attachment:\zsj.bmp", 0.9, cx, cy

If cx > 0

//MessageBox "窗口坐标为:"&cx & "," & cy

Else

MessageBox "获取窗口坐标失败"

End If

End Sub

///

//定位鼠标

///

Sub MouseDw

intXm = - 1

While intXm <= 0

FindPic intX1,intY1,intX1+640,intY1+480,"Attachment:\鼠标.bmp",0.9,intXm,intYm

If intXm > 0

//由于盒子不支持AND所以写成多个IF语句嵌套

If intXm > (intX1+640)

intXm = - 1

Else

If intYm > (intY1+480)

intXm = - 1

Else

//鼠标尖端坐标与找图返回坐标的差值为(-7,-8)

mx = intXm - 7

my = intYm - 8

End If

End If

End If

Delay 50

TracePrint "定位鼠标中"

Wend

End Sub

你可能感兴趣的:(python梦幻西游鼠标偏移)