1) При некоторых поклевках бот не желает находить картинку, следовательно багается и больше не возобновляет работу.
2) Не совсем понял как привязать к окну бота. В визуальном редакторе поставил галочку "Фоновый режим" выбрал "Окно" . скопировал код, не желает работать. без привязки работает.
Может кто поймет в чем проблема этих проблем. Код привожу ниже.
CODE:
int col_KIB, ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
int Image_0_KIB[24][24];
int Image_1_KIB[24][24];
start_();
m_KIB1: mouse_(300, 1, 61+rand(-10, 10), 65+rand(-10, 10), 100);
m_KIB2: key_(84, 1, 100, 100);
key_(71, 2, 500, 0);
if (findimage_(#Image_0_KIB[0][0], 17000, 100, 0, 0, 0, 0, 0, -1, 0, 70, 1, 551, 491, 626, 541, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB5;
else goto m_KIB2;
m_KIB5: key_(71, 3, 10, 0);
key_(32, 1, 100, 100);
m_KIB7: key_(71, 2, 100, 300);
key_(71, 3, 0, 100);
key_(72, 2, 100, 300);
key_(72, 3, 100, 100);
if (findimage_(#Image_1_KIB[0][0], 1000, 0, 0, 1, 5, 5, 100, -1, 0, 100, 1, 981, 30, 1020, 64, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB1;
else goto m_KIB7;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
function key_(int k, int m, int p1, int p2)
{
pause(p1);
if (m==1) key(k);
if (m==2) keydown(k);
if (m==3) keyup(k);
pause(p2);
}
function mouse_(int p1, int m, int xm, int ym, int p2)
{
pause(p1);
if (m==1) mouse(LEFT, xm, ym);
if (m==2) mouse(MIDDLE, xm, ym);
if (m==3) mouse(RIGHT, xm, ym);
if (m==4) mousedown(LEFT, xm, ym);
if (m==5) mousedown(MIDDLE, xm, ym);
if (m==6) mousedown(RIGHT, xm, ym);
if (m==7) mouseup(LEFT, xm, ym);
if (m==8) mouseup(MIDDLE, xm, ym);
if (m==9) mouseup(RIGHT, xm, ym);
if (m==10) mousemove(xm, ym);
pause(p2);
}
function findimage_(int #Image, int t, int p1, int p2, int m, int xm, int ym, int p3, int fon, int r, int p, int k, int xs, int ys, int xf, int yf, int#sum, int#x, int#y)
{
int timKIB, sumKIB, xKIB, yKIB;
pause(p1);
sumKIB=0;
if (t!=1) timKIB=gettime();
a: if (r==0 && p==100){sum=findimage(k, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1); if (sum>0) goto e;}
else {sum=findimage(k, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1); if (sum>0) goto e;}
if (t==0) return 0;
if (gettime()-timKIB<t){sleep(20); goto a;}
return 0;
e: sumKIB=sum; xKIB=x[0]; yKIB=y[0];
pause(p2);
if (m==1){mouse(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==10){mousemove(xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
return sumKIB;
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "C:\kl.bmp");
loadimage (#Image_1_KIB[0][0], "C:\vihod.bmp");
}
int Image_0_KIB[24][24];
int Image_1_KIB[24][24];
start_();
m_KIB1: mouse_(300, 1, 61+rand(-10, 10), 65+rand(-10, 10), 100);
m_KIB2: key_(84, 1, 100, 100);
key_(71, 2, 500, 0);
if (findimage_(#Image_0_KIB[0][0], 17000, 100, 0, 0, 0, 0, 0, -1, 0, 70, 1, 551, 491, 626, 541, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB5;
else goto m_KIB2;
m_KIB5: key_(71, 3, 10, 0);
key_(32, 1, 100, 100);
m_KIB7: key_(71, 2, 100, 300);
key_(71, 3, 0, 100);
key_(72, 2, 100, 300);
key_(72, 3, 100, 100);
if (findimage_(#Image_1_KIB[0][0], 1000, 0, 0, 1, 5, 5, 100, -1, 0, 100, 1, 981, 30, 1020, 64, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB1;
else goto m_KIB7;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
function key_(int k, int m, int p1, int p2)
{
pause(p1);
if (m==1) key(k);
if (m==2) keydown(k);
if (m==3) keyup(k);
pause(p2);
}
function mouse_(int p1, int m, int xm, int ym, int p2)
{
pause(p1);
if (m==1) mouse(LEFT, xm, ym);
if (m==2) mouse(MIDDLE, xm, ym);
if (m==3) mouse(RIGHT, xm, ym);
if (m==4) mousedown(LEFT, xm, ym);
if (m==5) mousedown(MIDDLE, xm, ym);
if (m==6) mousedown(RIGHT, xm, ym);
if (m==7) mouseup(LEFT, xm, ym);
if (m==8) mouseup(MIDDLE, xm, ym);
if (m==9) mouseup(RIGHT, xm, ym);
if (m==10) mousemove(xm, ym);
pause(p2);
}
function findimage_(int #Image, int t, int p1, int p2, int m, int xm, int ym, int p3, int fon, int r, int p, int k, int xs, int ys, int xf, int yf, int#sum, int#x, int#y)
{
int timKIB, sumKIB, xKIB, yKIB;
pause(p1);
sumKIB=0;
if (t!=1) timKIB=gettime();
a: if (r==0 && p==100){sum=findimage(k, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1); if (sum>0) goto e;}
else {sum=findimage(k, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1); if (sum>0) goto e;}
if (t==0) return 0;
if (gettime()-timKIB<t){sleep(20); goto a;}
return 0;
e: sumKIB=sum; xKIB=x[0]; yKIB=y[0];
pause(p2);
if (m==1){mouse(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==10){mousemove(xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
return sumKIB;
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "C:\kl.bmp");
loadimage (#Image_1_KIB[0][0], "C:\vihod.bmp");
}