Работаю недавно с программой и столкнулся с одной сложностью.
Делал скрип для фарма ресурсов в heroes charge
По программе все просто
Старт=>поиск врага=> проверка на антибота =>если не антибот, то проверка на наличие 1 из 3 героев=>если их нет, то нападает.
если есть антибот, то скрипт идет с начала.
Если есть 1 из 3 героев, то поиск сначала.
Первый прогон скрипт делает классно, но после того как он первый раз нашел 1 из 3 персонажей и не напал на него и нашел нового врага, он уже не ищет этих 3 героев.
CODE:
int col_KIB, ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
int Image_0_KIB[36][53];
int Image_1_KIB[169][19];
int Image_2_KIB[38][48];
int Image_3_KIB[185][49];
int Image_4_KIB[162][50];
int Image_5_KIB[35][54];
int Image_6_KIB[116][35];
int Image_7_KIB[70][74];
int Image_8_KIB[86][68];
int Image_9_KIB[84][83];
start_();
findimage_(#Image_3_KIB[0][0], 0, 10000, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
m_KIB1: if (findimage_(#Image_1_KIB[0][0], 5000, 0, 1500, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB5;
else goto m_KIB0;
m_KIB5: findimage_(#Image_4_KIB[0][0], 10000, 500, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB0: if (findimage_(#Image_0_KIB[0][0], 3000, 0, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB2;
m_KIB6: findimage_(#Image_4_KIB[0][0], 10000, 500, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB2: if (findimage_(#Image_2_KIB[0][0], 4000, 2000, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB8;
m_KIB7: findimage_(#Image_4_KIB[0][0], 0, 500, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB8: if (findimage_(#Image_5_KIB[0][0], 5000, 3000, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB9;
m_KIB9: findimage_(#Image_6_KIB[0][0], 5000, 500, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_7_KIB[0][0], 2000, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_8_KIB[0][0], 15000, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_9_KIB[0][0], 40000, 0, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB7;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
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:\bot\ningja.bmp");
loadimage (#Image_1_KIB[0][0], "C:\bot\cant beat.bmp");
loadimage (#Image_2_KIB[0][0], "C:\bot\rabbit.bmp");
loadimage (#Image_3_KIB[0][0], "C:\bot\find enimy.bmp");
loadimage (#Image_4_KIB[0][0], "C:\bot\find again.bmp");
loadimage (#Image_5_KIB[0][0], "C:\bot\svet.bmp");
loadimage (#Image_6_KIB[0][0], "C:\bot\grabez.bmp");
loadimage (#Image_7_KIB[0][0], "C:\bot\attack go go.bmp");
loadimage (#Image_8_KIB[0][0], "C:\bot\autofi.bmp");
loadimage (#Image_9_KIB[0][0], "C:\bot\next go.bmp");
}
int Image_0_KIB[36][53];
int Image_1_KIB[169][19];
int Image_2_KIB[38][48];
int Image_3_KIB[185][49];
int Image_4_KIB[162][50];
int Image_5_KIB[35][54];
int Image_6_KIB[116][35];
int Image_7_KIB[70][74];
int Image_8_KIB[86][68];
int Image_9_KIB[84][83];
start_();
findimage_(#Image_3_KIB[0][0], 0, 10000, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
m_KIB1: if (findimage_(#Image_1_KIB[0][0], 5000, 0, 1500, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB5;
else goto m_KIB0;
m_KIB5: findimage_(#Image_4_KIB[0][0], 10000, 500, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB0: if (findimage_(#Image_0_KIB[0][0], 3000, 0, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB2;
m_KIB6: findimage_(#Image_4_KIB[0][0], 10000, 500, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB2: if (findimage_(#Image_2_KIB[0][0], 4000, 2000, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB8;
m_KIB7: findimage_(#Image_4_KIB[0][0], 0, 500, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB1;
m_KIB8: if (findimage_(#Image_5_KIB[0][0], 5000, 3000, 1000, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB6;
else goto m_KIB9;
m_KIB9: findimage_(#Image_6_KIB[0][0], 5000, 500, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_7_KIB[0][0], 2000, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_8_KIB[0][0], 15000, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
findimage_(#Image_9_KIB[0][0], 40000, 0, 0, 1, 0, 0, 2000, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB); goto m_KIB7;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
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:\bot\ningja.bmp");
loadimage (#Image_1_KIB[0][0], "C:\bot\cant beat.bmp");
loadimage (#Image_2_KIB[0][0], "C:\bot\rabbit.bmp");
loadimage (#Image_3_KIB[0][0], "C:\bot\find enimy.bmp");
loadimage (#Image_4_KIB[0][0], "C:\bot\find again.bmp");
loadimage (#Image_5_KIB[0][0], "C:\bot\svet.bmp");
loadimage (#Image_6_KIB[0][0], "C:\bot\grabez.bmp");
loadimage (#Image_7_KIB[0][0], "C:\bot\attack go go.bmp");
loadimage (#Image_8_KIB[0][0], "C:\bot\autofi.bmp");
loadimage (#Image_9_KIB[0][0], "C:\bot\next go.bmp");
}
Подскажите с чем может быть проблема.
Спасибо