# Use your pet to fetch potions while the hero fights. def onSpawn(event): while True: item = hero.findNearestItem() if item: pet.fetch(item) pet.on("spawn", onSpawn) while True: enemy = hero.findNearestEnemy() if enemy: if hero.isReady("cleave"): hero.cleave(enemy) else: hero.attack(enemy)