Помогите найти проблему в построении логики
Скрипт работает без таймера. Дожидается картинку, затем кликает в нужном месте (это я делал с помощью ожидания изображения.
Но как только делаю все тоже в таймере (предварительно отключив ожидание, то просто ничего не происходит)
Уже и "блоки кода" убирал и переставлял..
в этом окне уже и клик сразу пытался поставить - ничего
Код (Отобразить)
int col_KIB, ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
int Image_0_KIB[95][33];
start_();
m_KIB1: enabletimer (1);
goto m_KIB1;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
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) mousedbl(LEFT, xm, ym);
if (m==11) mousedbl(MIDDLE, xm, ym);
if (m==12) mousedbl(RIGHT, xm, ym);
if (m==13) mousemove(xm, ym);
pause(p2);
}
function findimage_(int #Image, int t, int p1, int p2, int m, int xm, int ym, int mov_m, int mov_x, int mov_y, int p3, int wait, int cycle, 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, tx, ty, tcycle=0;
sty: pause(p1);
sumKIB=0;
if (t!=0) 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); goto hy;}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==10){mousedbl(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==11){mousedbl(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==12){mousedbl(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==13)mousemove(xs+xKIB+xm, ys+yKIB+ym);
hy: if (mov_m==1)mousemove(mov_x, mov_y);
if (m>0 && m<14)pause(p3);
if (wait!=-1)
{
for (int ttim=gettime(); gettime()-ttim<wait; sleep(20))
{
if (r==0 && p==100){if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1)==0)return sumKIB;}
else {if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1)==0)return sumKIB;}
}
if (tcycle<cycle){tcycle++; goto sty;}
return 0;
}
return sumKIB;
}
function mouse_T1(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) mousedbl(LEFT, xm, ym);
if (m==11) mousedbl(MIDDLE, xm, ym);
if (m==12) mousedbl(RIGHT, xm, ym);
if (m==13) mousemove(xm, ym);
pause(p2);
}
function findimage_T1(int #Image, int t, int p1, int p2, int m, int xm, int ym, int mov_m, int mov_x, int mov_y, int p3, int wait, int cycle, 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, tx, ty, tcycle=0;
sty: pause(p1);
sumKIB=0;
if (t!=0) 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); goto hy;}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==10){mousedbl(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==11){mousedbl(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==12){mousedbl(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==13)mousemove(xs+xKIB+xm, ys+yKIB+ym);
hy: if (mov_m==1)mousemove(mov_x, mov_y);
if (m>0 && m<14)pause(p3);
if (wait!=-1)
{
for (int ttim=gettime(); gettime()-ttim<wait; sleep(20))
{
if (r==0 && p==100){if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1)==0)return sumKIB;}
else {if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1)==0)return sumKIB;}
}
if (tcycle<cycle){tcycle++; goto sty;}
return 0;
}
return sumKIB;
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "E:\Games\kibor_set\screens\trumtest.bmp");
}
CREATE_TIMER(1, 2000)
{
if (findimage_T1(#Image_0_KIB[0][0], 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, -1, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB_T1, #x_KIB_T1, #y_KIB_T1)>0) goto m_KIB2_T1;
else goto m_KIB1_T1;
m_KIB1_T1:
goto exit_KIB_T1;
m_KIB2_T1: mouse_T1(500, 1, 166, 76, 0);
exit_KIB_T1:;
}
int Image_0_KIB[95][33];
start_();
m_KIB1: enabletimer (1);
goto m_KIB1;
function start_()
{
getdisplay(col_KIB, ex_KIB, ey_KIB);
load_image_();
pause(1000);
}
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) mousedbl(LEFT, xm, ym);
if (m==11) mousedbl(MIDDLE, xm, ym);
if (m==12) mousedbl(RIGHT, xm, ym);
if (m==13) mousemove(xm, ym);
pause(p2);
}
function findimage_(int #Image, int t, int p1, int p2, int m, int xm, int ym, int mov_m, int mov_x, int mov_y, int p3, int wait, int cycle, 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, tx, ty, tcycle=0;
sty: pause(p1);
sumKIB=0;
if (t!=0) 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); goto hy;}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==10){mousedbl(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==11){mousedbl(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==12){mousedbl(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==13)mousemove(xs+xKIB+xm, ys+yKIB+ym);
hy: if (mov_m==1)mousemove(mov_x, mov_y);
if (m>0 && m<14)pause(p3);
if (wait!=-1)
{
for (int ttim=gettime(); gettime()-ttim<wait; sleep(20))
{
if (r==0 && p==100){if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1)==0)return sumKIB;}
else {if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1)==0)return sumKIB;}
}
if (tcycle<cycle){tcycle++; goto sty;}
return 0;
}
return sumKIB;
}
function mouse_T1(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) mousedbl(LEFT, xm, ym);
if (m==11) mousedbl(MIDDLE, xm, ym);
if (m==12) mousedbl(RIGHT, xm, ym);
if (m==13) mousemove(xm, ym);
pause(p2);
}
function findimage_T1(int #Image, int t, int p1, int p2, int m, int xm, int ym, int mov_m, int mov_x, int mov_y, int p3, int wait, int cycle, 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, tx, ty, tcycle=0;
sty: pause(p1);
sumKIB=0;
if (t!=0) 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); goto hy;}
if (m==2){mouse(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==3){mouse(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==4){mousedown(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==5){mousedown(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==6){mousedown(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==7){mouseup(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==8){mouseup(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==9){mouseup(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==10){mousedbl(LEFT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==11){mousedbl(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==12){mousedbl(RIGHT, xs+xKIB+xm, ys+yKIB+ym); goto hy;}
if (m==13)mousemove(xs+xKIB+xm, ys+yKIB+ym);
hy: if (mov_m==1)mousemove(mov_x, mov_y);
if (m>0 && m<14)pause(p3);
if (wait!=-1)
{
for (int ttim=gettime(); gettime()-ttim<wait; sleep(20))
{
if (r==0 && p==100){if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, -1)==0)return sumKIB;}
else {if (findimage(1, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, r, r, r, r, r, r, p, 1, -1)==0)return sumKIB;}
}
if (tcycle<cycle){tcycle++; goto sty;}
return 0;
}
return sumKIB;
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "E:\Games\kibor_set\screens\trumtest.bmp");
}
CREATE_TIMER(1, 2000)
{
if (findimage_T1(#Image_0_KIB[0][0], 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, -1, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB_T1, #x_KIB_T1, #y_KIB_T1)>0) goto m_KIB2_T1;
else goto m_KIB1_T1;
m_KIB1_T1:
goto exit_KIB_T1;
m_KIB2_T1: mouse_T1(500, 1, 166, 76, 0);
exit_KIB_T1:;
}
Чтение самого кода мне ничего не дает ибо кибор пытаюсь освоить из-за его графического движка. Но начинаю понимать, что без языка тут тоже далеко не уедешь..
Плиз, нид хэлп