Results 1 to 9 of 9

Thread: How can I detect that an action has finished?

  1. #1
    Join Date
    Apr 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default How can I detect that an action has finished?

    Hey everyone, I've been trying to write my first script, and needless to say it is HARD. I've come up against a wall in trying to detect whether the character has completed an action - how can I do this? The script I am working on is to cut trees, then burn them, but I'm having trouble getting the bot to not take action until the tree has been cut down. My idea was to get this working by repeating a wait command until the tree has been cut down, but how can I detect this?

  2. #2
    Join Date
    Jan 2013
    Posts
    294
    Mentioned
    1 Post(s)
    Quoted
    121 Post(s)

    Default

    Quote Originally Posted by maky369 View Post
    Hey everyone, I've been trying to write my first script, and needless to say it is HARD. I've come up against a wall in trying to detect whether the character has completed an action - how can I do this? The script I am working on is to cut trees, then burn them, but I'm having trouble getting the bot to not take action until the tree has been cut down. My idea was to get this working by repeating a wait command until the tree has been cut down, but how can I detect this?
    use ismoving.

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    You mean like to see if it stopped cutting?

    http://villavu.com/forum/showthread.php?t=74090

    or you can use invcount

    Pixel shift function:

    Simba Code:
    Function IsCutting: Boolean;
    begin
      var
        PBox: TBox;
      begin
        PBox := IntToBox(245, 130, 285, 195);
        Result := (AveragePixelShift(PBox, 250, 500) > 400);
      end;
    end;

    Simba Code:
    PBox := IntToBox(245, 130, 285, 195);

    Is were it is looking for moving pixels

    Simba Code:
    Result := (AveragePixelShift(PBox, 250, 500) > 400);

    This:

    Simba Code:
    (PBox, 250, 500) > 400);
    means it returns true if there are more then 400 pixels moving in that area.

    so to detect when you could stop chopping you could do something like

    Simba Code:
    while IsCutting do
    wait(100)

  4. #4
    Join Date
    Jan 2013
    Posts
    294
    Mentioned
    1 Post(s)
    Quoted
    121 Post(s)

    Default

    Quote Originally Posted by RJJ95 View Post
    You mean like to see if it stopped cutting?

    http://villavu.com/forum/showthread.php?t=74090
    that is more accurate but ismoving function is enough for this case.

  5. #5
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by dzpliu View Post
    use ismoving.
    IsMoving refers to the player walking as it monitors pixelshift in the minimap. Needless to say this won't do you any good for player animating.

    As RJJ95 said above me you could detect your player animating through pixelshift. You can also watch your inventory for either a change in item count or a change in log count directly.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  6. #6
    Join Date
    Jan 2013
    Posts
    294
    Mentioned
    1 Post(s)
    Quoted
    121 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    IsMoving refers to the player walking as it monitors pixelshift in the minimap. Needless to say this won't do you any good for player animating.

    As RJJ95 said above me you could detect your player animating through pixelshift. You can also watch your inventory for either a change in item count or a change in log count directly.
    oh i forgot...haha...cos in my script i declared ismoving to pixelshifts near my char body..my bad

  7. #7
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    Pixelshift is best for you..

  8. #8
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    You can also look in the chatbox for a message to say you chopped the tree. Another way is looking for the stump color, and when you find it in the place you were chopping that means the tree is gone.

  9. #9
    Join Date
    Apr 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Cool, thanks for the help everyone.

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
  •