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?
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.
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.
Last edited by Evil Chicken; 04-24-2013 at 08:42 PM.
you don't free bitmap "color"?
Code:color := BitmapFromString(1, 1, 'meJxjYGAAAAADAAE=');
Color isn't a bitmapyou don't free bitmap "color"?
Your looping through it over 600 times... thats why it's so slow
Simba Code:for i := 0 to 30 do
begin
for x := 0 to 22 do
Nice CutOut.pngYour looping through it over 600 times... thats why it's so slow
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?
Yeah I know. That wasn't suppose to be there in the first placeyou removed it![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)