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

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Wait for GatherItem action to complete

ffxiv

New Member
Joined
Jan 6, 2015
Messages
4
Hi, a bit of background info first: Over the past few days I've been dabbling a bit in using RebornBuddy to semi-automate gathering levequests. There's currently no way to interact with the actual levemete to pick up levequests that I can tell, nor any way to initiate them from the quest log, but I can still automate most of it using simple Orderbot profiles that I was creating for each levequest. Once the profiles were made the only human interaction required was to pick up a new levequest, load a new profile, and start the bot. The tedious part was still handled by the bot, which was good enough for me since I could do other stuff while I let it run.

After a while I decided to try to write a plugin to have the bot use Deep Vigor on evaluation leves to make it easier to get the 25% bonus. I seem to have most of it working: OrderBot will run up to a node, my plugin will take over once it detects that the gathering window is open (GatheringWindow.WindowOpen, with a treehook at PoiAction), and it will deal with the logic to cast Sharp Vision II if necessary, hit the lower leveled slot five times, cast Deep Vigor, and then hit the higher leveled slot for an evaluation bonus.

My only issue is that I don't really know how to properly *wait* for things to complete. My PoiAction hook function (Composite?) is being called on every tick/pulse by the bot as it runs through the behavior tree, which is far more frequently than you can actually issue commands to the game because of animation delay. So my function sees that the gathering window is open, returns RunStatus.Succeed, then activates Sharp Vision II on the next tick, and then spams GatherItem() multiple times per second for every tick thereafter. By the time we're at combo #5 and my plugin tries to cast Deep Vigor, the previous GatherItem() call has already been queued up by the game, so it ignores my cast.

I can sorta work around this by throttling my plugin such that it only runs once every 2.2 seconds (which is just enough time for the swing animation), but this obviously isn't the correct way to do this and it's prone to breaking sequence if there's a bit of internet lag that causes a swing to take too long. I also tried checking the return value from GatherItem, but that seems to return true even when GatherItem is blocked by another animation, so that didn't work.
 
Last edited:
Here's the logic running on each tick. Everything else is the standard plugin setup/framework boilerplate.

[C#] private bool _castSharpVision; private bool _castDeepVigor; - Pastebin.com

As this is now, it's fully functional, because the code is delaying itself to only run every 2.2 seconds. I know this isn't what OrderBot is doing internally, because while OrderBot is gathering, my hotbar abilities never light up in between swings (that is to say, they're always grayed out because the character is busy gathering), whereas with my code they'll light up for a short time since it's running on a strict timer.

I should add that I'm pretty sure this is simply me not using the behavior tree properly, since I've never worked with one before, and not an issue with the GatherItem API itself.
 
Last edited:
You are not even using a behavior tree in that code. To use a behavior tree you'd break that giant logic up into into multiple little chunks, ifs would be converted to decorators and their contents usually an action or a sequence of actions. Behavior trees are old news and I wish new developers wouldn't try and use them as we now have coroutines which offer a much more natural asynchronous programming style. I think I have a solutioin on how I can expose the same methods used by orderbot but you'll need to post the entire file.
 
You are not even using a behavior tree in that code. To use a behavior tree you'd break that giant logic up into into multiple little chunks, ifs would be converted to decorators and their contents usually an action or a sequence of actions. Behavior trees are old news and I wish new developers wouldn't try and use them as we now have coroutines which offer a much more natural asynchronous programming style. I think I have a solutioin on how I can expose the same methods used by orderbot but you'll need to post the entire file.

Yeah, I was looking through some of the bigger combat routines and I now understand a bit better what a behavior tree actually entails. Thanks for the reply.

Here's the entire file, though it's basically what I posted before plus the boilerplate and an OnPulse function that checks if the bot is stuck and tries to jump a few times (since I discovered a few nodes in Costa and Coerthas while leveling my MIN from 15-50 over the past few days that are inaccessible without a jump).

[C#] using System; using System.Linq; using System.Windows.Media; using Clio.Utili - Pastebin.com
 
Back
Top