• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Trying to use windows too fast can result in read / write exceptions.

    Discussion in 'Community Developer Forum' started by Neverdyne, Jan 20, 2015.

    1. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      I've noticed that even if a window's manager tells you the window is open (i.e. SelectIconString.IsOpen) if you try to do something with it too fast it'll throw a process read / write exception. You can test this with a simple PrioritySelector:

      Code:
      var interact = new Action(r => Core.Player.CurrentTarget.Interact()));
      var choose = new Decorator(req => SelectIconString.IsOpen, new Action(r => Logging.Write(SelectIconString.Lines())));
      var behavior = new PrioritySelector(choose, interact);
      
      Target a Merchant & Mender and run it. Just calling SelectIconString.Lines() without doing anything with it will throw the exception. I'm guessing this is because on that moment, Rebornbuddy has read that the window is open from the game's process, but still hasn't read the window's string lines, maybe that information is not yet visible. Anyways, a simple Sleep() composite is usually enough, but in case the exception still happens is it fine to simply catch it, give some time, and try again? Or will the exception still mess something in Rebornbuddy even if caught on our code?
       
      Last edited: Jan 20, 2015
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      How about you post the error log?

      Edit:
      Also give your entire code please.

      Code:
      new Decorator(r => SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickLineEquals(QuestName);  })),
      
      I use this pattern all over the place and haven't had a single issue so you must be doing something wrong.
       
    3. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Sorry for not attaching the log, here it is. TestBot.cs is a quick botbase I made to test it in isolation. No plugins were enabled during the test. Just target a Merchant & Mender (I was using the one on Black Brush Station) and run the botbase.
       

      Attached Files:

      Last edited: Jan 20, 2015

    Share This Page