Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Help on Continuous Alchemy

while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    # If there is no enemy, continue out of the loop.
    if not enemy:
    # If there is no item, ask for a potion then continue:
    if not item:
        hero.say("Give me a drink!")
    # If the item.type "poison", continue out of the loop.
    if item.type == "poison":
    # At this point, the potion must be a bottle of water
    # so moveXY to the potion, then back to the start!
    hero.moveXY(44, 35)
    hero.moveXY(34, 47)

My hero does it correctly the first time, but then she stops for a second and the ogres get some water.

You did not write a piece of code for if the item’s type is not a poison, which is where the first moveXY command comes in.


1 Like

this code works fine for me

1 Like

Try to not go to the second x after you picked up the water, instead go somewhere that is more closer to the water x, but not too close to it since it can contain poison.



It glitched and said I finished the level. Thank you for your suggestions anyway.


No problem! Any time! And congratulations for completing the level! :partying_face:


1 Like

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