Results 1 to 14 of 14

Thread: Smithing.scar ~ FindBar

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

    Default Smithing.scar ~ FindBar

    SCAR Code:
    {*******************************************************************************
    function FindBar(var cx, cy : Integer; xs, ys, xe, ys : Integer; Bar : string) : Boolean;
    By: R1ch
    Description: Returns True if the bar specified in found in the place specified
    Used Like: FindBar(x, y, MIX1, MIY2, MIX2, MIY2, 'Rune')
    Valid "Bar": Bronze, Iron, Steel, Mith, Addy, Rune
    *******************************************************************************}


    function FindBar(var cx, cy : Integer; xs, ys, xe, ys : Integer; Bar : string) : Boolean;
    var
      BTF : Integer;
    begin
      case (Bar) of
        'Bronze': BTF := DTMFromString('78DA635CC7C4C060C5C8800CA25C351944803' +
           '448F43F10306E00AA31425503918591407A3B508D1901359B806A' +
           'EC08A8590D54E34A40CD3CA01A4722D4581150B310A8C61CBF1A0' +
           '07E6E0C2E');

        'Iron': BTF := DTMFromString('78DA636C656260106164400689D1510C22401' +
           'A24FA1F08187B806A0450D54064612490EE05AA1125A0A60DA846' +
           '86809A1AA01A05026A8A806A2409A82907AA11C6AF0600E699097' +
           'A');

        'Steel': BTF := DTMFromString('78DA635CC3C4C020CAC8800C26B4B63208016' +
           '990E87F2060DC0454C38FAA06220B2381F436A01A31026A3602D5' +
           '481350B312A84691809AF94035B244A811C5542382AC6621508D3' +
           '06E73D8801800ABCC0BFA');

        'Mith': BTF := DTMFromString('78DA63BCCEC4C020CEC8800CBCBDF31944803' +
           '448F43F1030DE06AAE147550391859140FA21508D10013577816A' +
           '2409A801B9479E809AD340357204D41CC7F417869A3384DD0C00E' +
           '40A0CA1');

        'Addy': BTF := DTMFromString('78DA63CC66646098C38002FC93FD194480345' +
           '086E13F10301600595319D000231209A44B30CDC1509303642D21' +
           'A02605C85A46404D1490B590809A58206B3601350940D60CFC6A0' +
           '043E00D52');

        'Rune': BTF := DTMFromString('78DA637CC7C0C0B09F0105046497338800694' +
           '620FE0F048C5F818C5D0C6880118904D25F80C421026ADE028993' +
           '04D43C2142CD03207182809ABB40E22001357780C411026A1E028' +
           '9BD04D47C0712FBF0AB0100A2AE160E');
      end;
      Result:= FindDTM(BTF, cx, cy, xs, ys, xe, ye);
    end;

    Quite a simple but handy function. If the bar that is specified is found in the area of the screen specified then it returns True.

    Example:
    SCAR Code:
    if FindBar(x, y, MIX1, MIY2, MIX2, MIY2, 'Rune') then

    Comments?
    <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
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    SCAR Code:
    Result:= FindDTM(BTF, cx, cy, xs, ys, xe, ye;
    Should be
    SCAR Code:
    Result:= FindDTM(BTF, cx, cy, xs, ys, xe, ye);

    But other than that, looks good.

    Edit: And shouldn't it be
    SCAR Code:
    function FindBar(var cx, cy : Integer; xs, ys, xe, ys : Integer; Bar : string) : Boolean;

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

    Default

    Thanks senrath, fixed the little errors. Does anyone else have any comments?
    <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.

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

    Default

    Quote Originally Posted by R1ch View Post
    Thanks senrath, fixed the little errors. Does anyone else have any comments?
    You didn't quite fix the second thing I mentioned. You put it like this:
    function FindBar(var cx, cy, xs, ys, xe, ys : Integer; Bar : string) : Boolean;

    You need it like this:
    function FindBar(var cx, cy : Integer; xs, ys, xe, ys : Integer; Bar : string) : Boolean;

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

    Default

    I don't need to do that, as they are all integers.
    <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.

  6. #6
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes you have to do that because you are asking for 6 variables instead of 2.


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

    Default

    Oh, sorry. I've changed that, but could you explain to me why I need to declare Integer; twice please?

    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.

  8. #8
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by R1ch View Post
    Oh, sorry. I've changed that, but could you explain to me why I need to declare Integer; twice please?

    Thanks,
    Richard
    If you do this:
    SCAR Code:
    function FindBar(var cx, cy, xs, ys, xe, ys : Integer; Bar : string) : Boolean;
    then the person who wants to call the function has to do this:
    SCAR Code:
    procedure X;
    Var
      A, B, C, D, E, F, G : Integer;
    Begin
      FindBar(A, B, C, D, E, F, G, 'bronze');
      ....
    End;
    If you don't declare those variables you'll get a variable excepted error.


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

    Default

    Quote Originally Posted by R1ch View Post
    Oh, sorry. I've changed that, but could you explain to me why I need to declare Integer; twice please?

    Thanks,
    Richard
    It's because you're declaring 2 variables that happen to be integers, and also saying that you need the input of 4 other integers.

  10. #10
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Putting 'var x, y : Integer; xs, ys, xe, ye' for example, will require a user to put:
    SCAR Code:
    Procedure SomeThing;
    Var
      x, y : Integer;
    Begin
      Blabla(x, y, 0, 0, 1440, 900); // X and Y will be _filled in_ by the function while xs, ys, etc. are e.x coords of a window where it'll search "it"
    End;
    Ce ne sont que des gueux


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

    Default

    Ok, thanks guys. Apart from that, any other comments about the function?
    <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.

  12. #12
    Join Date
    Mar 2007
    Location
    England
    Posts
    274
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think that it should definately be added.
    +rep

    would it be used like
    SCAR Code:
    begin
      OpenBankFast('akb');
      if FindBar(x, y, MSX1, MSY2, MSX2, MSY2, 'iron') then
      begin
        Mouse(x, y, 3, 3, false);
        ChooseOption('Withdraw-All');
        CloseBank;
      end;
    end;
    to make iron bars?

  13. #13
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    If you declare DTMs you need to free them as well. This function will slowly fill up your memory. And indeed, it should return the x and y coords to use it as trojan indicates.

    But good work!
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  14. #14
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Use bitmaps.scar,

    bmp_Bar_Bronze = 10;
    bmp_Bar_Iron = 11;
    bmp_Bar_Steel = 12;
    bmp_Bar_Silver = 13;
    bmp_Bar_Gold = 14;
    bmp_Bar_Mithril = 15;
    bmp_Bar_Adamant = 16;
    bmp_Bar_Runite = 17;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to get 85 Smithing~ Which method is Better!?
    By nobody u kno in forum RuneScape News and General
    Replies: 5
    Last Post: 05-17-2008, 02:40 PM
  2. Smithing Menu
    By Sir R. M8gic1an in forum RS has been updated.
    Replies: 0
    Last Post: 11-05-2007, 10:01 PM

Posting Permissions

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