+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 25 of 30

Thread: /MSI/Skill functions

  1. #1
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default /MSI/Skill functions

    Looking at the functions we have in Woodcutting.scar currently, I see no reason why those same functions wouldn't work for Mining.scar.

    The only thing I can see that makes them specifically Woodcutting functions is the var/function names themselves. Everything else all comes back to what TMSObjInfo is used.

    That begin said, assuming that marpis' FindObjectsTPA can find the Iron rocks at VEM, which it looks like it should be able to, I don't see a reason why these functions couldn't be used for both Mining and Woodcutting.

    Unless I'm missing something, the only thing that would need to be done is generalize the function and var names. Otherwise, I would basically be writing the same functions, just with different names to put into Mining.scar.

    Please discuss and let me know your feeling's on this.

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Looking at the functions we have in Woodcutting.scar currently, I see no reason why those same functions wouldn't work for Mining.scar.

    The only thing I can see that makes them specifically Woodcutting functions is the var/function names themselves. Everything else all comes back to what TMSObjInfo is used.

    That begin said, assuming that marpis' FindObjectsTPA can find the Iron rocks at VEM, which it looks like it should be able to, I don't see a reason why these functions couldn't be used for both Mining and Woodcutting.

    Unless I'm missing something, the only thing that would need to be done is generalize the function and var names. Otherwise, I would basically be writing the same functions, just with different names to put into Mining.scar.

    Please discuss and let me know your feeling's on this.
    Just waiting for the rock is different, except it's much easier than woodcutting because there is only one ore per rock.

    I was thinking about this today for fishing, I have everything except waiting down, and I don't know how to do it.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by 3Garrett3 View Post
    Just waiting for the rock is different, except it's much easier than woodcutting because there is only one ore per rock.
    But incase someone else get's the ore before you, the rock itself should also be watched, not just the inventory. In which case, I would use the same method marpis used for the woodcutting.

    Although, seeing as the Woodcutting functions don't watch the Inventory I guess this may not work as I had thought. I would still like to hear from others as well though.

    Quote Originally Posted by 3Garrett3 View Post
    I was thinking about this today for fishing, I have everything except waiting down, and I don't know how to do it.
    Do a CountColor of the fishing spot in front of you, then when the color decreases drastically, it is gone.

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    But incase someone else get's the ore before you, the rock itself should also be watched, not just the inventory.
    True, true.

    The function can be relatively the same as the woodcutting one then, is what you're getting at, right?

    I have you on msn but you aren't online. I'd like to chat about the fishing part because it isn't that simple, without threadjacking.

    maniac234 at hotmail

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by 3Garrett3 View Post
    True, true.

    The function can be relatively the same as the woodcutting one then, is what you're getting at, right?
    Yes, it would be basically the same exact thing, just watching the inventory too I guess.

    Quote Originally Posted by 3Garrett3 View Post
    I have you on msn but you aren't online. I'd like to chat about the fishing part because it isn't that simple, without threadjacking.

    maniac234 at hotmail
    Added you.

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

    Default

    Quote Originally Posted by NCDS View Post
    But incase someone else get's the ore before you, the rock itself should also be watched, not just the inventory. In which case, I would use the same method marpis used for the woodcutting.

    Although, seeing as the Woodcutting functions don't watch the Inventory I guess this may not work as I had thought. I would still like to hear from others as well though.
    Pretty sure the WaitWhileChopping function has an inventory check in it as a failsafe incase the player isn't actually cutting, but the script thinks it is (but it's not the primary waiting method). I see no reason why the WaitWhileChopping wouldn't work for mining, but we'd have to test.

    Also, yes, try to avoid duplicating code. If the same functions can be used, then use them.

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Pretty sure the WaitWhileChopping function has an inventory check in it as a failsafe incase the player isn't actually cutting, but the script thinks it is (but it's not the primary waiting method). I see no reason why the WaitWhileChopping wouldn't work for mining, but we'd have to test.

    Also, yes, try to avoid duplicating code. If the same functions can be used, then use them.
    Sounds good.

    As far as the name of the function and the var names go...what am I to do about that? As well as placement of the functions that will be used for both?

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

    Default

    Quote Originally Posted by NCDS View Post
    Sounds good.

    As far as the name of the function and the var names go...what am I to do about that? As well as placement of the functions that will be used for both?
    MSI_WaitWhileMinecutting; MSI_AutoTrock, MSI_TrineInvFull.

    No, but seriously I don't now. The file could be renamed to Woodcutting_Mining.scar I guess. Or, if these functions can't be used for several skills, we could just use the Skills.scar file and get rid of /Skills/Woodcutting.scar altogether.

  9. #9
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Sounds good.

    As far as the name of the function and the var names go...what am I to do about that? As well as placement of the functions that will be used for both?
    could we use something like pointers?

    SCAR Code:
    WaitStyle[X] := @WaitWhileTask;

    alternatively we could complicate it by adding

    a) More Constants/Variables
    b) More Parameters to the function

    or instead of bunging up the include and making things hard to read we can make a specialized WaitWhileMining() which in my opinion is the smartest way to go seeing as our goal with MSI was making this easily communicative and readable. Recycling functions starts to add confusion.

    even if we went

    SCAR Code:
    function WaitWhileMining(Parameters): Boolean;
    begin
      WaitWhileChopping();
    end;

    that would be more readable imo.
    “Ignorance, the root and the stem of every evil.”

  10. #10
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    MSI_WaitWhileMinecutting; MSI_AutoTrock, MSI_TrineInvFull.

    No, but seriously I don't now. The file could be renamed to Woodcutting_Mining.scar I guess. Or, if these functions can't be used for several skills, we could just use the Skills.scar file and get rid of /Skills/Woodcutting.scar altogether.

    Do you mean can? Cause that's kinda what I was thinking at first since the original Skills.scar is empty still.

    Quote Originally Posted by Blumblebee View Post
    even if we went

    SCAR Code:
    function WaitWhileMining(Parameters): Boolean;
    begin
      WaitWhileChopping();
    end;

    that would be more readable imo.
    That's not a bad idea if we can't think of a way to name them together or anything. I may actually like that better anyways, just for clarity.

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

    Default

    Quote Originally Posted by NCDS View Post

    Do you mean can? Cause that's kinda what I was thinking at first since the original Skills.scar is empty still.
    Lol, wow what's that? The 100th time you've corrected me?

    Quote Originally Posted by NCDS View Post
    That's not a bad idea if we can't think of a way to name them together or anything. I may actually like that better anyways, just for clarity.
    I actually don't mind that either.

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

    Default

    The easiest and simplest thing is just to write own functions for Mining.
    1. WaitWhileChopping and WaitWhileMining will have different color checks.
    2. Avoiding stupid and hard to understand function names, such as "AutoObjInvFull(..)"
    3. In Mining we could have it hover the next rock already while mining? In Woodcutting that's not necessary.
    4. Makes things easier for people trying to study Mining.simba/Woodcutting.simba

  13. #13
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Lol, wow what's that? The 100th time you've corrected me?


    I actually don't mind that either.
    You work hard though, no worries

    Quote Originally Posted by marpis View Post
    The easiest and simplest thing is just to write own functions for Mining.
    1. WaitWhileChopping and WaitWhileMining will have different color checks.
    2. Avoiding stupid and hard to understand function names, such as "AutoObjInvFull(..)"
    3. In Mining we could have it hover the next rock already while mining? In Woodcutting that's not necessary.
    4. Makes things easier for people trying to study Mining.simba/Woodcutting.simba
    I can do that without a problem, it's just that Mining.simba will basically be a copy of Woodcutting.simba.

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

    Default

    Quote Originally Posted by NCDS View Post
    I can do that without a problem, it's just that Mining.simba will basically be a copy of Woodcutting.simba.
    Rather that than a massive confusion. I'll have a look later and see what I can come up with as well.

    ~RM

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

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

    Default

    So, why is there a whole new finder system for rocks?

  16. #16
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    So, why is there a whole new finder system for rocks?
    Accuracy and ease of use.

    By MSI_FindRock returning a Boolean and a T2DArray, it can be used in multiple way's.

    The finding work's excellent, have you tried it?

    I still have a bit of editing to do with WaitWhileMining; I want to add in a Text check as well as make the InvCount check more reliable.
    Last edited by NCDS; 07-15-2010 at 07:40 PM.

  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 NCDS View Post
    By MSI_FindRock returning a Boolean and a T2DArray, it can be used in multiple way's.
    Shouldn't it be able to work the same way ChopTree does?

  18. #18
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Shouldn't it be able to work the same way ChopTree does?
    MineRock does operate very similar to ChopTree. MSI_FindRock is really the only difference.

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

    Default

    Quote Originally Posted by NCDS View Post
    MineRock does operate very similar to ChopTree. MSI_FindRock is really the only difference.
    But I mean the whole system. You may have told me this, but does it not work by just doing some thing like:
    SCAR Code:
    MSI_FindObjects(Objects, ...);
    Or is it not accurate enough?

  20. #20
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I don't think I ever tried.

    After all the threads I was under the impression that there would be separate functions for the mining.

    FindRock is also easier to work with due to the T2DArray it returns.

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

    Default

    I was relooking through it... And I couldn't find any reason as to why you would need a T2DArray.

    MineRock does Middle TPA - therefore no need for 2D
    WaitWhileMining has a small search box and doesn't really take into account the fact that it's a T2D array. And if you had a TPA with a length > 1 from FindObjs you would know you have several objects around you.

    I say it should be reverted to FindObjs, as I see no reason for having a separate function.

    As for accuracy, things can be added and manipulated inside FindObj

    ~RM

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

  22. #22
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    I was relooking through it... And I couldn't find any reason as to why you would need a T2DArray.

    MineRock does Middle TPA - therefore no need for 2D
    WaitWhileMining has a small search box and doesn't really take into account the fact that it's a T2D array. And if you had a TPA with a length > 1 from FindObjs you would know you have several objects around you.

    I say it should be reverted to FindObjs, as I see no reason for having a separate function.

    As for accuracy, things can be added and manipulated inside FindObj

    ~RM
    That's so boring

    I'll change it though that's not a problem

    I'm going to try and take a nap for a little while, and I'm leaving later this afternoon for the weekend, but I'll try and get this done before I go.

    Edit: I've started but I'm about out of time. I'll have it committed on Monday.
    Last edited by NCDS; 07-16-2010 at 06:12 PM.

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

    Default

    Okay, let's try to straighten out this confusion (NCDS and I were talking, and we're both confused). Basically what I've gathered from this thread is that we've accomplished nothing. It was suggested to use wrapper functions for Mining.scar.
    SCAR Code:
    function MSI_WaitWhileMining(): Boolean;
    begin
      Result := MSI_WaitWhileChopping();
    end;
    It was also suggested that we create separate functions for Mining.scar to make them more customizable for that skill (which is what we currently have). Then once this was done, it was suggested to revert back to using MSI's object finding.

    Now, when marpis suggested writing separate functions for Mining.scar, I don't know if he meant whole new object finding functions as well (currently MSI_FindRock). The thing is, if we were to write whole new functions, MSI_MineRock and MSI_MineInvFull would be identical to MSI_ChopTree and MSI_ChopInvFull. MSI_WaitWhileMining may be slightly different, but 90% of it would be the same.

    I would like to get this all straightened out so we (NCDS, mainly) don't waste anymore of our time on something that may get completely rewritten the next day.

    My suggestion
    If MSI_ChopTree and MSI_ChopInvFull work well for mining, we should use them. I still don't mind the wrapper function idea. I do think we should write another WaitWhileMining because there are a few new things that can be added that apply only to mining.

    Now, let's get this sorted out.

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

    Default

    If they are the same, wrap them.

    If they differ anywhere, then keep them separate.

    What I think will come out at the end (further on, with more skills added) is we'll find we can just group some of them together and make a generalized function.

    ~RM

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

  25. #25
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Well here is what I have right now:
    SCAR Code:
    {==============================================================================\
    |                         MSI Group Scripting Include                          |
    |                              Mining.scar                                     |
    |==============================================================================|
    | For all mining routines.                                                     |
    |                                                                              |
    | * procedure MSI_WaitWhileMining();                * by NCDS                  |
    | * function MSI_MineRock();                        * by NCDS                  |
    | * function MSI_MineInvFull();                     * by NCDS & marpis         |
    \ _____________________________________________________________________________}


    {******************************************************************************}
    { Procedure MSI_WaitWhileMining(RockInfo: TMSObject);                          }
    { By: NCDS                                                                     }
    { Date: 11 July 2010                                                           }
    { Description: Wait's until an Ore has been mined.                             }
    {******************************************************************************}
    Procedure MSI_WaitWhileMining(RockInfo: TMSObject);
    var
      cts, OldInvCount, t, i, RockColorCount: Integer;
      MDAr: T2DPointArray;
      Arr: array of TPoint;
      SearchBox: TBox;
    begin
      Flag;
      Wait(RandomRange(285, 450));

      if InvFull then
        Exit;

      cts := GetColorToleranceSpeed;
      SetToleranceSpeed2Modifiers(RockInfo.Hue, RockInfo.Sat);

      t := GetSystemTime + 60000;

      SearchBox := IntToBox(
                           MSCx - Round(RockInfo.W * 1.50),
                           MSCy - Round(RockInfo.H * 1.50),
                           MSCx + Round(RockInfo.W * 1.50),
                           MSCy + Round(RockInfo.H * 1.50));

      OldInvCount := InvCount;

      repeat
        for i := 0 to High(RockInfo.Colors) do
        begin
          FindColorsTolerance(MDAr[i], RockInfo.Colors[i], SearchBox.x1,
                               SearchBox.y1, SearchBox.x2, SearchBox.y2, RockInfo.Tol);
          if (Length(MDAr[i]) > RockInfo.Accuracy) then
            Arr := CombineTPA(MDAr[i], Arr);
        end;

        if Length(Arr) < 1 then
          Break;

        RockColorCount := Length(Arr);

        if (Length(Arr) < Round(RockColorCount * 0.50)) then
          Break;

        MSI_FindRandoms;
        MSI_AntiBan(RandomRange(0, 3000), ANTI_BAN_CHANCE);

        if (OldInvCount < InvCount) then
          Break;

        Wait(RandomRange(200, 500));

      until(t > GetSystemTime) or (Length(Arr) < Round(RockColorCount * 0.50));

      SetColorToleranceSpeed(cts);
    end;

    {******************************************************************************}
    { function MSI_MineRock(Which: TIntegerArray): Boolean;                        }
    { By: NCDS                                                                     }
    { Date: 11 July 2010                                                           }
    { Description: Mines Rock                                                      }
    {******************************************************************************}
    function MSI_MineRock(Which: TIntegerArray): Boolean;
    var
      Rocks: TMSObjectArray;
      SearchBox: TBox;
      Index: Integer;
    begin
      Rocks := MSI_GetObjects(Which);
      SearchBox := IntToBox(MSx1, MSy1, MSx2, MSy2);

      if MSI_FindObjectsIn(Rocks, Index, SearchBox, ClickLeft) then
      begin
        Result := True;
        MSI_WaitWhileMining(Rocks[Index]);
      end;
    end;  

    {******************************************************************************}
    { function MSI_MineInvFull(Which: TIntegerArray): Boolean;                     }
    { By: NCDS & mapris                                                            }
    { Date: 11 July 2010                                                           }
    { Description: Mines Rock's until Inventory is full.                           }
    {******************************************************************************}
    function MSI_MineInvFull(Which: TIntegerArray): Boolean;
    var
      t: Integer;
    begin
      t := (GetSystemTime + (5 * 60000));
      while (not(InvFull)) and LoggedIn and (GetSystemTime < t) do
      begin
        if MSI_MineRock(Which) then
          t := (GetSystemTime + (5000 * 60000));
        Wait(RandomRange(300, 600));
      end;
      Result := InvFull;
    end;

    I keep getting an Invalid Number of parameters error on line 78, which is one of the function headers...not sur what's up with that.

    I'll keep messing with it though.

    Also, if that's not what you meant tell me and I'll change it to whatever.
    Last edited by NCDS; 07-19-2010 at 11:29 AM.

+ Reply to Thread
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)

Tags for this Thread

Posting Permissions

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