Neverdyne
Community Developer
- Joined
- Sep 12, 2014
- Messages
- 650
- Reaction score
- 20
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:
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?
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: