Hey. Im new here and trying to add a few features to Sanderling.ABot 17.05.03 like a delay after retreat task.
I think my C# lvl not enough because in my attempts bot goes to infinit loop (delay is infinity) or its ignores delay at all.
Can somebody give me hints?
Thanks.
Welcome @TheChosenOne!
I have an idea of how the delay after retreat could be implemented:
- In each bot step, after the task tree has been computed, test if the task tree contains an instance of the retreat task, and then memorize this with the current time.
- Add a new Task
DelayAfterRetreat
and insert beginning of the sequence of tasks to expand in root. - The
DelayAfterRetreat
Task computes how long ago the last retreat was, using the info memorized as described above. If that timespan is below your threshold, it emits a signal to not continue with following tasks in the tree.
What do you think about it?
@Viir Yes, i was thinking about exact that way, but was busy for last few days and i expect to work on it in New Year holidays. Thanks for the answer.
I thinking about too i meaned a random delay after max(lastchatisclean, startretreat). Thanks for the coding concept Viir !
I’m not testing if retreat occured, but when retreat is called I simply set helper variable with current time.
I’m doing it like this
xy = random(2,15) -- randomize interval in minutes
Release = RememberedTime + xy;
if(Release > datetime.now)
yield break;
syntax is indeed just for demonstration