Jump to content
dopeness

Bitmap trouble.

Recommended Posts

I feel like the older versions of Scar functioned a lot better. Right now, I'm trying to find a bitmap on a game in windowed mode and it keeps saying it found it, at 0,0. I remember before I made a trigger-bot with the same game, and an older version of Scar and it worked fine. Does anyone know why it keeps returning 0,0?

 

code:

[sCAR]

program New;

var five: TSCARBitmap;

var x,y: integer;

 

begin

five:= TSCARBitmap.create('deNpNV+tzVPUZzuZcNhbIZbO3c7/uuezZs2dvy' +

'W52s5ckXKKACAokBDQgqFwSQwII1VFbq7VOxzp0ALGfnOnX2n5z+qm2KqOtI2J' +

'bWwtUxaJA/4k+v7OheubNzi/n9vze533f532P26P36Jq6+b5Nzz19cqrTSiWSj' +

'mNrmsyn07oiG5pq6KosCliIoiiJkmNbrmP7uaymyKlUShB4185YGT3nuVnbzvt' +

'eznF0XVUVSdM0UZbJSpRUTdPxUknMmJogpKc3rj9z+ql7p+9t1huvvPTio/P7p' +

'totvNkwVMc2DVWVBN4wNF7gJJ7HiUzGkARBFHlJFIE7HIsnE8lUMqkpEl6P/Tt' +

'2xjR027Yd11ZUxbUdRZKTySSX5jRV0fCnKLHYUL1efePC2TOnT8/vn69XR2d27' +

'Cjk3PHaaKVcULG3jC6JnG3qiiJ5ViaZiEsinzF1UeB5UZAk7EUYGBxMJhJcKqn' +

'IgmWZPA5wYllwU8Njkqgoso4NqYppmvF4HKThlthwbLxRm940vWl9Z3p6UyqZq' +

'JUrc7M75+dmCl5WENP9a9euckvgVZ5L205GFnlDURCFnOv4OTcZT6ZTKbw8nUJ' +

'otIxlyqIIqpyMLkgiwpQBfaqaiMcVEduQLCvjug72MzAwuH7jBhwzOx+EUyBw9' +

'47t9eoItpmIxYCVsXRwn89nrYyhyAicYhmIoZLP54LAL5cKiIUsg2cdTtXrtUa' +

'jns06qkr2YBi6FB6aZkiSAKJty9Z03Gkoqsrx/HB8+N5NG0ulgqmr4EIWpIyu2' +

'bYxNDjgeQ7SRlXkVmu83W5WysHWrfetn2hNNsdbnXaxUjQ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Rx+nygfpuNny/' +

'Ud37/zps0//6NTKE/vmNjTrBU1Zt6afLj+Ge5jqQUSKlBVcRmVZ90aUZkpyK4U' +

'AUz9IRvsQBZEOD4qiKfqufbdmer8zFkbBmK5F6a6xUSY0umvhGVyl2D6K6Vq0a' +

'6v3MywDY8lxB8ftO7fJcef7dusO7L9d+/Y2sW9u//fmrTvf3Lrzn29vE/vm1tc' +

'3v71x89uvvr755Y2bX3z1n+tffn3tixtX//3V59e+/OfVLz771/W/f37tr//41' +

'18/+/zTv//zyt8+u/Lp3y5f+fTyJ1c+vnz5448v/w+9rGm+');

 

debugbitmap(five);

getClient.activate;

wait(100);

 

repeat

 

if(findbitmap(x,y,five,432,734,476,764))then

begin

 

writeLn('found bitmap at ' + intToStr(x) + ',' + intToStr(y));

 

end

else

writeLn('missing bitmap');

wait(1000);

 

until false;

end.[/sCAR]

Edited by dopeness
Link to comment
Share on other sites

Ello dope,

 

This problem is because you are using smaller search area than your bitmap actually is.

However, FindBitmap still shouldn't be returning true though[!] (that's what Freddy needs to fix/change).

There should be either error (an exception) or it just returning false..

 

Edit: Run the code below.. Clearly shows the problem (bmp = bitmap from your code).

 

const
 AREA_X1 = 432;
 AREA_Y1 = 734;
 AREA_X2 = 476;
 AREA_Y2 = 764;

var
 bmp: TSCARBitmap; 
 area: TBox;
 w, h: Integer;

begin
 ClearDebug;
 bmp := TSCARBitmap.create('deNpNV+tzVPUZzuZcNhbIZbO3c7/uuezZs2dvy' +
   'W52s5ckXKKACAokBDQgqFwSQwII1VFbq7VOxzp0ALGfnOnX2n5z+qm2KqOtI2J' +
   'bWwtUxaJA/4k+v7OheubNzi/n9vze533f532P26P36Jq6+b5Nzz19cqrTSiWSj' +
   'mNrmsyn07oiG5pq6KosCliIoiiJkmNbrmP7uaymyKlUShB4185YGT3nuVnbzvt' +
   'eznF0XVUVSdM0UZbJSpRUTdPxUknMmJogpKc3rj9z+ql7p+9t1huvvPTio/P7p' +
   'totvNkwVMc2DVWVBN4wNF7gJ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HPnLs7vntNkg0asG8uhli520wytk0B' +
   '723u0yZRsb5xsWpbOcVxjbFQmM7POhZ85mHV9z8MXRGtyguECKruVLs7cresjR' +
   'CJIEyGER7uxfuH5a9eu/+GdP5079/rDu+dUqRtrdJDlbjkQ6PpjXeiI2klJZEx' +
   'Np5NBEPAcNzpSdrOYGbh4fJhoqaJ4nnf/tvtpomZbqcIuZuSR77wmGU6kjG2tD' +
   'A4lfvbMmU8+ufL2279/9dXXZh98SOZFqrAnhF4J++YiKS6iZnuImqFpJkQM7/g' +
   '+wpCAxg2qMfYL4XSK7zrM3sVCfmrDRsQ6QtJs53exBoFEo5aZ8RU6s37N2oFOf' +
   'ezAgQO7du2amprCt97AwEBvymVIXZ8gd4YuM7UDdHGWDJbG1GDawAdaqYgvQge' +
   'TMMbA7m+KSyLJkGOlYlCqlOF1xJruJQPSHOGcjGSPYfJhG4v02AKdtDdUi8cOH' +
   '379/PlXXn554eixjRs2FRxr3Zp1bP0421iKjh8juKPz2DnKhMyl2sQQT4ZOeIo' +
   'vJui2RaZuGYSjnDGxkHyT5IztUsMWGaqz98NxMIYBD2XCVB+lRx+nygfpuNny/' +
   'Ud37/zps0//6NTKE/vmNjTrBU1Zt6afLj+Ge5jqQUSKlBVcRmVZ90aUZkpyK4U' +
   'AUz9IRvsQBZEOD4qiKfqufbdmer8zFkbBmK5F6a6xUSY0umvhGVyl2D6K6Vq0a' +
   '6v3MywDY8lxB8ftO7fJcef7dusO7L9d+/Y2sW9u//fmrTvf3Lrzn29vE/vm1tc' +
   '3v71x89uvvr755Y2bX3z1n+tffn3tixtX//3V59e+/OfVLz771/W/f37tr//41' +
   '18/+/zTv//zyt8+u/Lp3y5f+fTyJ1c+vnz5448v/w+9rGm+');    
 WriteLn('BMP size: ' + IntToStr(bmp.Width) + 'x' + IntToStr(bmp.Height));
 area := Box(AREA_X1, AREA_Y1, AREA_X2, AREA_Y2); 
 GetBoxSize(area, w, h);
 WriteLn('AREA size: ' + IntToStr(w) + 'x' + IntToStr(h)); 
 bmp.Free;
end.

 

Your area is too small for bitmap to be found. Area needs to be AT LEAST the same size OR bigger.

 

Edit2: I requested a tweak for bitmap finding functions, to popup an exception error when you try to use too small area.

The request is @MantisBT.

 

-Jani

Edited by Janilabo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...