Results 1 to 7 of 7

Thread: Take screenshot of specific area?

  1. #1
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default Take screenshot of specific area?

    Ok so I hope my question is simple. I want to take a screenshot of a specific area of the rs screen, lets say the inventory or chat box as an example. I looked at how FindMod works and it uses TakeScreen(), but that takes a picture of the whole screen. Any suggestions?

    *To make it clear, I want this to be done by the script, not me using PrintScreen and cropping it *

  2. #2
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Your best bet is to store the screenshot of the picture as a bitmap, then crop the bitmap and finally save it as a bmp.

    This is done in some of the debug functions in debug.simba at SRL/SRL/misc/debug.simba. I don't really know how to do it exactly, but I think there's the code you can explore.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  3. #3
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default

    Ok thanks for the tip, I'll post back if I find the answer.

  4. #4
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    I made a cool procedure for screenshots. It will make a small sized jpg file.
    Simba Code:
    procedure MakeScreenShot(const FilePath : String);
    var
      fileName : String;
      Year, Month, Day : Word;
      i : Integer;
    begin
      if not DirectoryExists(FilePath) then
        CreateDirectory(FilePath);
      DecodeDate(Date,Year,Month,Day);
      i := 0;
      repeat
        i := i+1;
        fileName := ToStr(Year)+'-'+ToStr(Month)+'-'+ToStr(Day)+' ('+IntToStr(i)+')';
      until not FileExists(FilePath+FileName+'.jpg')
      SaveScreenShot(FilePath+FileName+'.jpg');
    end;

    Example:
    MakeScreenShot('C:\Simba\Screenshots\');
    But my problem is: SMART paints wont show up on these pictures. Any way to capture SMART paints too? I tried SaveBitmap too...
    Last edited by Shatterhand; 02-27-2012 at 07:10 PM.

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

    Default

    I currently use this to create SPS map Snippets without blurs.. U can try it and modify it so that it does the chatbox instead.. It won't be that hard.. Just some math and knowledge of TPA's and ur good to go.

    Simba Code:
    program SPS_MapMaker;
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/Debug.Simba}

    Procedure GetMinimap(Name: String);
    var
      TPA, Draw: TPointArray;
      TIA: TIntegerArray;
      I, BMP: Integer;
    begin
      BMP:= CreateBitmap(MMX2 - MMX1 + 1, MMY2 - MMY1 + 1);
      TPA:= TPAFromBox(MMBox);
      FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, MMCX, MMCY);
      TIA:= GetColors(TPA);

      TPA:= TPAFromBox(IntToBox(0, 0, MMX2 - MMX1, MMY2 - MMY1));
      DrawTPABitmap(BMP, TPA, 16777215);
      FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, (MMX2 - MMX1)/2, (MMY2 - MMY1)/2);

      For I:= 0 To High(TPA) do
      begin
        SetLength(DRAW, 1);
        Draw[0]:= TPA[I];
        DrawTPABitmap(BMP, Draw, TIA[I]);
      end;

      DebugBitmap(BMP);
      SaveBitmap(BMP, 'C:/Users/Brandon/Desktop/' + Name + '.bmp');
      FreeBitmap(BMP);
    end;

    begin
      SetupSRL;
      GetMinimap('Testing');
    end.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    I currently use this to create SPS map Snippets without blurs.. U can try it and modify it so that it does the chatbox instead.. It won't be that hard.. Just some math and knowledge of TPA's and ur good to go.

    Simba Code:
    program SPS_MapMaker;
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/Debug.Simba}

    Procedure GetMinimap(Name: String);
    var
      TPA, Draw: TPointArray;
      TIA: TIntegerArray;
      I, BMP: Integer;
    begin
      BMP:= CreateBitmap(MMX2 - MMX1 + 1, MMY2 - MMY1 + 1);
      TPA:= TPAFromBox(MMBox);
      FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, MMCX, MMCY);
      TIA:= GetColors(TPA);

      TPA:= TPAFromBox(IntToBox(0, 0, MMX2 - MMX1, MMY2 - MMY1));
      DrawTPABitmap(BMP, TPA, 16777215);
      FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, (MMX2 - MMX1)/2, (MMY2 - MMY1)/2);

      For I:= 0 To High(TPA) do
      begin
        SetLength(DRAW, 1);
        Draw[0]:= TPA[I];
        DrawTPABitmap(BMP, Draw, TIA[I]);
      end;

      DebugBitmap(BMP);
      SaveBitmap(BMP, 'C:/Users/Brandon/Desktop/' + Name + '.bmp');
      FreeBitmap(BMP);
    end;

    begin
      SetupSRL;
      GetMinimap('Testing');
    end.
    Great idea, im working on it! Thanks!
    EDIT: I managed to get it work, but it still wont draw the things what I painted on SMART.
    This DebugImgForm looks cool.
    Simba Code:
    procedure MakeScreenShotDebug(const FilePath : String);
    var
      fileName : String;
      Year, Month, Day : Word;
      TPA, Draw: TPointArray;
      TIA: TIntegerArray;
      BMP, W, H, i: Integer;
    begin
      GetClientDimensions(W, H);
      BMP:= CreateBitmap(W, H);
      TPA:= TPAFromBox(PointToBox(Point(0,0),Point(W-1,H-1)));
      TIA:= GetColors(TPA);
      For I:= 0 To High(TPA) do
      begin
        SetLength(DRAW, 1);
        Draw[0]:= TPA[I];
        DrawTPABitmap(BMP, Draw, TIA[I]);
      end;
      DebugBitmap(BMP);


      if not DirectoryExists(FilePath) then
        CreateDirectory(FilePath);
      DecodeDate(Date,Year,Month,Day);
      i := 0;
      repeat
        i := i+1;
        fileName := ToStr(Year)+'-'+ToStr(Month)+'-'+ToStr(Day)+' ('+IntToStr(i)+')';
      until not FileExists(FilePath+FileName+'.bmp')
      SaveBitmap(BMP,FilePath+FileName+'.bmp');
    end;
    Last edited by Shatterhand; 02-27-2012 at 07:52 PM.

  7. #7
    Join Date
    Jan 2012
    Location
    Long Island, NY
    Posts
    413
    Mentioned
    5 Post(s)
    Quoted
    95 Post(s)

    Default

    Yah I tried using the debug in my script as
    Simba Code:
    procedure SaveProggy;
    begin
      SmartProggy;
      wait(1000);
      TakeScreenshotEx('',6,344,514,474);
      TerminateScript;
    end;

    But it seems that anything created via paintsmart.simba will not display in that bitmap. It's a shame too, because it works perfectly except that it doesn't include what I want to be printed , any ideas?

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
  •