SRL Archive - OSR Help

"The Bitmap Doesn't exist" Problem


blitz

2013-07-02 04:49:14

Every time I run this program it clicks on the box trap but then stops when going to lay the box trap. I'm new to programming in Simba so don't lay it on too thick. :)



program new;
{$DEFINE SMART}
{$i srl/srl.simba}

var
x,y,LayTrapPic: Integer;

procedure LoadBMPs;

begin
LayTrapPic:= BitmapFromString(21, 14, 'meJxzD4l1H1D0Hwwo1M7AwDCctP' +
'9HAlgDCsLAqh0uCARoWuCK8WhHsx1ZCzHaMW0nTzumArQw+Y8B8Dg' +
'eguCuQuYiA6zimIFDXlzDtQMAiJiIQQ==');
end;

procedure LayTrap;

begin
if (findcolor(x,y,4679031,13,6,331,188)) then
MoveMouse(x,y);
ClickMouse(x,y,mouse_right);

wait(5000);

if (findbitmap(x,y,LayTrapPic)) then
MoveMouse(x,y);
ClickMouse(x,y,mouse_left);
end;

begin
LoadBMPs;
repeat

LayTrap;

until (false);
Freebitmap(LaytrapPic);
end.

Gu3st...

2013-07-02 05:36:33

Add a wait between
"ClickMouse(x,y,mouse_right);"
and
"if (findbitmap(x,y,LayTrapPic)) then"
and your script should function.

There's a lot of room for improvement here though; but the above should fix your current problem :)

blitz

2013-07-02 11:18:35

From: Zyt3x
Add a wait between
"ClickMouse(x,y,mouse_right);"
and
"if (findbitmap(x,y,LayTrapPic)) then"
and your script should function.
There's a lot of room for improvement here though; but the above should fix your current problem :)


It still doesn't work. I added "wait(5000);" and now it just waits 5 seconds and still gives me the same error.

Justin

2013-07-02 11:21:38

Try loading/unloading your bitmap outside of your repeat loop.


begin
LoadBMPs;
repeat
LayTrap;
until (false);
Freebitmap(LaytrapPic);
end.

blitz

2013-07-02 11:33:59

I tried adding them outside the main loop and now it doesn't even right click on the trap. :(

blitz

2013-07-02 11:42:10

Every time I run the program it will right click on the trap, then stop and says "Error: Exception: The bitmap[295] does not exist at line 25".

blitz

2013-07-03 00:20:46

I'm still having this problem.