Code: Select all
matchcolor = makeColor(93, 157, 88);
x,y = pixelSearch(hdc, matchcolor, 186, 0, 206, 16, 10, 2);
r,g,b = getPixel(hdc, 196, 6);
printf("RGB: %d, %d, %d", r, g, b);
printf("x: %d\n",x);
This is the full code..
Code: Select all
setStartKey(key.VK_DELETE);
setStopKey(key.VK_END);
function main()
--attach( findWindow("Wurm Online 3.0") );
keyboardSetDelay(100);
windows = 1; --Not really used atm...
times = 0; --Varible to hold the amount of times i've mined...
window = findWindow("Wurm Online 3.0.1")
hdc = openDC(window);
printf("hdc: %s\n", hdc);
winX, winY, wWidth, wHeight = windowRect(window);
printf("X %d, Y %d, W %d, H %d \n", winX, winY, wWidth, wHeight);
--Just an easy way to make sure the window has focus....
mouseSet(math.random((wWidth/2)-10, (wWidth/2)+10)+winX, math.random((wHeight/2)-10, (wHeight/2)+10)+winY);
yrest(1000);
mouseLClick();
yrest(1000);
while(times < 100) do
if(windows >= 1) then
matchcolor = makeColor(93, 157, 88);
x,y = pixelSearch(hdc, matchcolor, 186, 0, 206, 16, 10, 2);
r,g,b = getPixel(hdc, 196, 6);
printf("RGB: %d, %d, %d", r, g, b);
printf("x: %d\n",x);
yrest(500);
if(x > -1) then
yrest(500);
mouseSet(math.random((wWidth/2)-10, (wWidth/2)+10)+winX, math.random((wHeight/2)-10, (wHeight/2)+10)+winY);
yrest(500);
keyboardPress(key.VK_M);
times = times+1;
printf("Times: %i\n", times);
end
end
end
printf("Mined %i times. All done.\n", times);
--detach();
end
startMacro(main);