Results 1 to 17 of 17

Thread: how do you implement functions in your script?

  1. #1
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default how do you implement functions in your script?

    I want to use some functions from SRL/SRL/core/inventory.scar. I always get errors when trying to compile them..
    Edit (more explained): Do I need to just wrtie the function name, do I copy the whole function, do I edit the function, etc. If someone could make a mini-guide how to use one, it'd be really helpful.

    I want to use function ClickAllItemsExcept
    Last edited by uncfan1119; 10-20-2009 at 08:43 PM.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

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

    Default

    Use it the same way that you would any other function that is in your script.

  3. #3
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    That wouldn't make sence to me, which is why I'm asking for help. Thanks for your non helping spam as usual.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

  4. #4
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function ClickAllItemsExcept(Identifier: Integer; ItemType, option: string; SlotIgnores: TIntegerArray; waitnum: Integer; tol: TIntegerArray):Integer;
    By: WT-Fakawi / Sumilion & Nava2
    Description: Performs "option" popup menu action on all items with:
      ItemType - 'dtm', 'bitmap', 'bitmap mask', 'color'
      Item - name/value of your dtm/bmp/color/bmpmask.
      Tol - 'dtm' - [] (dtm's can't have tolerance).
            'bmp' - [BMPTol].
            'color' - [COLOUR Tol, Colour Count].
            'bmpmask' - [BMPTol, ContourTol].
      Will not click items in slots SlotIgnores

    Search forums next time

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

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

    Default

    Show script example.

  6. #6
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    roger I have the function, I just don't know how to "use" it.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

  7. #7
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by uncfan1119 View Post
    roger I have the function, I just don't know how to "use" it.
    if you have {.include srl/srl.scar} at the top of your script (you better!), just type the name of the function
    It will being 'included' during compiling.
    Do not, copy and paste the function into your script
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  8. #8
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    ClickAllItemsExcept('dtm', OakLog, 'rop',[], 500,[]);

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  9. #9
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    noidea: thanks
    roger: for click all items except, what if I don't know what items I don't want to click? I just want to click the first 3 item slots, and they are different items, to equip.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

  10. #10
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    http://www.villavu.com/forum/showthread.php?t=49089
    This should help. Don't just quickly go through tutorials, read them carefully! All things aren't as simple as they first seem to be.

    EDIT:
    Quote Originally Posted by uncfan1119 View Post
    noidea: thanks
    roger: for click all items except, what if I don't know what items I don't want to click? I just want to click the first 3 item slots, and they are different items, to equip.
    See SRL/core/Inventory.scar
    there is procedure
    MouseItem(Slot: Integer; LeftClick: Boolean);
    or something like that.
    You use it like this
    SCAR Code:
    procedure ClickTehhItemz;
    begin
      MouseItem(1, True); // True means leftclick, false means rightclick
      MouseItem(2, True);
      MouseItem(3, True);
    end;
    Last edited by marpis; 10-20-2009 at 08:56 PM.

  11. #11
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    ClickAllItemsExcept('dtm', OreTwo, 'rop',[3,8,10], 500,[]);

    3,8,10 will not get dropped.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

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

    Default

    Quote Originally Posted by uncfan1119 View Post
    That wouldn't make sence to me, which is why I'm asking for help. Thanks for your non helping spam as usual.
    Really?
    ClickAllItemsExcept returns the amount of times the item was clicked.
    Example of use in a script:
    SCAR Code:
    mydtm := DTMFromStr('asdf;lkjdasf;lkfhasvbn14jdasf');
    count := ClickAllItemsExcept('dtm', mydtm, ''{leaving empty will leftclick the item}, [1]{ignores first slot}, 800{wait time for option choosing}, [10]{tolerance used in FindItemsEx function});
    WriteLn(Clicked ' IntToStr(count) ' items.');

    It isn't what you want to use.

  13. #13
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    mormon, thanks for the example. If it isn't what I want to use, what do you reccomend?

    if FindDTM(Blah,x, y, x1,y1,x2,y2) then
    Mouse(x,y,1,1,true);


    ^ To equip an item in the inventory.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

  14. #14
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    This?
    SCAR Code:
    if FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2) then
      Mouse(x, y, 3, 3, True);
    The MIX1, MIX2 and MIY1, MIY2 search the inventory area only

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


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


  15. #15
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by uncfan1119 View Post
    mormon, thanks for the example. If it isn't what I want to use, what do you reccomend?

    if FindDTM(Blah,x, y, x1,y1,x2,y2) then
    Mouse(x,y,1,1,true);


    ^ To equip an item in the inventory.
    If the items are ALWAYS in the same inv slots then just use ClickAllItemsExcept.

    If they are not then search for DTM.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  16. #16
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Presumably he's using it to equip the items picked up in the tutorial island.

    SCAR Code:
    Procedure Equip;
    Var
      I : Integer;
    Begin
      For I := 1 to 3 do
        DropItem(I);
    end;

    ~Sand

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

    Default

    I would just use a mouse over function so you don't have to "search" for a DTM or bitmap etc.

    If ItemExists(i) then
    MMouseItem(i);
    Check up text - WaitUpText
    equip if its correct - mouse / chooseoption

    Example:
    SCAR Code:
    function Equip(Items: TStringArray):boolean;
    var
      i,x,y:integer;
    begin
      GameTab(tab_Inv);
      for i := 1 to 28 do
      if ExistsItem(i) then
      begin
        MMouseItem(i);
        GetMousePos(x, y);
        if WaitUpTextMulti(Items, 400) then
        begin
          Mouse(x,y,0,0,false);
          wait(50+random(50));
          if ChooseOption('eild') then
          begin
            wait(350+random(150));
            Result := true;
            Exit;
          end;
        end;
      end;
    end;

    So instead of food you look for the items you want and just use a TStringArray for the UpText. You could even make it interchangeable so you can equip items at various stages. The way its setup it exits after it equips one but you can easily change it to do as you need.

    Note: the code is just an example, names aren't perfect
    (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.

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
  •