Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于/截屏查找图片颜色并单击对应的点函数的使用方法 #137

Open
406722575 opened this issue Aug 19, 2021 · 1 comment

Comments

@406722575
Copy link

// 截屏查找图片颜色并单击对应的点
function cs_click(num, rgb, xr, yr, wr, hr, flipup) {
while (num--) {
let img = captureScreen()
if (flipup != undefined) img = images.rotate(img, 180)
let point = findColor(img, rgb, { region: [img.getWidth() * xr, img.getHeight() * yr, img.getWidth() * wr, img.getHeight() * hr], threshold: 8 })
if (point) {
if (flipup != undefined) {
point.x = img.getWidth() - point.x; point.y = img.getHeight() - point.y
}
return click(point.x, point.y);
}
if (num) sleep(1000)
}
return false
}

cs_click(6, '#fed362', 0.2, 0.05, 0.7, 0.4, true) //领取套装

上面的参数通过什么方式来获取

@winson1740
Copy link

winson1740 commented Oct 2, 2021

// 截屏查找图片颜色并单击对应的点 function cs_click(num, rgb, xr, yr, wr, hr, flipup) { while (num--) { let img = captureScreen() if (flipup != undefined) img = images.rotate(img, 180) let point = findColor(img, rgb, { region: [img.getWidth() * xr, img.getHeight() * yr, img.getWidth() * wr, img.getHeight() * hr], threshold: 8 }) if (point) { if (flipup != undefined) { point.x = img.getWidth() - point.x; point.y = img.getHeight() - point.y } return click(point.x, point.y); } if (num) sleep(1000) } return false }

cs_click(6, '#fed362', 0.2, 0.05, 0.7, 0.4, true) //领取套装

上面的参数通过什么方式来获取

这个可以通过取色、取坐标代码来实现,具体你可以搜一下,不明白的是为什么要将图片翻转180度?是因为取色不方便吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants