Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: Herblore.scar

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default Herblore.scar

    SCAR Code:
    {*******************************************************************************
    function CountEmptyVials : Integer;
    By: R1ch
    Description: Gets amount of empty vials in inventory
    *******************************************************************************}

    function CountEmptyVials : Integer;
    begin
      Result:= CountItems('bmp',srl_GetBitmap(srl_Empty_Vial), []);
      srl_FreeBitmaps;
    end;

    {*******************************************************************************
    function CountFullVials : Integer;
    By: R1ch
    Description: Gets amount of full vials in inventory
    *******************************************************************************}

    function CountFullVials : Integer;
    begin
      Result:= CountItems('bmp',srl_GetBitmap(srl_Full_Vial), []);
      srl_FreeBitmaps;
    end;

    {*******************************************************************************
    function CountAllVials : Integer;
    By: R1ch
    Description: Gets amount of vials in inventory
    *******************************************************************************}

    function CountAllVials : Integer;
    begin
      Result:= CountEmptyVials + CountFullVials;
    end;

    {*******************************************************************************
    function EmptyVials(Amount : Integer) : Boolean;
    By: R1ch
    Description: Emptys Amount vial in the inventory.
    *******************************************************************************}

    function EmptyVials(Amount : Integer) : Boolean;
    var
      I, X, Y : Integer;
      E, F : TIntegerArray;

    begin
      srl_LoadBitmaps([110, 111]);
      if (CountFullVials < Amount) then
      begin
        srl_Warn('EmptyVials', 'Incorrect amount: ' + IntToStr(Amount), warn_AllVersions);
        srl_FreeBitmaps;
        Exit;
      end;
      F[0]:= CountFullVials;
      E[0]:= CountEmptyVials;
      for I:= 1 to Amount do
      begin
        if FindBitmapToleranceIn(srl_GetBitmap(srl_Full_Vial), X, Y, MIX1, MIY1, MIX2, MIY2, 15) then
        begin
          MMouse(X, Y, 8, 8);
          GetMousePos(X, Y);
          if WaitUpTextMulti(['ial', 'ater'], 300) then
          begin
            Mouse(X, Y, 0, 0, False);
            WaitOptionMulti(['mpty', 'ial', 'ater'], 300);
          end;
        end else
        begin
          srl_FreeBitmaps;
          Exit;
        end;
      end;
      F[1]:= CountFullVials;
      E[1]:= CountEmptyVials;
        if ((E[0] - E[1]) = Amount) then
          if ((F[0] - Amount) = F[1]) then
            Result:= True;
      srl_FreeBitmaps;
    end;

    {*******************************************************************************
    function NoVials : Boolean;
    By: R1ch
    Description: Emptys Amount vial in the inventory.
    *******************************************************************************}

    function NoVials : Boolean;
    begin
      Result:= (CountAllVials = 0);
    end;

    Bitmaps:
    SCAR Code:
    bmp_Empty_Vial: Result := BitmapFromString(13, 18, 'beNpjYEAFjEgIJ6gvtspPNY4' +
           'L1fZ2UcKtknHH8pBtS4OBqKvWvjTbDJcyiJqNCwPbq+2KMkzwK1s/' +
           'P6ClwhZoO6a94eExUdHxEKNWzfJrKrPOSTJ0cvZwd/dBNicpKQ0Zh' +
           'YXHBASGeXsH2to6ISvLzs4DopwcKAoJjfL3D3V0cjcyNkOymrGkpA' +
           'yCiopKCgqKgoMj3dy8zS1s1NW1UF3IuGrV2i1btm7evGXjps1AG+3' +
           'snLGFM2NGRnZlZVUNGABtdHBwxRbCjIWFRVVV1UAEBBCHYVUGNAqI' +
           'IABoqbOLh6mZFZqa3Nz8iopKOIJ4wcLSFtmbiUmp5eUVcDUJiSmhY' +
           'dGeXv7WNg4mphYwlYz5+YXIyoC6IiPjvH0C7e1dgGECUZacnFZaWg' +
           'ZUBkdAkejoBD+/EKAvYAYy5OUVlJWVwxFQWUpKemxcUmBQuIurJzD' +
           '0QAYCANcanbA=');

        bmp_Full_Vial: Result := BitmapFromString(9, 12, 'beNpzS2YAAcZtS4OBaOPCwPZqu' +
           '6IMEwYoYIRLrZ8f0FJhm59qDJEID4+Jio6HaFk1y6+pzDonydDJ2c' +
           'Pd3ScpKQ0ZhYXHBASGeXsH2to6ZWfnAVFODhSFhEb5+4c6OrkbGZu' +
           'VlJRBUFFRSUFBUXBwpJubt7mFjbq6FtANq1at3bJl6+bNWzZu2gw0' +
           'zc7OGeI2IMrIyK6srKoBA6BpDg6uYHGQ4wsLi6qqqoEICCAWwaXWb' +
           'zwO1AUBQAOdXTxMzayA4tNn71m74RgEAdVk5s+Oim9198kCuWHtkT' +
           'Xrj0KkaprX5xQtjEnq9AkocAIA+nR08w==');
    Quite self explanatory. And they now use bitmaps instead of DTMs.

    Comments?

    Richard
    Last edited by Rich; 07-08-2009 at 10:38 PM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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

    Default

    I was going to say that everyone is saying to use Bitmap.scar instead of making your own DTMs, but you got it covered.

    I like them TBH, the first one is a lot like The Man's procedures except it's kinda got the Check + Count in one. Because obviously if there's say, 10 Vials in the inventory, then there's a vial in the inventory. If that made any sense... XD

    Good job, IMO.

  3. #3
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry, I'm tired and stuff. Good work.
    Last edited by ian.; 07-06-2009 at 10:24 AM.

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

    Default

    Quote Originally Posted by 99_ aka ian. View Post
    Use bitmaps instead?
    He says he'll switch later on.

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    man. all the bitmap stuff is crazy :P i remember a few years ago, if some one used a bitmap every one would be all "omg noob use learn dtms", now its like, "omg use a bitmap, i cant handle the 0.01 second lag"

    no offence to any one
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by akwardsaw View Post
    man. all the bitmap stuff is crazy :P i remember a few years ago, if some one used a bitmap every one would be all "omg noob use learn dtms", now its like, "omg use a bitmap, i cant handle the 0.01 second lag"

    no offence to any one
    It's more for the SRL_LoadBitmap thing or something like that. Easier to load/free with SRL instead of in the script. Or something.

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

    Default

    Quote Originally Posted by akwardsaw View Post
    man. all the bitmap stuff is crazy :P i remember a few years ago, if some one used a bitmap every one would be all "omg noob use learn dtms", now its like, "omg use a bitmap, i cant handle the 0.01 second lag"

    no offence to any one
    Lol, I haven't been here two years, but I know what you mean. I've seen people saying that. I always thought DTMs were better TBH, apparently not. XD

    EDIT: @ian. That makes sense.

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    i still havnt even looked at srl_loadbitmap procedures and such. i probobly wont for a while too . unless i come across it next time i lurk in the includes
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I'd call it CountEmptyVials or something like that, because EmptyVials makes it sound like it's for emptying out vials.

  10. #10
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Good point Senrath. I'll change that in a second. Also, I might as well make a function that does empty the vials.

    Cohen, I know what you mean about begin taught to use DTMs. I've always seen people saying that DTMs are better, and now it's the other way...apparently.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  11. #11
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by akwardsaw View Post
    i cant handle the 0.01 second lag
    Did you ever try the FindRange, at cooking.scar, if not yet then i'll just have to say that it'll completly freeze your Screen, and yes its made by dtm's.

    It's the small things that make the thing changes.
    Hi

  12. #12
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    I believe the main reason people are saying Bitmaps now is because in SCAR 3.20 freddy made the bitmaps finding more fast and accurate, making bitmap searching now faster than DTM searching.

    I believe, I could be wrong.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  13. #13
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Ok...I'll make bitmaps for these later on, after school, and then hopefully they'll be more efficient.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  14. #14
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Ok, I've changed them to bitmaps, and added EmptyVials, which is pretty self-explanatory.

    SCAR Code:
    {*******************************************************************************
    function CountEmptyVials : Integer;
    By: R1ch
    Description: Gets amount of empty vials in inventory
    *******************************************************************************}

    function CountEmptyVials : Integer;
    begin
      srl_LoadBitmaps([110]);
      Result:= CountItems('bmp', srl_Empty_Vial, []);
      srl_FreeBitmaps;
    end;

    {*******************************************************************************
    function CountFullVials : Integer;
    By: R1ch
    Description: Gets amount of full vials in inventory
    *******************************************************************************}

    function CountFullVials : Integer;
    begin
      srl_LoadBitmaps([111]);
      Result:= CountItems('bmp', srl_Full_Vial, []);
      srl_FreeBitmaps;
    end;

    {*******************************************************************************
    function CountAllVials : Integer;
    By: R1ch
    Description: Gets amount of vials in inventory
    *******************************************************************************}

    function CountAllVials : Integer;
    begin
      Result:= CountEmptyVials + CountFullVials;
    end;

    {*******************************************************************************
    function EmptyVials(Amount : Integer) : Boolean;
    By: R1ch
    Description: Emptys Amount vial in the inventory.
    *******************************************************************************}

    function EmptyVials(Amount : Integer) : Boolean;
    var
      I, X, Y : Integer;
      E, F : TIntegerArray;
     
    begin
      srl_LoadBitmaps([110, 111]);
      if (CountFullVials > Amount) then
      begin
        srl_Warn('EmptyVials', 'Incorrect amount: ' + IntToStr(Amount), warn_AllVersions);
        srl_FreeBitmaps;
        Exit;
      end;
      F[0]:= CountFullVials;
      E[0]:= CountEmptyVials;
      for I:= 1 to Amount do
      begin
        if FindBitmapToleranceIn(srl_Full_Vial, X, Y, MIX1, MIY1, MIX2, MIY2, 15) then
        begin
          MMouse(X, Y, 8, 8);
          GetMousePos(X, Y);
          if WaitUpTextMulti(['ial', 'ater'], 300) then
          begin
            Mouse(X, Y, 0, 0, False);
            WaitOptionMulti(['mpty', 'ial', 'ater'], 300);
          end;
        end else
        begin
          srl_FreeBitmaps;
          Exit;
        end;
      end;
      F[1]:= CountFullVials;
      E[1]:= CountEmptyVials;
        if ((E[0] - E[1]) = Amount) then
          if ((F[0] - Amount) = F[1]) then
            Result:= True;
    end;

    Please comment.

    EDIT: Sorry about double post, I just noticed.
    Last edited by Rich; 07-08-2009 at 12:13 AM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  15. #15
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Maybe
    SCAR Code:
    function NoVials : boolean;
    begin
      result := (CountEmptyVials = 0) and (CountFullVials = 0);
    end;
    ?

  16. #16
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Whats the point of this?
    SCAR Code:
    if (CountFullVials > Amount) then
      begin
        srl_Warn('EmptyVials', 'Incorrect amount: ' + IntToStr(Amount), warn_AllVersions);
        srl_FreeBitmaps;
        Exit;
      end;

  17. #17
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Maybe
    SCAR Code:
    function NoVials : boolean;
    begin
      result := (CountEmptyVials = 0) and (CountFullVials = 0);
    end;
    ?
    Added, but changed a bit.

    Quote Originally Posted by senrath View Post
    Whats the point of this?
    SCAR Code:
    if (CountFullVials > Amount) then
      begin
        srl_Warn('EmptyVials', 'Incorrect amount: ' + IntToStr(Amount), warn_AllVersions);
        srl_FreeBitmaps;
        Exit;
      end;
    Sorry, that's meant to be:
    SCAR Code:
    if (CountFullVials < Amount) then
      begin
        srl_Warn('EmptyVials', 'Incorrect amount: ' + IntToStr(Amount), warn_AllVersions);
        srl_FreeBitmaps;
        Exit;
      end;
    Last edited by Rich; 07-08-2009 at 12:30 AM.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  18. #18
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    test your functions, i can see mistakes from here. GJ on the thinking behind them.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  19. #19
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Could you point the mistakes out, then I test it I just means that it'll be easier for me.

    Thanks,
    Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  20. #20
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    srl_GetBitmap(srl_full_vial) returns the bitmap.

  21. #21
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    So instead of
    SCAR Code:
    srl_LoadBitmaps([111]);
    I'd use
    SCAR Code:
    srl_GetBitmap(srl_Full_Vial)
    ?
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  22. #22
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    man. all the bitmap stuff is crazy :P i remember a few years ago, if some one used a bitmap every one would be all "omg noob use learn dtms", now its like, "omg use a bitmap, i cant handle the 0.01 second lag"

    no offence to any one
    It's actually like 0.06.

    Edit: And just set a bitmap variable to srl_getbitmap(id). Then use it, and then free it.

  23. #23
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Changed them around a bit more, and fixed some bugs. If you find any more, please let me know.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  24. #24
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Whoops. There's a really obvious error in CountEmptyVials.

  25. #25
    Join Date
    May 2007
    Location
    England
    Posts
    4,141
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    Whoops. There's a really obvious error in CountEmptyVials.
    That must have happened in the copy/paste process. Sorry about that.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

Page 1 of 2 12 LastLast

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
  •