Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved How to properly execute specific string of tasks in treebot

cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,745
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.
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Something to do with states?
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.
 
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,745
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.
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 :)
 
Top