Evil Chicken
2013-04-24 16:12:57
Currently I have a script where I want to know whether a pixel at a specific coordinate is black. I used GetColor but it is really slow. Any suggestions on how to determine if a spot is black or not?
Shouldn't GetColor be pretty much instantaneous? Post your code, it's probably something else slowing it down.
Evil Chicken
2013-04-24 16:28:04
program new;
{$i SRL\SRL.simba}
var
Arr : TPointArray;
ScreenX, ScreenY : Integer;
Procedure FindScreen;
var
corner: Integer;
begin
corner := BitmapFromString(10, 5, 'meJwzd/BihAE3Tz9zJC4EvH926/q' +
'No5cv7/S0tsyuKgayIQgoDpSFsIGyO3fOF5KQX7Kk5/TpdRCELAvk' +
'AqXkpKQrOqomTultnlQMl4UrAIprqqpALAUAlEBG8w==');
FindBitmapToleranceIn (corner, ScreenX, ScreenY, 0, 0, 1919, 1057, 10);
FreeBitmap (corner);
ScreenY := ScreenY + 12;
ScreenX := ScreenX + 13;
end;
Procedure ScanBoard;
var
x, i, m, color: Integer;
begin
for i := 0 to 30 do
begin
for x := 0 to 22 do
begin
MoveMouse (ScreenX+18*x, ScreenY+18*i)
// Wait(100);
color := GetColor (ScreenX+18*x, ScreenY+18*i);
// if(color = 0) then
// Writeln ('black')
end;
end;
end;
begin
SetupSRL;
ClearDebug;
FindScreen;
ScanBoard;
end.
you don't free bitmap "color"?
color := BitmapFromString(1, 1, 'meJxjYGAAAAADAAE=');
Your looping through it over 600 times… thats why it's so slow
for i := 0 to 30 do
begin
for x := 0 to 22 do
Evil Chicken
2013-04-24 16:48:35
Your looping through it over 600 times… thats why it's so slow
[ATTACH=CONFIG]20903[/ATTACH]
I need to scan this as a grid into an Array. I only want to know where the empty blocks are. Is there any other faster way to scan this?
you removed it
Yeah I know. That wasn't suppose to be there in the first place :)