1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved How to properly execute specific string of tasks in treebot

Discussion in 'Developer Support' started by CuppaJava, May 12, 2018.

  1. CuppaJava

    CuppaJava cuppa.drink(java);

    Joined:
    Mar 13, 2018
    Messages:
    6,114
    Likes Received:
    1,371
    This is a pretty basic question, but still new to bot structure so forgive me.

    I understand the basic structure of a treebot (it's a tree), and the concept to only execute one action per bot iteration. This raises the question though of how to properly perform a string of tasks when a condition is met. Something to do with states?

    For example, if I made a simple tree bot to pick up bones until I have a full inv and then bury them all, I'd imagine a simplified tree structure to be:

    full inv?
    • T: bury bones branch (all bones at once)
    • F: find bone nearby branch (eg. find bone, if found pick it up if not walk around, etc)
    The problem I see here is that if I follow the concept of doing one action per iteration, the steps would look like:

    1. full inv? true -> bury one bone -> success
    2. full inv? false (we're at 27) -> pick up a bone
    3. full inv? true -> bury one bone -> success
    4. repeat forever alternating between 27 and 28 bones

    There's definitely a problem with my logic here but I'm not sure what the logic should look like.
     
  2. Best Answer:
    Post #2 by Savior, May 12, 2018
  3. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Precisely. Once the inventory is full, set a flag (a boolean in this case) in order to memorize that the bot should be dropping. Once the inventory is empty, the flag can be changed again to signify that it should continue looting.
     
  4. CuppaJava

    CuppaJava cuppa.drink(java);

    Joined:
    Mar 13, 2018
    Messages:
    6,114
    Likes Received:
    1,371
    That was essentially my assumption, I just wanted to clarify if there was a more "proper" way of implementing it in the API. But fair enough, thanks for the answer :)
     

Share This Page

Loading...