Выложил новую версию.
Доработал движок. Устранил много недоработок. Провел всевозможные тесты, при которых некоторых раньше не работало.
Список тестов.
CODE:
/*
new int ii[5][20][50];
int x, y;
pause(1000);
loadimage (#ii[0][0][0], "C:\Image_0.bmp");
loadimage (#ii[2][0][0], "C:\Image_1.bmp");
if (findimage(1, #ii[0][0][0], 0, #x, #y, 0, 0, 1366, 768, -1)==1)
{
mouse(LEFT, x, y);
}
pause(1000);
if (findimage(1, #ii[2][0][0], 0, #x, #y, 0, 0, 1366, 768, -1)==1)
{
mouse(LEFT, x, y);
}
*/
/*
int Hour=1, Minute=2, Second=3, mmm=4;
string e=fr(Hour)+":"+fr(Minute)+":"+fr(Second)+" - "+fr(mmm);
messagebox(e);
enabletimer(0);
loop()
{
beep(2000, 100);
sleep(200);
}
function fr(int num)
{
return format(num);
}
CREATE_TIMER(0, 1000)
{
beep(1000, 100);
}
*/
/*
int s=2, m=3, h=4, Y=5, M=6, D=7;
int a[50];
a[M-1]=8;
int x=s+m*2+h*2+((Y-1)*2+((Y-1)/4)+a[M-1]+D)*2;
//2+3*2+4*2+((5-1)*2+((5-1)/4)+8+7)*2
//2+3*2+4*2+(4*2+(4/4)+8+7)*2
//2+6+8+(8+1+8+7)*2
//2+6+8+(8+1+8+7)*2
//16+24*2
//64
messagebox (x);
*/
/*
external(INT, "GetKeyState", "GetKeyState", "User32.dll");
messagebox(GetKeyState(20));
*/
/*
if (fopen ("c:\5.txt", "w")!=0)
{
fwrite("aaaaa");
fwrite(ENDL);
fwrite(125);
fclose();
}
*/
/*
win w_KIB;
int ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
int Image_0_KIB[5][5];
start_();
findimage_(#Image_0_KIB[0][0], 0, 0, 2500, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
function start_()
{
load_image_();
pause(1000);
int x, y;
getmouse(x, y);
w_KIB=getwindow(1, x, y);
ex_KIB=w_KIB.widthclient; ey_KIB=w_KIB.heightclient;
}
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)
{
sum=findimage(k, #Image[0][0], fon, #x[0], #y[0], xs, ys, xf, yf, w_KIB);
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "C:\Image_0.bmp");
}
*/
/*
new int ex_KIB[5];
new int sum_KIB[55];
findimage_(ex_KIB[0], #sum_KIB[0]);
function findimage_(int xf, int#sum)
{
sum[7]=5;
messagebox (sum[7]);
}
*/
/*
new int ex_KIB[5];
new int sum_KIB[55];
new int Image_1[22][14];
findimage_(#Image_1[0][0], ex_KIB[0], #sum_KIB[0]);
function findimage_(int #Image, int xf, int#sum)
{
sum[7]=5;
messagebox (sum[7]);
}
*/
/*
int col_KIB,ey_KIB, x_KIB, y_KIB;
new int ex_KIB[5];
new int sum_KIB[55];
getdisplay(col_KIB, ex_KIB[0], ey_KIB);
new int Image_1[22][14];
loadimage (#Image_1[0][0], "C:\Users\Вова\Desktop\2 массив\Image_0.bmp");
sleep(500);
findimage_(#Image_1[0][0], 0, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB[0], ey_KIB, #sum_KIB[0], #x_KIB, #y_KIB);
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)
{
sum[7]=findimage(-1, #Image[0][0], 0, #x[0], #y[0], xs, ys, xf, yf, -1);
messagebox (sum[7]);
}
*/
/*
int col_KIB, ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
getdisplay(col_KIB, ex_KIB, ey_KIB);
int Image_1[22][14];
loadimage (#Image_1[0][0], "C:\Users\Вова\Desktop\2 массив\Image_0.bmp");
sleep(500);
findimage_(#Image_1[0][0], 0, 0, 0, 1, 0, 0, 0, -1, 0, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB);
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)
{
sum=findimage(-1, #Image[0][0], 0, #x[0], #y[0], xs, ys, xf, yf, -1);
messagebox (sum);
}
*/
/*
new int a[500][50];
new int e[200][5];
a[11][21]=12;
e[1][1]=5;
a[1][1]=e[1][1];
messagebox(format(a[1][1])+" "+format(a[11][21]));
*/
/*
new int a[formatsn("1"+"0")][50];
new char e[200][5];
int t=gettime();
a[formatsn("1"+"0")][20]=5;
a[formatsn("1"+"1")][21]=55;
e[1][1]='a';
loop(9999)
{
fun(#a[0][0], a[formatsn("1"+"1")][21], #e[0][0]);
}
messagebox(gettime()-t);
messagebox(format(a[1][1])+" "+format(a[formatsn("1"+"0")][20]));
function fun(int #b, int v, char #u)
{
b[formatsn("1"+"0")][20]++;
b[1][1]=v+formatci(u[1][1]);
}
*/
/*
new int a[formatsn("1"+"0")][50];
new int e[200][5];
int t=gettime();
a[formatsn("1"+"0")][20]=5;
a[formatsn("1"+"1")][21]=55;
e[1][1]=7;
loop(9999)
{
fun(#a[0][0], a[formatsn("1"+"1")][21], #e[0][0]);
}
messagebox(format(a[1][1])+" "+format(a[formatsn("1"+"0")][20])+" "+format(gettime()-t));
function fun(int #b, int v, int #u)
{
b[formatsn("1"+"0")][20]++;
b[1][1]=v+u[1][1];
}
*/
/*
new char e[200][5];
e[1][1]='a';
int g=formatci(e[1][1]);
messagebox(g);
*/
/*
int x[20]; int y;
x[10]=1000;
fun(#x[0]);
function fun(int #i)
{
y=i[formatsn("1"+"0")] / 2 / 2;
}
messagebox(y);
*/
/*
new int x[1];
new int y[1];
getmouse(x[0], y[0]);
messagebox (x[0]);
*/
/*
new int col[1];
col[0]=25;
writeclipboard(col[0]);
*/
/*
new int col[1];
new int x[1];
new int y[1];
getdisplay(col[0], x[0], y[0]);
messagebox (x[0]);
*/
/*
new int a[57+formatsn("1"+"1")];
a[57+formatsn("1"+"0")]=2000;
int t=gettime();
pause(a[57+formatsn("1"+"0")]);
messagebox(gettime()-t);
*/
/*
new int a[formatsn("1"+"0")][50];
int t=gettime();
a[formatsn("1"+"0")][20]=5;
loop(9999)
{
fun(#a[0][0]);
}
messagebox(gettime()-t);
messagebox (a[formatsn("1"+"0")][20]);
function fun(int #b)
{
b[formatsn("1"+"0")][20]++;
}
*/
/*
new int a[formatsn("1"+"0")][50];
a[formatsn("1"+"0")][20]=5;
fun(#a[0][0]);
function fun(int #b)
{
messagebox (b[formatsn("1"+"0")][20]);
}
*/
/*
new int x[20]; int y;
x[10]=1000;
y = x[formatsn("1"+"0")] / 2 / 2;
messagebox(y);
*/
/*
new int c[50];
c[10]=4;
c[20]=a(b(c[10]));
messagebox(c[formatsn("2"+"0")]); // 8, а не 10
//messagebox(c[20]); // 8, а не 10
function a(int x){return x + 2;}
function b(int y){return y * 2;}
*/
/*
new int x[50]; x[20]=3; int y=5;
messagebox(f(x[formatsn("2"+"0")])+" "+f(y)); // должно быть 3 5
function f(int num){return format(num);}
*/
/*
new char c[2][10];
strcpy(#c[0][0], "qwerty");
messagebox (format(#c[0][0]));
*/
/*
func("fthfth");
function func(string s) // функция принимает строку
{
new char a[size(s)+1]; // массив по размеру строки
strcpy(#a[0], s); // краха не будет, т. к. объявлен массив достаточного размера
messagebox (format(#a[0]));
delete a; // удалили массив
}
*/
/*
string text_KIB;
loadsymbolbase("C:\Users\Вова\Desktop\basetext.sib");
int n=2;
int col_KIB, ex_KIB, ey_KIB, sum_KIB, x_KIB, y_KIB;
int Image_0_KIB[5][5];
start_();
new int a[5];
a[2]=2;
if (findimage_(#Image_0_KIB[0][0], 0, 0, 0, 1, 0, 0, 0, -1, 5, 100, 1, 0, 0, ex_KIB, ey_KIB, #sum_KIB, #x_KIB, #y_KIB)>0) goto m_KIB5;
else goto m_KIB1;
m_KIB5: key_(75, 1, 3000, 0);
readtext(NUM | EN, #text_KIB, 22, 1, 50, -1, -1, -1, -1, 0, -1, 205, 111, 243, 129, -1);
messagebox (text_KIB);
if (n==a[n]) goto m_KIB4;
m_KIB1: mouse_(2000, 1, 200, 200, 0); goto exit_KIB;
m_KIB4: aaaaa(#n, #a[0]);
exit_KIB:;
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) 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 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){mousedbl(LEFT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==11){mousedbl(MIDDLE, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==12){mousedbl(RIGHT, xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
if (m==13){mousemove(xs+xKIB+xm, ys+yKIB+ym); pause(p3);}
return sumKIB;
}
function load_image_()
{
loadimage (#Image_0_KIB[0][0], "C:\Image_0.bmp");
}
function aaaaa(int #b, int #c)
{
messagebox (b+c[b]);
goto exit_KIB;
exit_KIB:;
}
*/
/*
key(CONTROL);
*/