I Need Help with continuos alchemy can i geet help?


loop {
var enemy = this.findNearestEnemy();
var item = this.findNearestItem();
var poison=this.item.type(“poison”);
// If there is no enemy, continue out of the loop.
if(!enemy) {
// If there is an enemy, but no item, ask for a potion and continue out of the loop.
if(!item) {
this.say(“Give me a drink!”);
// Use an if-statement to check the item’s type. If the type is “poison”, continue out of the loop.
// If it is not, the potion must be a bottle of water, so walk to it and return to the starting position!
else {
this.moveXY(34, 47);



Please post your code according to the FAQ. Phrases like "i need help or “i can’t figure it out” don’t help us understand the issue. Please post what is happening with your code. then we can try to help.



item is a an object and it has several components which describe its properties.To use the components you have to write objectName.componentName

For example: item.pos describe the position of the item and item.type its type
To get the type of an item write:


and to test if is a poison:

if(poison == "poison")
    // code for poison


rubs temples
Please remember to place your code in a code block with proper indentation. It makes it much easier to read through.

var poison=this.item.type(“poison”) is going to cause you trouble.
What exactly is it you’re trying to save into this variable?
Reconsider that, and how it is defined. (Remember you can always “this.say(variableName)” in a level to see what is actually stored in the variable so that you know if it will work the way you intend.