Results 1 to 22 of 22

Thread: SRL: Jan. 10th, 2012 ~ Paint SMART Additions & FTab

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default SRL: Jan. 10th, 2012 ~ Paint SMART Additions & FTab

    Some nice additions in today's update.
    Progress Report:
    Cohen Adair (Coh3n) (9):
          Mormonman's paintsmart.simba additions
          Added a variation of Flight's DrawTextMulti
          Removed unnecessary 1-liners (won't break scripts) and fixed Y positioning in DrawTextMulti
          Added SMART_ClearCanvasArea and removed ClearRSCanvas/ClearCanvas
          Added SMART_DrawBitmap
          Added documentation to paintsmart.simba
          Added paintsmart.simba to doc
    
    Merlijn Wajer (Wizzup?) (1):
          Add Skill doc for magic.
    
    Nathan Hartung (Narcle) (2):
          Added FTab (faster way to switch to major tabs using F keys)
          Changed a wait in FlagEx
    Commits can be found here.

    New functions:
    • FTab in gametab.simba (uses the F keys to navigate through game tabs)
    • SMART_DrawTextMulti
    • SMART_DrawDot
    • SMART_DrawPolygons
    • SMART_DrawCircle
    • SMART_DrawBoxes
    • SMART_DrawBitmap
    • SMART_DrawLine
    • SMART_ClearCanvasArea
    • SMART_ClearCanvas
    If you want to know more about these functions, check out SRL/SRL/misc/paintsmart.simba or SRL's documentation.

    Other:
    • DrawDotsMulti has been renamed to SMART_DrawDotsMulti.
    • ClearCanvas has been removed.
    • ClearRSCanvas has been removed, use SMART_ClearCanvas instead.


    Enjoy,
    The SRL Team

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Holy shit awesome smart debug stuff, I'm going to wait until Flight figures them all out and makes a tutorial, these will look really sexy I bet oh man!

    Someone should implement these and make a short video!

    E: Oh SHIT! Debug TPA/ATPA onto SMART! WOWOOW

  3. #3
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    yayaya clear area!!!@#!@
    Oh Hai Dar

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

    Default

    :c I was hoping to see a function that turns an array of integer colours into TPoints Or bitmaps. Either way Nice updates I actually just tested the clearareacanvas
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    :c I was hoping to see a function that turns an array of integer colours into TPoints Or bitmaps. Either way Nice updates I actually just tested the clearareacanvas
    like this?
    Simba Code:
    {*******************************************************************************
    Procedure SMART_DrawDots(Dots: TPointArray);
    Contributors: Sir R. Magician
    Description: Draws a TPA onto the SMART Debug canvas
    *******************************************************************************}

    procedure SMART_DrawDots(Dots: TPointArray);


    Regardless, this is pretty cool Can't wait to try and test these out on the script I'm working on

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

    Default

    Quote Originally Posted by nickrules View Post
    like this?
    SImba tags are messed up..


    Regardless, this is pretty cool Can't wait to try and test these out on the script I'm working on
    Nah not like that.. I'll actually attempt to write it..

    Sorta like this:
    Simba Code:
    function TIntToBMP(T: TIntegerArray; Size_X, Size_Y: Integer): TBitmap;
    begin
        For I:= 0 To High(Size_Y) do
           For J:= 0 To High(Size_X) do
                 WriteToBMP(T[I][J])
    end;

    something like that.. See the idea I have in my head is that for every colour in the array, that represents ONE pixel.. Specify the size of the bitmap and write each pixel to it going across then down 1, across again.. down 1.. across again.. repeat until I & J Match Size_Y & Size_X respectively..

    I just can't figure out how to write it to the bitmap.. I'm going to guess it's the complete opposite of GetBitmapAreaColors.
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    YoHoJo: The ATPA/TPA debugging has been there forever. That's what MSI uses.

  8. #8
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?

  9. #9
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?
    Isn't that less efficient than directly changing the colors of the SMART canvas? Because you have to make a bitmap, then copy the whole bitmap which contains points that the TPA doesn't.

  10. #10
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?
    Flight does that in his original DrawTextMulti function. I changed it to draw to the SMART canvas so it would work with the rest of the methods.

    If you want, you could draw (A)TPAs to a bitmap then call SMART_DrawBitmap.

  11. #11
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    THIS IS REALLY cool dude oh my god I love it!!!!!!!!!

    God I'm going crazy this is AWESOME!

    Any idea how much if any memory/lag/etc this creates? Is it negligible?

    E: Can we make transparent/semi-transparent drawings on smart? If not, it owuld be an awesome feature!

    E: Can you make it so instead of all of them calling SMART_ClearCanvas they have option to just SMART_ClearCanvasArea? Like what if I don't want to clear everything?

    Also, what if I'm drawing two things on top of each other. I want the bottom one to always just stay drawn, but I want the top one to clear/update, how would I do that?
    Last edited by YoHoJo; 01-11-2012 at 09:09 AM.

  12. #12
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    THIS IS REALLY cool dude oh my god I love it!!!!!!!!!

    God I'm going crazy this is AWESOME!

    Any idea how much if any memory/lag/etc this creates? Is it negligible?

    E: Can we make transparent/semi-transparent drawings on smart? If not, it owuld be an awesome feature!

    E: Can you make it so instead of all of them calling SMART_ClearCanvas they have option to just SMART_ClearCanvasArea? Like what if I don't want to clear everything?

    Also, what if I'm drawing two things on top of each other. I want the bottom one to always just stay drawn, but I want the top one to clear/update, how would I do that?
    Lag varies depending on how much you paint and how often. However, once it is painted, I don't think it would take much at all.

    @E1: Yeah, it's a bit funky. You have to do some color conversions though. And drawing over a large area was rather slow when i last tried.

    @E2: Most have a parameter to clear the screen. Set it to false then call the function to clear only an area.

    @E2.2: You'd have to paint the static area first, then the changing area. The only way to clear it I imagine would be to redraw the static area each time. You could also possibly do something with multiple canvases and clear just the one on top. I'm not too familiar with all that though, so I wouldn't know where to start.

  13. #13
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I talked to Ben about the speed. Whats slow is Pascal to SMARTs buffer to paint on the canvas. So minimize the amount your drawing to the canvas. This is why I setup a background in my Fast Fighter so that its not repeatedly drawing a huge TPA array. Basically its Pascal being slow.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  14. #14
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    YoHoJo, try using a TBitmap or TMufasaBitmap and mess with the transparency.

  15. #15
    Join Date
    May 2008
    Location
    ;)
    Posts
    576
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Alright, i knew I had this somewhere. This will create a transparent overlay in the ms.
    Simba Code:
    Procedure DrawOnInv;
    var
    //drawing : TCanvas;
    TPA: TPointArray;
    Colors: TIntegerArray;
    Pic, mx, my, I: Integer;
    C, R, G, B: Integer;
    begin
      TPA := TPAFromBox(MSBox)
      Colors := GetColors(TPA);
      GetClientDimensions(mx,my);
      Pic := BitmapFromString(mx,my,'');

      Smart_DrawDotsEx(True,[],0)   //clear
      for i:= 0 to high(TPA) do
        begin
          C := Colors[i];
          ColorToRGB(C, R, G, B);
          R := R + 0;
          G := G + 205;
          B := B + 0;
          C := RGBToColor(R, G, B);
          FastSetPixel(Pic, TPA[i].x, TPA[i].y, C);
        end;

      Canvas.handle := SmartGetDebugDC;
      DrawBitmap(Pic, Canvas, MSX1 -4, MSY1 -4{372});
      FreeBitmap(Pic)
      writeln('done painting');
    end;


    It looks a bit funky from what I saw. But if you fiddle with the colors, search areas, search colors, etc., you can make some pretty nice looking things.


    E: Not sure if this is actually what you want though :P
    Last edited by nickrules; 01-12-2012 at 02:05 AM.

  16. #16
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    YoHoJo, try using a TBitmap or TMufasaBitmap and mess with the transparency.
    Are we able to set the transparency %/amount for a bitmap?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  17. #17
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Are we able to set the transparency %/amount for a bitmap?
    Not that I know of. There is Get/SetTransparantColor which makes be think SetTransparantPercent can be easily added to Simba's TBitmap or TMufasaBitmap.

  18. #18
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Great update, I've just been messing around with the new features myself.

    Just something I noticed... in the SRL 5 v1 documentation the example for "SMART_ClearCanvas" is

    Code:
    SMART_ClearCanvasArea();
    I assume it should be

    Code:
    SMART_ClearCanvas();

  19. #19
    Join Date
    May 2007
    Posts
    526
    Mentioned
    12 Post(s)
    Quoted
    109 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Not that I know of. There is Get/SetTransparantColor which makes be think SetTransparantPercent can be easily added to Simba's TBitmap or TMufasaBitmap.
    I'm sure SetTransparentColor is not about setting the alpha channel...

  20. #20
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    Great update, I've just been messing around with the new features myself.

    Just something I noticed... in the SRL 5 v1 documentation the example for "SMART_ClearCanvas" is

    Code:
    SMART_ClearCanvasArea();
    I assume it should be

    Code:
    SMART_ClearCanvas();
    Thanks, fixed for the next version.

    Quote Originally Posted by superuser View Post
    I'm sure SetTransparentColor is not about setting the alpha channel...
    Huh? I was just saying since there's already some transparent properties exported to PS, that more can be exported.

  21. #21
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by superuser View Post
    I'm sure SetTransparentColor is not about setting the alpha channel...
    You are correct. It just sets a certain color to be ignored or w/e. (bmps don't support it iirc?)
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  22. #22
    Join Date
    Apr 2007
    Posts
    373
    Mentioned
    2 Post(s)
    Quoted
    24 Post(s)

    Default

    Very nice functions,
    very helpfull for debug and very easy to use.
    Good job.
    ~Fre

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
  •