Continuous Alchemy (Python)

How do I get my character to “check” whether the drink he gives me is poison or water?
And how do I make my character go get it if it’s confirmed as being water?

Every poison potion will have a type of "poison". Just check it like you would an enemy.

The problem is my hero moves to late after the water is thrown and the ogre gets it and kills me there are other times where poison is thrown and the ogre drinks it but then water is thrown and poison a few seconds later and my hero drinks the water with the poison and then dies

Race munchkins to the water distilled by Omarn Brewstone!
The continue statement is powerful for managing complicated logic.
When the program uses the continue statement, the rest of the loop is skipped.
However, unlike with “break”, the loop repeats instead of stopping.
Use “continue” to verify the conditions of the ambush.
myX = self.pos.x
myY = self.pos.y

If there is no enemy, continue out of the loop.
loop:
enemy = self.findNearest(self.findEnemies())
item = self.findNearest(self.findItems())

if not enemy:
continue
self.say(“I see an enemy!”)

If there is an enemy, but no item, ask for a potion and continue out of the loop.

if not item:
self.say(“Give me a drink!”)
continue

Use an if-statement to check the item’s type. If the type is “poison”, continue out of the loop.

if item.type is “poison”:
continue

If it is not, the potion must be a bottle of water, so walk to it and return to the starting position!

self.moveXY(item.pos.x, item.pos.y)
self.moveXY(myX, myY)

Short answer: ignore enemies (talk less).

Long answer: see here

1 Like

then my hero wont move

my hero wont even move

Your problem is that whole “if there is no enemy” statement. Just delete that and start from “if not item:”. ( ; good luck and here is my code for Python:
[redacted, we don’t post correct code, especially non-formatted code.]

Hii im having trouble with the ‘continuous alchemy’ level this is my code can anyone see anything wrong in it? Every time i try to run it i get an error message saying, “code never finished, Its either really slow or has an infinite loop”. Ive tried many different ways of writing my code this is even exactly the same as a sample code i saw on youtube that ran fine, its really frustrating and i cant figure it out. If anyone can help it will be much appreciated.
Thanks in advance…

@Dylan_Krauss I believe this is due to a bug in the game, see this thread.

Yes i thought it may have a been because of a bug thank you for the confirmation.

Think you could use flags?

yah dont attack the enemys

i know whats wrong take away the if poison move yada yada and just put
moveXY(item.pos.x, item.pos.y)
moveXY(34, 48)

Hi, please don’t post on topics which are older than 1 month if you’re not looking for help yourself. These people aren’t even active any more.
Thanks
Danny