• Visit Rebornbuddy
  • Try/Catch for Behavior Tree

    Discussion in 'Archives' started by tjhasty, Feb 4, 2011.

    1. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      I know how to use the try and catch for c# to help handle errors, but if there something similiar to this for the behavior tree. The problem I am having is the botbase I am working on watches party members, and arguments like StyxWoW.Me.PartyMember1.Combat upchucks as soon as PM1 is out of range of detection, and will not fix itself untill you restart HB totally. Is there some way to prevent the up-chuck-ed-ness?
       
    2. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      nobody?
       
    3. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      not a single person?
       
    4. Thacai

      Thacai Member

      Joined:
      Jan 15, 2010
      Messages:
      71
      Likes Received:
      0
      Trophy Points:
      6
      Maybe you could do this instead new DecoratorContinue(ret => StyxWoW.Me.PartyMember1 != null, new Decorator(ret => StyxWoW.Me.PartyMember1.Combat...etc just an idea, i havnt worked my way around partymembers
       
    5. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      I have tried that, the problem is PM1 exists, but is not close enough to be able to tell the status of them. so what you put above comes back true because pm1 is not null, but thats all HB can tell. Flippen annoying.
       
    6. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      I have tried != null, isvalid, and everything else I can find along those lines, nothing. and it errors out when I try to use the try/catch thing because of the way behavior trees work. Blargh!
       
    7. Apoc

      Apoc Moderator Staff Member Moderator

      Joined:
      Jan 16, 2010
      Messages:
      2,790
      Likes Received:
      94
      Trophy Points:
      48
      Default decorators just take delegates as their params for ctors. The syntax you're using is called a "lambda". It's just a shortcut for an anon delegate. Create one yourself with full error handling.

      Code:
      new Decorator(delegate(object context){ try { return Me.Blah.Blah; } catch { return false; } }, new Action(ret=>DoSomething()))
       
    8. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      I appreciate the help Apoc. Ill give that a shot. Im still learning this as I go. I got a pretty good handle on the C# thing (As far as HB is concerned), but I got a lot to learn about behavior trees.
       
    9. tjhasty

      tjhasty Member

      Joined:
      May 16, 2010
      Messages:
      183
      Likes Received:
      4
      Trophy Points:
      18
      I think that did it! +20 internets to you sir!
       

    Share This Page