Results 1 to 7 of 7

Thread: Quick question

  1. #1
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Quick question

    Well I'm working on a script, it has been a while since I've last scripted, and I just wanted to run something by you (you being anyone). I am trying to figure out a way to detect if the character is animating (chopping the tree). This is what I am using atm, it works pretty well, however sometimes it says that the character is not animating, and searches for a tree to chop again. It also has a failsafe that if it still is moving after a minute, it will break from the loop (i dont know how that could be a problem, but ya never know )
    SCAR Code:
    Repeat
      //Stuff to find tree
      //Stuff to click tree
      Repeat
        //Stuff to do while chopping
        MarkTime(TreeTime);
        //More stuff to do while chopping
      Until((Not(Animating(IntToBox(MSCX-30, MSCY-100, MSCX+30, MSCY+100), 500, 440))) or (TimeFromMark(TreeTime) > 60000));
    Until(InvFull Or Not LoggedIn);
    Any suggestions for better tactics? Or do you think it is fine. The way my script searches for a tree is the one closest to your character, so if it does, it clicks the tree I'm chopping (usually), which some people do whilst woodcutting when they get bored/impatient, ergo it's not that big of a deal. But still, opinions?
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

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

    Default

    Quote Originally Posted by bionicle1800 View Post
    Well I'm working on a script, it has been a while since I've last scripted, and I just wanted to run something by you (you being anyone). I am trying to figure out a way to detect if the character is animating (chopping the tree). This is what I am using atm, it works pretty well, however sometimes it says that the character is not animating, and searches for a tree to chop again. It also has a failsafe that if it still is moving after a minute, it will break from the loop (i dont know how that could be a problem, but ya never know )
    SCAR Code:
    Repeat
      //Stuff to find tree
      //Stuff to click tree
      Repeat
        //Stuff to do while chopping
        MarkTime(TreeTime);
        //More stuff to do while chopping
      Until((Not(Animating(IntToBox(MSCX-30, MSCY-100, MSCX+30, MSCY+100), 500, 440))) or (TimeFromMark(TreeTime) > 60000));
    Until(InvFull Or Not LoggedIn);
    Any suggestions for better tactics? Or do you think it is fine. The way my script searches for a tree is the one closest to your character, so if it does, it clicks the tree I'm chopping (usually), which some people do whilst woodcutting when they get bored/impatient, ergo it's not that big of a deal. But still, opinions?
    It's fine. I use the same thing, and most of the time it works. If you use pixelshift, make sure the pixel count is large enough so when the tree is cut it will only pick up the tree and not other player's chopping animation. You should take a look at Animation.Scar, if you haven't.

  3. #3
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Junkj View Post
    It's fine. I use the same thing, and most of the time it works. If you use pixelshift, make sure the pixel count is large enough so when the tree is cut it will only pick up the tree and not other player's chopping animation. You should take a look at Animation.Scar, if you haven't.
    ...That is where i found the function I'm using...

    If you notice it is MSCX-30, MSCY-100, MSCX+30, MSCY+100, that is a box surrounding the character, not the tree. The tree is not a box with the exact center of the box the exact center of the main screen. The function that I am using uses pixel shift, so if I had the box around the tree, if the tree is gone, or if it is there, there is no pixels moving either way. If I was using this for a tree, it would be worthless as it would return false each time no matter what. This looks at the character to see if the character is chopping.
    Last edited by Bionicle; 01-26-2010 at 09:15 PM.
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

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

    Default

    I usually just make a 10 by 10 box around the pixel i clicked on the tree, get the color of the pixel and then continually search for it in the box, have a timeout if nothing is added to the inventory etc.

    something such as this:

    SCAR Code:
    Function FollowPixelBox(Point: TPoint): Boolean;
    var
      i: LongInt;
      col, tempCount: Integer;
      x, y: Integer;
    begin
      Col := GetColor(Point.x, Point.y);
      WriteLn('Tree Color = '+IntToStr(Col));
      i := GetSystemTime;
      tempCount := InvCount;
      while FindColorTolerance(x, y, Col, Point.x-10, Point.y-10, Point.x+10, Point.y+10, 15) do
      begin
        FindNormalRandoms;
        Wait(150+random(100));
        if (GetSystemTime-i > RandomRange(25000, 50000)) then
          Break;
        if InvFull then Break;
        if InvCount <> TempCount then
        begin
          i := Getsystemtime;
          tempCount := InvCount;
        end;
      end;
      Result := True;
    end;

    when the color is gone, the tree is gone
    “Ignorance, the root and the stem of every evil.”

  5. #5
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    I usually just make a 10 by 10 box around the pixel i clicked on the tree, get the color of the pixel and then continually search for it in the box, have a timeout if nothing is added to the inventory etc.

    something such as this:

    SCAR Code:
    Function FollowPixelBox(Point: TPoint): Boolean;
    var
      i: LongInt;
      col, tempCount: Integer;
      x, y: Integer;
    begin
      Col := GetColor(Point.x, Point.y);
      WriteLn('Tree Color = '+IntToStr(Col));
      i := GetSystemTime;
      tempCount := InvCount;
      while FindColorTolerance(x, y, Col, Point.x-10, Point.y-10, Point.x+10, Point.y+10, 15) do
      begin
        FindNormalRandoms;
        Wait(150+random(100));
        if (GetSystemTime-i > RandomRange(25000, 50000)) then
          Break;
        if InvFull then Break;
        if InvCount <> TempCount then
        begin
          i := Getsystemtime;
          tempCount := InvCount;
        end;
      end;
      Result := True;
    end;

    when the color is gone, the tree is gone
    Hmm, that looks pretty sweet, i could probably create something along the lines of that, and use it with my method too to make it extremely reliable.
    Could I have your permission to use your method since you gave me the idea? (I wouldn't copy your function tho, id make my own) I would credit
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

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

    Default

    be my guest. If your writing your own version of it I don't expect credits or anything, just glad it helps.
    “Ignorance, the root and the stem of every evil.”

  7. #7
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    be my guest. If your writing your own version of it I don't expect credits or anything, just glad it helps.
    Well I'll at least put a thanks I'm trying to stay away from using anyone else stuff, as it doesn't feel right to me for some reason.
    Thanks
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

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
  •