Results 1 to 13 of 13

Thread: Bitmap Tutorial (For Finding Items In Inventory + Bank) + Implementing Into A Script

  1. #1
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Thumbs up Bitmap Tutorial (For Finding Items In Inventory + Bank) + Implementing Into A Script

    So when I was trying to learn I had the hardest time figuring out bitmaps with the current guides out, and every member that I asked could never get them to even work for themselves. Bitmaps are extremely usefull and better then DTM's (In my opinion) becasue you do not ever have to worry about item clipping. Just follow these extremely simple steps below and you will be one step closer to making your own script.

    I use the Snipping Tool found in Start-up > All Programs > Accessories, for taking my snap shots.

    How To Make A BitMap

    Step 1) Figure out which item you want to make a bitmap for, in this tutorial I am going to use the ring of kinship.

    Step 2) Log in to Runescape and have the item you are making a bitmap for in your inventory or bankscreen, then open the Snipping Tool and select the area around it. Picture Below:

    ^^ After you have selected your image copy it by going to Edit > Copy on the Snipping Tool Menu Bar, Shown Above.

    Step 3) After you have copied the image, open up " Paint " which is found under Startup > All Programs > Accessories. After Paint has opened drag the white window box cross hairs all the way to the top right, then paste your image.
    Picture Below:


    Step 4) Now your going to want to go to view then zoom all the way in on the picture.
    Picture Below:


    Step 5) Now were going to go back to the " Home Tab " and use the " Select Tool ", then choose a unique area of the item and cut a small piece off. The more unique colors, pattern, and smaller size of a snip the more accurate your bitmap will be.

    For this item I am going to snip off a piece under the triangle getting the red (or orange whatever you want to call it), gray and yellow in my snip.
    Picture Below:

    After you do this you want to cut that piece off make a new paint window, then paste your snip into the new window, make sure the picture is snug and there is no white background.
    Picture Below:


    Now After you have this go to File > Save As, IMPORTANT: Make sure you save the file as a " 24-bit Bitmap (*.bmp*.dib) " as shown above ^, then save to your Desktop or I recommend making a new folder just for bitmaps.

    How To Implement Into Your Script:

    Step 6) Now we are going to open up a blank Simba client or you can use my sample below, and were going to make a bitmap from string. After you have a blank window open go to Tools > Bitmap Conversion.

    After this a box will open up, next you choose " Open", then find the bitmap file you just saved, and open it.
    Picture Below:



    Step 7) After you have opened your bitmap file, were now going to press that button " To String " on the Bitmap Conversion Box Shown Below. Then It will give you the bitmap string in the debug box.


    Step 8) Now that we have the string we are going to make a procedure. First we will start by making 2 procedures for calling and free-ing the bitmaps.

    To stay simple we will name these procedures " CallThings " and " FreeThings "
    Code Below:
    Simba Code:
    Program TestBitmap;
    {$DEFINE SMART}
    {$i srl/srl.Simba}

    {Script Variables Here}
    Var
     Ring: Integer;

    {This Will Handle Calling The Bitmaps | DTM's}
    Procedure CallThings;
    Begin
       {Going to Name the Bitmap string " Ring ", and declare the variable under Var}
       Ring := BitmapFromString(4, 11, 'meJxTDfjV//uvasAv1cDfQCRuNFf' +
            'cZJFq4N+bj+9fuXvz7LVLxy+cWb9987qtm1ZtWr98/Zrsgryqhlpb' +
            'O/eq/Te9SloMfcNNg+MsIlIiuub6lLd7l7UGN01Jm79F3HiBuPE8I' +
            'EqZs1FAtYhL3J1L3DNp5logo/D4CSCZOH1NwbHjQARkAwDryT7e');
    End;
    {This Is going to handle Free-ing the Bitmaps on Terminate}
    Procedure FreeThings;
    Begin
       FreeBitMap(Ring);
    End;  

    Begin
      Smart_Server  := 18;
      Smart_Members := True;
      Smart_Signed  := True;
      Smart_SuperDetail := False;

      SetupSRL;
      {Always going to call the bitmaps under SetupSRL}
      CallThings;
      {Now were going to add the procedure FreeThings on terminate}
      AddOnTerminate('FreeThings');
      Repeat
      Until(Not(LoggedIn))
      {Call Free Things After you get logged out to properly Free Bitmap}
      FreeThings;
      Terminatescript();
    End.
    After you have done the above we will create a procedure just to test our bitmap out to see if we properly cut a good unique piece out.
    Note: 25-45 Tolerance is ideal and should not go anyhigher.
    Simba Code:
    Procedure Teleport;
    Begin
       {First we are going to want to go to the gametab inventory if the ring is equipped}
       GameTab(Tab_Equip);
       {Will search for your bitmap in the main inventory with a tolerance of 65, < This
        Is a High tolerance I only prefere 25-45 but it will work for this tutorial}

       If FindBitMapToleranceIn(Ring, X, Y, MIX1, MIY1, MIX2, MIY2, 65) Then
        {If It Finds The Bitmap It Will Debug It}
        WriteLn('Debug: We Found The Ring Of Kinship');
        {Movies The Mouse To The Item With A Randomness Pixel Shift of 3}
        MMouse(X, Y, 3, 3);
        {Right Clicks The Item}
        ClickMouse2(False);
        {Chooses The Option Teleport}
        WaitOption('eleport to Dae',250);
      End Else
        {If it cant find the ring it will debug this, then you will need to change tolerance, or use another piece of the item that's more unique.}
        WriteLn('Debug: We Could Not Find The Ring');
    End;
    {You will also need to declare X, Y variables}

    Now You should have something like this below.
    Simba Code:
    Program TestBitMap;
    {$DEFINE SMART}
    {$i srl/srl.Simba}


    Var
      X, Y, Ring: Integer; {All the script variables were declared here}

    Procedure CallThings;
    Begin
      Ring := BitmapFromString(4, 11, 'meJxTDfjV//uvasAv1cDfQCRuNFf' +
            'cZJFq4N+bj+9fuXvz7LVLxy+cWb9987qtm1ZtWr98/Zrsgryqhlpb' +
            'O/eq/Te9SloMfcNNg+MsIlIiuub6lLd7l7UGN01Jm79F3HiBuPE8I' +
            'EqZs1FAtYhL3J1L3DNp5logo/D4CSCZOH1NwbHjQARkAwDryT7e');
    End;
    Procedure FreeThings;
    Begin
      FreeBitMap(Ring);
    End;
    Procedure Teleport;
    Begin
      GameTab(Tab_Equip);
      If FindBitMapToleranceIn(Ring, X, Y, MIX1, MIY1, MIX2, MIY2, 65) Then
      Begin
        WriteLn('Debug: We Found The Ring Of Kinship');
        MMouse(X, Y, 3, 3);
        ClickMouse2(False);
        WaitOption('eleport to Dae',250);
      End Else
        WriteLn('Debug: We Could Not Find The Ring');
    End;
    Begin
      Smart_Server  := 18;
      Smart_Members := True;
      Smart_Signed  := True;
      Smart_SuperDetail := False;

      SetupSRL;
      CallThings;
      AddOnTerminate('FreeThings');
      ClickNorth(SRL_ANGLE_HIGH);
      Teleport; {Teleport Procedure Goes here so it will only be called once for testing purposes}
      Repeat
      Until(Not(LoggedIn))
      FreeThings;
      Terminatescript();
    End.

    Step 9) What to do if its picking up other items, or searching in the wrong places on the main-screen while trying to withdraw from bank etc or inventory. This usually happens with grey items such as Rune Essence + Steel | Iron bars etc.
    If you fiddled around with your tolerance and its still picking the wrong area what you need to do is drag the cross-hairs onto the client, then pick the color picker and find the coordinates of the main-screen or inventory.
    Pictures Below:

    Now to get the coordinates of the Bankscreen or Inventory.


    Step 10) Now after getting the coordinates of where you want to search for your object were going to change where where it will search for the bitmap.
    Code Below:
    Simba Code:
    {This will search the whole main screen}
    FindBitMapToleranceIn(Ring, X, Y, MSX1, MSY1, MSX2, MSY2, 45)
    {This will search inside the coords for the bank screen}
    If FindBitMapToleranceIn(Ring, X, Y, 29, 89, 477, 287, 45)

    {This will search the whole inventory, including the poles on the sides}
    If FindBitMapToleranceIn(Ring, X, Y, MIX1, MIY1, MIX2, MIY2, 45)
    {This will search just the inside of the inventory where items are}
    If FindBitMapToleranceIn(Ring, X, Y, 727, 458, 724, 455, 45)

    Congratulations If you followed the script you will of learnt how to create a bitmap and how to implement the bitmap string into a script. If you need any help feel free to post here with questions.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Nice guide, I'd suggest adding that bitmaps are better for static images or non moving images. However you could counter that with the finddeformedbitmaptolerancein, but I must say this is a great beginners guide for people just starting out. Very helpful!

  3. #3
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    I was keeping it simple for beginners for now I will expand on it later, I have quite a few things I'm trying to get done. Thanks hope its not to hard to follow.

  4. #4
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Very nice tutorial! I never knew ou were only supposed to get a section of the bitmap.

    May I suggest you use this to show the accuracy of your bitmaps:
    Simba Code:
    SMART_DrawCircle(False, Point(x, y), 10, False, clred);

    It just draws a circle around all the 'matching' bitmaps found to help us see how accurate it is

    (you may need to include paint.simba)

  5. #5
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Very nice tutorial! I never knew ou were only supposed to get a section of the bitmap.

    May I suggest you use this to show the accuracy of your bitmaps:
    Simba Code:
    SMART_DrawCircle(False, Point(x, y), 10, False, clred);

    It just draws a circle around all the 'matching' bitmaps found to help us see how accurate it is

    (you may need to include paint.simba)
    Believe it or not I was just going through the includes to find this, thank you though you beat me to it.

  6. #6
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by GOOGLE View Post
    Believe it or not I was just going through the includes to find this, thank you though you beat me to it.
    No problem

  7. #7
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    It's an ok tutorial but Intermediate :S?
    I'm not sure that this is different from any other bitmap/dtm tutorial I looked over. All in all it's ok but I don't know if it's intermediate.
    I am Ggzz..
    Hackintosher

  8. #8
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    It's an ok tutorial but Intermediate :S?
    I'm not sure that this is different from any other bitmap/dtm tutorial I looked over. All in all it's ok but I don't know if it's intermediate.
    Can have it moved later was keeping it here because I was going to add to it. But on the other hand the other bitmap tutorials are outdated they use full images for bitmaps with a black background which do not work anymore.
    Last edited by Google; 06-13-2012 at 07:05 AM.

  9. #9
    Join Date
    Mar 2012
    Location
    Alberta
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice tut, thanks

  10. #10
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by SwagDaddy View Post
    Nice tut, thanks
    No problem

  11. #11
    Join Date
    Jan 2012
    Posts
    522
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Would this also work for finding objects on screen?
    Previously known as "Phyaskou"

  12. #12
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Great tutorial, thanks so much! I've been hanging out for a bitmap tutorial to really show me how to get it done.

  13. #13
    Join Date
    Jan 2012
    Posts
    713
    Mentioned
    3 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Phyaskou View Post
    Would this also work for finding objects on screen?
    Yes you can but it's a little different I was going to add another section for that when I have time.

    Quote Originally Posted by p1ng View Post
    Great tutorial, thanks so much! I've been hanging out for a bitmap tutorial to really show me how to get it done.
    No problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •