What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Cannot run Tick before running Start first!

Vastico

New Member
Joined
Jul 28, 2011
Messages
424
Reaction score
10
Code:
[23:19:15:462] System.ApplicationException: Cannot run Tick before running Start first!
   at TreeSharp.Composite.Tick(Object context)
   at Styx.Logic.BehaviorTree.TreeRoot.Tick()
[23:19:15:462] Cleared POI - Reason Exception in Root.Tick()
[23:19:15:462] Cleared POI
[23:19:15:667] System.ApplicationException: Cannot run Tick before running Start first!
   at TreeSharp.Composite.Tick(Object context)
   at Styx.Logic.BehaviorTree.TreeRoot.Tick()

Can someone please asisst me in fixing this I am making my own Bot to just stand around the AH looking for good deals after it looks in AH but I cannot get it to even start as this is thrown
 
Code:
[23:19:15:462] System.ApplicationException: Cannot run Tick before running Start first!
   at TreeSharp.Composite.Tick(Object context)
   at Styx.Logic.BehaviorTree.TreeRoot.Tick()
[23:19:15:462] Cleared POI - Reason Exception in Root.Tick()
[23:19:15:462] Cleared POI
[23:19:15:667] System.ApplicationException: Cannot run Tick before running Start first!
   at TreeSharp.Composite.Tick(Object context)
   at Styx.Logic.BehaviorTree.TreeRoot.Tick()

Can someone please asisst me in fixing this I am making my own Bot to just stand around the AH looking for good deals after it looks in AH but I cannot get it to even start as this is thrown


The only time I've seen an error like that... was my first attempt at writing my own behavior tree-walker using the TreeSharp primitives.

Before you can call Tick(), Start() must be called exactly once for the (sub)tree. Once you obtain a final result (Success, or Failure--not Running) from the (sub)Tree, you need to call Stop() exactly once. These are entry criteria enforced by the TreeSharp nodes themselves.

My final tree-walker looked like the following:
Code:
        // Visit the next node in the tree--we may not get a final result.
        public void     VisitNextNode(object context)
        {
            // If the node is not running...
            // It means we either: 1) have never run the node before., or 2) obtained
            // a 'final' result from the previous iteration.
            // Either way, we need to start or restart the tree, respectively..
            if (!IsResultRunning(_rootNode.LastStatus))
                { _rootNode.Start(context); }

            // Tick the node...
            // If it returns a final result, we need to stop the tree (we're done).
            if (!IsResultRunning(_rootNode.Tick(context)))
                { _rootNode.Stop(context); }
        }

        // Walk the tree until we achieve a final result
        public void     WalkUntilFinal(object context)
        {
            while (!IsResultFinal(_rootNode.LastStatus))
                { VisitNextNode(context); }
        }

        // Returns 'true' when result is final (i.e., RunStatus.Success, or RunStatus.Failure).
        private bool    IsResultFinal(RunStatus?    runStatus)
        {
            return ((runStatus == RunStatus.Success)
                    || (runStatus == RunStatus.Failure));
        }

        // Returns 'true', if the result indicates the node is still running.
        private bool    IsResultRunning(RunStatus?   runStatus)
        {
            return (runStatus == RunStatus.Running);
        }
As with all my contributions, you're welcome to use it under the constraints of the CC-BY-NC-SA license, if you need.

If this isn't your problem, you'll need to provide more context as to what your doing, and what your code looks like.


cheers,
chinajade
 
Last edited:
Sorry you've just confused me more XD here's my code from file:

Code:
#region Declarations

        public static LocalPlayer Me { get { return StyxWoW.Me; } }

        #endregion

        #region Inherited Abstracted Methods

        public override string Name
        {
            get { return "AuctionBuddy"; }
        }

        public override PulseFlags PulseFlags
        {
            get { return PulseFlags.All; }
        }

        public override TreeSharp.Composite Root
        {
            get 
            { 
                return new PrioritySelector(
                    CreateQueueBehavior()
                ); 
            }
        }

        #endregion

        #region Overriden Methods

        public override void Initialize()
        {
            Log("Starting Auction Buddy!");
            Styx.Logic.Profiles.ProfileManager.LoadEmpty();
            Log("Blank profile loaded!");
            base.Initialize();
        }

        public override void Start()
        {
        }

        public override void Stop()
        {
        }

        #endregion
 
Will someone please help, I can't seem to work out why it's doing it
 
Never mind fixed, the issues was that I wasn't caching the Root Composite, you need to do that.

e.g.

return _root ?? (_root = Composite());
 
Back
Top