SRL Archive - Help and Support

RunTime: Can't allocate the DIB handle


WhoCares357

2009-05-03 07:34:41

program Test;

{.include SRL/SRL.scar}

var //global images
RubyRing: Integer;
rX, rY: Integer;

procedure LoadImages;
begin
RubyRing := BitmapFromString(14, 9, 'beNpjYMAAjBf1pDepiyMjB' +
'uwAXWWnnBBQEKvKV8ZyyMrAKlEUwNGEOqHbBjIQBFGJZCzjmulii/' +
'tFV04V27dcAsjorBAK9uQ+qSN1WFsSqCxWhAdiyIJe0bldIssmiQK' +
'VXd4lfW6r9O4lErPaRYpS+LdqiAMRxMCeaqHWUkGg4k1zxQ+vkbx9' +
'UObpSTkgAjKAimFOAoG8RD6gYojKM5ulHh+XfXtB/scthd/37YBWA' +
'I2FqwSyga4CqkT23u87QJUuF7dLA10FVQkAVB5adA==');

WriteLn('All images loaded.');
end;

procedure FreeImages;
begin
FreeBitmap(RubyRing);
WriteLn('All images released.');
end;

begin
SetupSRL;
LoadImages;
Wait(500);
FindBitmapToleranceIn(RubyRing, rX, rY, MIX1, MIX2, MIY1, MIY2, 200);
FreeImages;
end.

Debug:
Successfully compiled (5784 ms)
SRL Compiled in 16 msec
All images loaded.
[Runtime Error] : Exception: Can't allocate the DIB handle in line 30 in script

Nadeem

2009-05-03 08:22:38

From: WhoCares357
program Test;

{.include SRL/SRL.scar}

var //global images
RubyRing: Integer;
rX, rY: Integer;

procedure LoadImages;
begin
RubyRing := BitmapFromString(14, 9, 'beNpjYMAAjBf1pDepiyMjB' +
'uwAXWWnnBBQEKvKV8ZyyMrAKlEUwNGEOqHbBjIQBFGJZCzjmulii/' +
'tFV04V27dcAsjorBAK9uQ+qSN1WFsSqCxWhAdiyIJe0bldIssmiQK' +
'VXd4lfW6r9O4lErPaRYpS+LdqiAMRxMCeaqHWUkGg4k1zxQ+vkbx9' +
'UObpSTkgAjKAimFOAoG8RD6gYojKM5ulHh+XfXtB/scthd/37YBWA' +
'I2FqwSyga4CqkT23u87QJUuF7dLA10FVQkAVB5adA==');

WriteLn('All images loaded.');
end;

procedure FreeImages;
begin
FreeBitmap(RubyRing);
WriteLn('All images released.');
end;

begin
SetupSRL;
LoadImages;
Wait(500);
FindBitmapToleranceIn(RubyRing, rX, rY, MIX1, MIX2, MIY1, MIY2, 200);
FreeImages;
end.

Debug:
Successfully compiled (5784 ms)
SRL Compiled in 16 msec
All images loaded.
[Runtime Error] : Exception: Can't allocate the DIB handle in line 30 in script


Hi, Findbitmap has problems in SCAR 3.20 sooo use this instead, tested and worked:


begin
SetupSRL;
LoadImages;
Wait(500);
if FindBitmapSpiralTolerance(RubyRing, rX, rY, MIX1, MIX2, MIY1, MIY2, 100) then
Writeln('Bitmap Found.');
FreeImages;
end.

WhoCares357

2009-05-03 08:34:05

Mmkay, thank you.

Freddy1990

2009-05-03 13:24:01

Heh, I know blaming SCAR is easy, but if you can't fill out the params properly… Well, SCAR won't function properly…

"FindBitmapToleranceIn(RubyRing, rX, rY, MIX1, MIY1, MIX2, MIY2, 200);"

Try that, you switched MIY1 and MIX2, which basically makes SCAR define a negative search area which just isn't possible… The spiral function probably just accepts it because it doesn't use my coding structure, it's still wrong though…

EDIT: Btw, if you're going to use that bitmap with SCAR 3.20, you'll need to call FindTransparentBitmapToleranceIn with 0 as transparent color instead of FindBitmapToleranceIn.

From: Nadeem
Hi, Findbitmap has problems in SCAR 3.20

You know something I don't? If you find a bug you can always report it, the thing is, if people don't, I won't know about them and they don't get fixed…

WhoCares357

2009-05-03 21:24:17

Thanks. I read your post on rs-hacking first.