Help with Alchemic Stack Python

peasant = hero.findFriends()[0]
# Use "pickUpItem" command to take items.
items = peasant.findItems()

# Use "dropItem" command to put the top item.
# Drop the key near the door to open it.
key = peasant.findNearestByType("gold-key")

# Use peasant.peekItem() to get know the item on the top.
# Mushrooms to the yeti, potions to the hero.
yetiPos = {"x": 61, "y": 44}
heroPos = {"x": 60, "y": 24}
for item in items:
    if item.type == "potion":
        hero.command(peasant, "pickUpItem", item)
        # Command the peasant "pickUpItem" an item:
for item in items:
    if item.type == "mushroom":
        hero.command(peasant, "pickUpItem", item)
for item in items:
    if item.type == "gold-key":
        hero.command(peasant, "pickUpItem", item)
hero.command(peasant, "move", {"x": 36, "y": 34})
hero.wait(3)
hero.command(peasant, "dropItem", {"x": 38, "y": 34})
    # If topItem type is "mushroom":
        # Command to "dropItem" to yetis:
hero.command(peasant, "dropItem", yetiPos)
hero.command(peasant, "dropItem", yetiPos)
hero.command(peasant, "dropItem", yetiPos)
hero.command(peasant, "dropItem", heroPos)
hero.command(peasant, "dropItem", heroPos)
hero.command(peasant, "dropItem", heroPos)
peasant.peekItem()
while True:
    enemy = hero.findNearestEnemy()
if enemy:
    hero.attack(enemy)

this is my error

nevermind i fixed it

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.