I suppose your bot spams Spacebar and X every cicle, but this might be a problem when you're attacking a mob and also trying to pick up a drop.
I suggest you check if after pressing X to pick up drops the character position changes, you wait to attack until the position stops changing (so you avoid that awkward situation where the character moves back and forward trying to attack and also pick up items)
I suggest you check if after pressing X to pick up drops the character position changes, you wait to attack until the position stops changing (so you avoid that awkward situation where the character moves back and forward trying to attack and also pick up items)