所以我试图在给定区域的屏幕中间找到某种模式.我正在使用AutoItX库和PixelSearch方法.
它没有返回已发现的模式,但如果我调整矩形的绳索,0, 0则表明已找到该模式.
使用以下脚本:
public void MonsterScan()
{
if(SixStarMax() == true)
{
Console.WriteLine("Pattern found");
}
}
public bool SixStarMax()
{
Rectangle rect = new Rectangle(1980, 630, 1240, 180);
autoSumPoint = AutoItX.PixelSearch(rect, 0xF8F0E0); // 0xF8F0E0
autoSumPoint2 = AutoItX.PixelSearch(rect, 0xB7AD9F); // 0xB7AD9F
autoSumPoint3 = AutoItX.PixelSearch(rect, 0xCDC6B8); // 0xCDC6B8
autoSumPoint4 = AutoItX.PixelSearch(rect, 0x949084); // 0x949084
if (rect.Contains(autoSumPoint2) == true && rect.Contains(autoSumPoint2) == true && rect.Contains(autoSumPoint3) == true && rect.Contains(autoSumPoint4) == true)
{
AutoItX.MouseMove(autoSumPoint.X, autoSumPoint.Y);
return true;
}
else
{
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:
试图调整坐标到我的第一个屏幕,我得到一个错误抛出.
System.AccessViolationException: 'An attempt was made to read or write to protected memory. This often indicates that other memory is damaged. '
Run Code Online (Sandbox Code Playgroud)