Jump to content
shadowrecon

Bitmap Mask --> Walking

Recommended Posts

So ive been trying a ton of different walking methods looking for ones that are fast and efficient. One that i came up with while looking though Scars manual was using Bitmap Mask simply because it searches for a shape not a color. But in some test runs it didnt seem to work. Before i continue wasting my time any further is this possible? I know back in the day SRL used Bitmap Mask for items, so i know it can be used for more than just text.

 

Heres an example of how im setting it up:

[scar]program New;

{$DEFINE RS2}

{$DEFINE SMART}

{.include OSI\OSI.scar}

 

Var

Path: TIntArray;

 

Procedure LoadPaths(L: Integer);

begin

SetLength(Path, L);

Path[0] := BitmapFromString(22, 17, 'ceNpjYMAO/uMFDEQACk34T' +

'whQohePaf9HwSggF2BNhESmTAaiAYXaMU1gIAsQaQIA1j0eDQ==');

end;

 

Procedure FreePaths;

Var

I: Integer;

begin

For I := Low(Path) to High(Path) do

FreeBitmap(Path);

end;

 

Function WalkBMPPath(Path:TIntArray):Boolean;

Var

I,X,Y: Integer;

begin

LoadPaths(1);

For I := Low(Path) to High(Path) do

if FindBitmapMaskTolerance(Path,X,Y,MMX1,MMY1,MMX2,MMY2,10,10) then

MouseFlag(X,Y,0,0)

else

begin

Result := False;

FreePaths;

Exit;

end;

Result := True;

FreePaths;

end;

 

Begin

if WalkBMPPath(Path) then

Writeln('Made It');

end.[/scar]

Edited by shadowrecon
Link to comment
Share on other sites

Searching for large bitmaps in general usually ends bad, not sure what to say. This is unexplored territory for me

 

Well its only a 20 by 22 pixel bitmap its not huge in any way shape o form. Plus because mask are in the gray scale they dont use as much memory as a standard bitmap. the same bitmap made into a standard bitmap is like 15 lines long. Do you have any tips for using mask/Making them in photoshop, Like Brightness settings ect?

 

---------- Post added at 03:39 AM ---------- Previous post was at 03:35 AM ----------

 

is this similar to SPS they have in srl ?

No, I wish.. Ive tried messing around with there SPS system and its just to imbedded into simba. I had just about every thing ported over and i ran into this function called FData searched for documentation of what it does couldnt find it anywhere asked on there forums and know one knew.. then found it in the Github file and its a class of TMussfuaBitmaps and the comment below it was FakeData... I was like wtf? But it has to do something because it is returning RGB values i just cant figure out what

Link to comment
Share on other sites

Well its only a 20 by 22 pixel bitmap its not huge in any way shape o form. Plus because mask are in the gray scale they dont use as much memory as a standard bitmap. the same bitmap made into a standard bitmap is like 15 lines long. Do you have any tips for using mask/Making them in photoshop, Like Brightness settings ect?

 

---------- Post added at 03:39 AM ---------- Previous post was at 03:35 AM ----------

 

No, I wish.. Ive tried messing around with there SPS system and its just to imbedded into simba. I had just about every thing ported over and i ran into this function called FData searched for documentation of what it does couldnt find it anywhere asked on there forums and know one knew.. then found it in the Github file and its a class of TMussfuaBitmaps and the comment below it was FakeData... I was like wtf? But it has to do something because it is returning RGB values i just cant figure out what

 

20x20 is pretty huge

 

Anyways SPS is great but it isn't worth messing with all the crap implementations trying to get it to work with your SCAR projects, even if you managed to convert everything or utilize it it still wouldn't be as good as something you could probably create yourself in the same amount of time that would take (if even possible) as you've seen it's pretty disorganized and hard to make sense of, although a great proof of concept.

Link to comment
Share on other sites

20x20 is pretty huge

 

Anyways SPS is great but it isn't worth messing with all the crap implementations trying to get it to work with your SCAR projects, even if you managed to convert everything or utilize it it still wouldn't be as good as something you could probably create yourself in the same amount of time that would take (if even possible) as you've seen it's pretty disorganized and hard to make sense of, although a great proof of concept.

 

Yeah ive just stopped with trying to port it but did barrow some bits of data like their map pieces, so far my idea is like this:

*Load part of map u wish to walk on

*Find current position on map

*Take Point u selected off of that map piece 500*500 image

*Create Walking Path TPA

*Convert points to mm walking points/routine

 

Pretty much what they are doing but a bit different.... So far i can load map piece, Get bmp of current location but im having a hard time with finding it on the map piece because tolerances I Filled all of the white/yellow dots on the MM BMP with clblack so they dont interfere but its if i could get this down i then i think this would be a pretty efficient/Safe way of walking. Im Going to play around with making my own map pieces and see how that works. Because theirs are .png files and i dunno if that effects anything with finding a bmp or not.

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...