Author Topic: How to make Masks (SCAR 2.03)  (Read 2675 times)

Offline Hobbit

  • Leecher
  • Posts: 9
  • Rep: 0
  • SRL Administrator
    • MSN Messenger - chris.hobbs@hotmail.com
    • View Profile
    • Email
How to make Masks (SCAR 2.03)
« on: December 09, 2007, 12:32:42 am »
Question: What is a mask?
Answer: A mask is a flatened inverted bitmap that is almost black, it is 100% reliable if setup correctly.
 
The only function to utilise mask is:
 
FindBitmapMaskTolerance(mask:Integer;var x,y:Integer;x1,y1,x2,y2:Integer,Tolerance,ContourTolerance:Integer):Boolean

Step 1: Understanding the function:
What does all this mean? Well i'll tell you,
1: mask:integer is the name of the mask, jsut like in bitmaps(this will be explained more later)
 
 
 

2:var x,y:integer well i hope we all know what that part is, but if you don't, what this does is once the script finds the mask it will put the coordinates where it is into variable x and y so then you can do something like
Code: [Select]
MoveMouse(x,y);
 
and the script will move the mouse to the coordinates found.
3:x1,y1,x2,y2 this is the area where to sript is going to search..take paint for example when your selecting an area
 

 
4:Tolerance and Contour Tolerance these are how much "slack" you want to give it...if you set them to 0 it will look for EXACT match if you set them to 1 then it has a little bit of breathing room... I suggest setting to 1
 
Step2: Capturing desired image:
1:Have the window of with the image you want visible
2:If you look by the F12 key beside it is a key called "Prt Scrn" or non abreviated...print screen. Press it.
3:Open Photoshop, have a new document open then go to Edit>Paste then you will have the whole screenshot to work with
 

 
Step 3: Cutting it down:
1:Select the magnifing glass tool (press z) and zoom in on the object you want
2:Press w to use the selection tool and highlight the object you want
 

 
3:Go to Edit then select cut or copy (not in right click options)
4:Go to File>New... then press ok to open another new document and paste image into it
 
Step 4: Flattening and Inverting:
1:Once you got the object you want to make a mask go to Image>Mode>Graysacle then in the box that pops up select the flatten option then the next pop up box press discard
 



 
2:You will now have a flat gray looking image, now go to Image>Adjustments>Brightness/Contrast (bolded so you dont miss)
 

 
3:Set the Brightness to 55% or higher and the Contrast to 100% and press ok (bolded so you dont miss)
 

 
4: Press Ctrl + I and *POOF* the image is inverted and you've created a mask...it should look like this

5:Save as a bmp file, but since its a mask the highest resolution you can save it in it 8bit...and that's fine
 
Step 5: Setting up the function:
1:Open scar and go to script>Picture to String
 

 
2:Open the disired mask, then select a portion of it just like we did before in photoshop so that it has the dotted line box around it then press ok
3:The string on the mask will appear in the debug box at the bottom on the window
4:Put the name of your mask into variables ex:
Code: [Select]
var
mask : integer;

5:Copy the code into a procedure called LoadBmps.
Should look like this so far:
Code: [Select]
program New;
var
mask : integer;
procedure LoadBmps;
begin
   mask := BitmapFromString(21, 17, 'z78DA8D9559B2DC201004AF24' +
       '81D83ED176FF23D955D91183636CC7237F341243F54E2AE937CF2' +
       'ECA2DD2616EE3B575739862AA793EECACC34C739BEB431D623C62' +
       'BB05BAFD12C729CA10698AD0CA66D14DD93CE6357EE675585E0D8' +
       'B0F5DA035B2B8A6C0B9760BFE159E029E36D18E0FC723EA2E7A11' +
       'F912589E9AB1623A45F63ABCBC319F5DD8DDB2BFE20F5D2BA25E5' +
       '32C44DE191E780D5C8FB3A93D78CBB77221ABE35A2EBE9779FD94' +
       'E7157411C7E01A299C9E4');
end;

6:Now create another procedure, for this tutorial it will move the mouse to the bit map and i'll call it move, then in that after begin type in FindBitmapMaskTolerance(<required info>) then MoveMouse(x,y);
Now is should look something like this(I have the search box set to my whole screen):
Code: [Select]
program New;
var
mask : integer;
procedure LoadBmps;
begin
   mask := BitmapFromString(21, 17, 'z78DA8D9559B2DC201004AF24' +
       '81D83ED176FF23D955D91183636CC7237F341243F54E2AE937CF2' +
       'ECA2DD2616EE3B575739862AA793EECACC34C739BEB431D623C62' +
       'BB05BAFD12C729CA10698AD0CA66D14DD93CE6357EE675585E0D8' +
       'B0F5DA035B2B8A6C0B9760BFE159E029E36D18E0FC723EA2E7A11' +
       'F912589E9AB1623A45F63ABCBC319F5DD8DDB2BFE20F5D2BA25E5' +
       '32C44DE191E780D5C8FB3A93D78CBB77221ABE35A2EBE9779FD94' +
       'E7157411C7E01A299C9E4');
end;
Procedure move;
begin
 FindBitmapMaskTolerance(mask,x,y,0,0,1024,768,1,1);
 MoveMouse(x,y);
end;

 
7: Add procedures into main loop and your DONE.
Final product:
Code: [Select]
program New;
var
mask : integer;
procedure LoadBmps;
begin
   mask := BitmapFromString(21, 17, 'z78DA8D9559B2DC201004AF24' +
       '81D83ED176FF23D955D91183636CC7237F341243F54E2AE937CF2' +
       'ECA2DD2616EE3B575739862AA793EECACC34C739BEB431D623C62' +
       'BB05BAFD12C729CA10698AD0CA66D14DD93CE6357EE675585E0D8' +
       'B0F5DA035B2B8A6C0B9760BFE159E029E36D18E0FC723EA2E7A11' +
       'F912589E9AB1623A45F63ABCBC319F5DD8DDB2BFE20F5D2BA25E5' +
       '32C44DE191E780D5C8FB3A93D78CBB77221ABE35A2EBE9779FD94' +
       'E7157411C7E01A299C9E4');
end;
Procedure move;
var
x,y : integer;
begin
 FindBitmapMaskTolerance(mask,x,y,0,0,1024,768,1,1);
 MoveMouse(x,y);
end;
begin
 LoadBmps;
 move;
end.

I hope you've enjoyed this Tutoral if you did feel free to +rep me (took 2.5 hours to make so you better like the pics! :p ). Any Questions or comments pm or email me at chris.hobbs@hotmail.com
« Last Edit: December 09, 2007, 12:37:06 am by Hobbit »
-Hobbit From SRL-

Freddy1990.com

How to make Masks (SCAR 2.03)
« on: December 09, 2007, 12:32:42 am »

Offline ti.teg.tnod.I

  • The Best
  • Administrator
  • *****
  • Posts: 3233
  • Rep: 10
  • ^-^
    • View Profile
    • Rainbows In A Fire
Re: How to make Masks (SCAR 2.03)
« Reply #1 on: December 15, 2007, 06:29:04 am »
Cool, I never understood why you would look for a mask and not just the bitmap...? Is it because masks look for every colour?

Freddy1990.com

Re: How to make Masks (SCAR 2.03)
« Reply #1 on: December 15, 2007, 06:29:04 am »

Offline adnankaj

  • Newbie
  • *
  • Posts: 15
  • Rep: 0
    • View Profile
    • Email
Re: How to make Masks (SCAR 2.03)
« Reply #2 on: April 27, 2008, 04:23:25 pm »
this is cool!

Offline triumphost1

  • Newbie
  • *
  • Posts: 19
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #3 on: July 21, 2008, 11:08:36 am »
one thing u forgot to do was to free up ur bitmap

Offline uhit2low

  • Leecher
  • Posts: 9
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #4 on: November 24, 2008, 06:54:24 pm »
I've tryed both bitmaps and masks and neither seem to work for me. I've followed the TUTs to the T and still has only did what I wanted to once... which was most likely a fluke. Are they both really inaccurate or is it more likely im doing something wrong and just don't know it?


Freddy1990.com

Re: How to make Masks (SCAR 2.03)
« Reply #4 on: November 24, 2008, 06:54:24 pm »

Offline tom2

  • Jr. Member
  • **
  • Posts: 79
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #5 on: January 12, 2010, 12:53:13 pm »
Does this work with scar 3.12c? i did try it but dont work, im familiar with normal bitmapfrom string but not mask, and i need to click on a button witch changes backround all the time with my script so i need to get this working, if you are searching for a button forexample "strike" and it always change the backround is it the letters that is supose to be black and the backround white? does it only need total white or total black color in order to work in any bitmaps? plz reply

Offline Freddy

  • Owner
  • *****
  • Posts: 2616
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: How to make Masks (SCAR 2.03)
« Reply #6 on: January 13, 2010, 07:36:07 am »
Yes, it still works the same

Freddy1990.com

Re: How to make Masks (SCAR 2.03)
« Reply #6 on: January 13, 2010, 07:36:07 am »

Offline elmio2

  • Leecher
  • Posts: 3
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #7 on: July 22, 2011, 03:21:05 am »
Hi all, i have one problem, when i make a mask and serch the mask, it runs perfectly in one computer (virtual computer with XP) but when i make the same with 2 others computers (whith windows7) this computers never find mask (also i try to make a new mask in the otrher computers but never fin it).

In all computers i run scar 3.22. Can anyone help me please?

sorry for my bad english.

Offline Wundertüte

  • Full Member
  • ***
  • Posts: 128
  • Rep: 1
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #8 on: August 09, 2011, 04:42:16 am »
to find masks with win 7 you need SCAR 325+ version

set color theme in windows 7 to windows basis !

greetz

Offline FoxRomik

  • Leecher
  • Posts: 1
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #9 on: August 28, 2011, 01:43:56 pm »
On a desktop some identical pictures. How to find coordinates of all pictures?
For Example:
;) :( ;) :(
  :( ;) :(
;) :( ;) :(
How to find all ;) pictures
« Last Edit: August 28, 2011, 01:51:30 pm by FoxRomik »

Offline Freddy

  • Owner
  • *****
  • Posts: 2616
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: How to make Masks (SCAR 2.03)
« Reply #10 on: August 30, 2011, 12:20:17 am »
You could use FindBitmaps(Tolerance) for that.

Offline Hobbit

  • Leecher
  • Posts: 9
  • Rep: 0
  • SRL Administrator
    • MSN Messenger - chris.hobbs@hotmail.com
    • View Profile
    • Email
Re: How to make Masks (SCAR 2.03)
« Reply #11 on: September 08, 2011, 06:24:39 pm »
Wow this is a blast from the past! I cant believe this tut is still used!
-Hobbit From SRL-

Offline elmio2

  • Leecher
  • Posts: 3
  • Rep: 0
    • View Profile
Re: How to make Masks (SCAR 2.03)
« Reply #12 on: November 02, 2011, 09:08:45 am »
Where i can download scar 325+?
to find masks with win 7 you need SCAR 325+ version

set color theme in windows 7 to windows basis !

greetz

Offline Freddy

  • Owner
  • *****
  • Posts: 2616
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: How to make Masks (SCAR 2.03)
« Reply #13 on: November 04, 2011, 03:13:45 am »

Freddy1990.com

Re: How to make Masks (SCAR 2.03)
« Reply #13 on: November 04, 2011, 03:13:45 am »

 

deductible-aliform