mrCin Posted February 6, 2016 Share Posted February 6, 2016 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. Quote Link to comment Share on other sites More sharing options...
Wanted Posted February 7, 2016 Share Posted February 7, 2016 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. Quote Link to comment Share on other sites More sharing options...
mrCin Posted February 7, 2016 Author Share Posted February 7, 2016 thanks a lot! one more question: FindTransparentBitmapTolerance was removed, so how to find for example ? Quote Link to comment Share on other sites More sharing options...
Wanted Posted February 10, 2016 Share Posted February 10, 2016 Should be able to make the surrounding color in MSPaint, photoshop or whatever pure black ...clBlack =0; Quote Link to comment Share on other sites More sharing options...
mrCin Posted February 10, 2016 Author Share Posted February 10, 2016 ok, I found command that set alpha, so I can blend now black colour to transparent. Thanks for help Quote Link to comment Share on other sites More sharing options...
Wanted Posted February 11, 2016 Share Posted February 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 11, 2016 Share Posted February 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
Wanted Posted February 12, 2016 Share Posted February 12, 2016 (edited) 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 February 12, 2016 by Wanted Quote Link to comment Share on other sites More sharing options...