Jump to content
mrCin

Finding bitmaps

Recommended Posts

Hi, I'm new with this all scar functions. I want to find all bitmaps in selected area, but have error: Unknown identifier "FindBitmapsTolerance". What am I doing wrong?

 

 

program New;var mmx1, mmy1, mmx2, mmy2 : integer;var enemy_bmp, i : integer;var points : TPointArray;procedure find;beginmmx1 := 1038;mmy1 := 248;mmx2 := 1127;mmy2 := 337;enemy_bmp := TSCARBitmap.Create('deNpjYmBi+D8TgQAtuAZl');if FindBitmapsTolerance(enemy_bmp, points, mmx1, mmy1, mmx2, mmy2, 10) then for i:= 0 to Length(Points) - 1 do  begin   HoldMouse(Points[i].x, Points[i].y, True);   Wait(25);   ReleaseMouse(Points[i].x, Points[i].y, True);   Wait(25);  end;end;end.

 

Link to comment
Share on other sites

 

program New;var mmx1, mmy1, mmx2, mmy2 : integer;var enemy_bmp, i : integer;var points : TPointArray;procedure find;beginmmx1 := 1038;mmy1 := 248;mmx2 := 1127;mmy2 := 337;enemy_bmp := TSCARBitmap.Create('deNpjYmBi+D8TgQAtuAZl');if FindBitmapTolEx(points, enemy_bmp, mmx1, mmy1, mmx2, mmy2, 10) then for i:= 0 to Length(Points) - 1 do  begin   MouseBtnDown(Points[i].x, Points[i].y, mbLeft);   Wait(25);   MouseBtnUp(Points[i].x, Points[i].y, mbLeft);   Wait(25);  end;end;begin find;end.

 

 

Holdmouse and FindBitmapsTolerance have been deprecated. Would consider improved standards and OSI.

Link to comment
Share on other sites

ok, I found command that set alpha, so I can blend now black colour to transparent. Thanks for help ;)

 

How did you find that lol? http://wiki.scar-divi.com/TSCARBitmap.TranspColor had to do some digging to find out what you were talking about. Was not even aware of the features. I haven't done anything with bitmaps extensively since the system was updated.

Link to comment
Share on other sites

Keep in mind that you should free that bitmap enemy_bmp after usage or you could clog up the memory if you run that find function in a loop; Since bitmaps are only freed after the whole script is ran automatically.

 

Yea I missed that he did that.. also @anyone planning on scripting with bmps. at least move the bmp to Globals and the loading function to a procedure that only gets called once a script run... (or in wider complex junction loops with freeing and reloading). ....so that it's only loaded one time. Personally I load mine in the function and then free it in the same function. I suppose it would be advantageous not to in examples like

 

1) That bmp gets used a lot.. just keep it loaded one time in globals.

2) That bmp gets used by different functions.. just keep it loaded one time in globals.

 

This is how bmps are handled in OSI and some other scripts.

 

vs

 

1) That bmp gets used occasionally or only by this one function... load it on demand and free it immediately afterwards.

 

This is what I usually do for simplicity.

 

I'm thinking that even in some cases: rapidly reloading and freeing could cause performance issues (or timing issues).. so it's important to take into account that as well.

Edited by Wanted
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...