SRL Archive - OSR Help

GetColor


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?

Ian

2013-04-24 16:18:25

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.

t4q

2013-04-24 16:38:30

you don't free bitmap "color"?
color := BitmapFromString(1, 1, 'meJxjYGAAAAADAAE=');

Evil Chicken

2013-04-24 16:40:21

you don't free bitmap "color"?

Color isn't a bitmap

rj

2013-04-24 16:41:01

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

t4q

2013-04-24 16:46:06

From: Evil Chicken
Color isn't a bitmap

you removed it :D

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 :)