Results 1 to 16 of 16

Thread: SRL Function Help

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default SRL Function Help

    I need to take a survey to get this waiting procedure right.

    I need people to post the average time they wait until they get a log from a tree. Preferably every tree.

    Ex.
    Chop tree. //Mark your time from here
    Wait //seconds
    Get log// End your time here and post

    Template=

    Tree:
    Time:
    Axe:
    Level:

    Rewards available.
    Rep

  2. #2
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    i := InvCount;
    Marktime(ii);
    while (InvCount = i) do
    begin
      Wait(50);
      if (TimeFromMark(ii) > 45000) then
      begin
        WriteLn('Oh shit somethings wrong..');
        Break;
      end;
      //Checking if cutting stopped.
    end;
    That's what I would do.
    or something more like..
    SCAR Code:
    function GimmeaLog: Boolean;
    var
      i, ii: Integer;
    begin
      i := InvCount;
      Marktime(ii);
      while (InvCount = i) do
      begin
        Wait(50);
        if (TimeFromMark(ii) > 45000) then
        begin
          WriteLn('Oh shit somethings wrong..');
          Exit;
        end;
      //if (not CuttingTree) then
      //begin
      //  WriteLn('Not cutting?! D:');
      //  Exit;
      //end;
      end;
      Result := True;
    end;

  3. #3
    Join Date
    Nov 2009
    Location
    Seattle, WA
    Posts
    589
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    :O sorry for me like suggesting, ill help out with this, but did you try to do an InvCheck? Something like this to detect if something has appeared in the Inventory.

    I got Ninjad.
    Don't Troll, Don't Fight, Just keep the Respect
    Status : Offline

    Feel free to re-make my scripts ;D
    Community Member

  4. #4
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's a brand new function I'm making for trees that give you multiple logs. It somewhat has something to do with InvCount.

  5. #5
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Tree: Willow
    Time: 4 sec ?
    Axe: Rune
    Level: 65

    The answers you get for htis survey will not be accurate because noby really times this kinda stuff... We just let the computer do its thing >.<.

    If you really need information on Time get log/ axe/tree. Why not make counters, and marktime in a WC script and leave it on for a few hours, and find the average of the numbers? Wayy more accurate than us telling you the time.

    The axe, is 95% + rune.

    Only thing I find worthwhile is checking botter;s lvs atm .

  6. #6
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    A better way (for trees like willows and oaks) would be:
    When you chop the tree you set a mark and do a repeat check to check the inventory and when a new log appears increment the amount of logs the tree gave/total chopped and then also do a ismoving check and when you aren't moving then you aren't chopping. You could also check for differences in a TBox around your player. I haven't scripted in a long time but I might get back into it..
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

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

    Default

    I need people to post the average time they wait until they get a log from a tree. Preferably every tree.
    (You know that inst the same as time to cut a tree (unless you are doing regular trees) because each tree gets multiple logs).

    So, anyways, here is a messy example!

    SCAR Code:
    Program ISuckAtScrupting;

    CutTimesArray:TIntegerArray;
    TotalCutTime:Integer;

    Procedure AddTime(WatTime:Integer);
    Begin
      SetArrayLength(CutTimesArray,GetArrayLength(CutTimesArray)+1);// Makes array one number longer
      CutTimesArray[GetArrayLength(Slot)-1]:=WatTime;// Adds integer 'WatTime' to end of array
    End;

    Procedure Cutsor;
    var OldInvCount,TreeCuts:Integer;
    Begin
      ClickTree;               //Clicks The Tree
      Begin
        OldInvCount:=InvCount; //Gets Invnetory Count
        MarkTime(TreeCuts);    //Makrs Time
        Antiban; AniRandoms;   //Antiban/AntiRandoms
        If InvCount>OldInvCount Then   //If inventory count has risen since tree clicked
        Begin
          AddTime(TimeFromMark(TreesCut));  //Add the time from marker to the array of times
          ClickAnotherTree; //If you want to cut another tree right after you get logs?
        End;
      End;
    End;

    Function AverageTimes:Integer;
    Begin
      TotalCutTime:=0;                            //Resets total time
      For I:=0 To GetArrayLength(CutTimesArray) Do //Goes from 0 to Legnth of CutTimesArray
      Begin
        TotalCutTime:=TotalCutTime + CutTimesArray[I]; //Adds up all of the cut times
        Result:= (TotalCutTime/ (GerArrayLength(CutTimesArray)); //Averanges the cut times
      End;
    End;

    DOH! Just found This:

    Function AverageCutTime:Integer;
    Begin
      Result:= AverageTIA(CutTimesArray);//Averages a TIntegerArray -.-
    End;

    Ask any questions, I hope I did it correctly!

  8. #8
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I would like to know Tboxes. Any place where i can learn them? Link PLOX? Much easier then my technique because my bro uses Tboxes to see if the tree is cut or not.

  9. #9
    Join Date
    Nov 2009
    Location
    Seattle, WA
    Posts
    589
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Why not make the character click the tree, while its animating the chop wait/w/e, and then when its done then try to chop again?
    Don't Troll, Don't Fight, Just keep the Respect
    Status : Offline

    Feel free to re-make my scripts ;D
    Community Member

  10. #10
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    TBoxes are types that contain 4 integers.
    x1, y1 : the top left corner
    x2, y2 : the bottom right corner
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  11. #11
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    TBoxes are types that contain 4 integers.
    x1, y1 : the top left corner
    x2, y2 : the bottom right corner
    Ok, where do i use these, what function, and what parameters?

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

    Default

    Lol, totally changed the topic Junkj....
    Did you look at my code?
    Well what exactly do you wan to do with tboxes? Check to see if a tree is cut?

    Procedure MakeABox;
    var MahBox:TBox;
    Begin
    MahBox:=IntToBox(563, 213, 594, 244);
    End;

    You would just need to somehow find the x1,y1,x2,y2 of the specific tree you are cutting, and put those cords into IntToBox.

    If you are using TPAs this will make a box based on the tpa
    function GetTPABounds(TPA: TPointArray): TBox;
    Returns a TBox with the boundries of TPA.

    And this tutorial will help with more TPA stuffs, its really good!
    http://www.villavu.com/forum/showthread.php?t=49067

    That's just some random info about stuff, hope it helped some.

    Why not just make another topic related to your Tbox questions?

  13. #13
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Lol, totally changed the topic Junkj....
    Did you look at my code?
    Well what exactly do you wan to do with tboxes? Check to see if a tree is cut?

    Procedure MakeABox;
    var MahBox:TBox;
    Begin
    MahBox:=IntToBox(563, 213, 594, 244);
    End;

    You would just need to somehow find the x1,y1,x2,y2 of the specific tree you are cutting, and put those cords into IntToBox.

    If you are using TPAs this will make a box based on the tpa
    function GetTPABounds(TPA: TPointArray): TBox;
    Returns a TBox with the boundries of TPA.

    And this tutorial will help with more TPA stuffs, its really good!
    http://www.villavu.com/forum/showthread.php?t=49067

    That's just some random info about stuff, hope it helped some.

    Why not just make another topic related to your Tbox questions?
    SCAR Code:
    Procedure MakeABox;
    var MahBox:TBox;
    Begin
      MahBox:=IntToBox(563, 213, 594, 244);
    End;
    Useless..? You assign the box to a local variable so it is discarded since the procedure ends right after assigning it.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

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

    Default

    -.- It was just an example, he can make the variable global if he wants.

  15. #15
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok.. So what parameters would i set so it would be in the middle of the screen? And what function/code would i use to detect if the tree is down? PixelShift?

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

    Default

    What do you mean it?
    If you want to guesstimate where a tree is you could do like (MSCX-40,MSCY-40,MSCX+40,MSCY+40), but trees aren't really on the middle of the screen, your character is on the middle, the tree is up/down/left/right from you. Why not looking at coh3ns? two woddcutting scripts, they are really good and I believe he has functions like that. Also, make another topic specifically for this question please?

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
  •