I Need Help with continuos alchemy can i geet help?

loop {
var enemy = this.findNearestEnemy();
var item = this.findNearestItem();
if(item){
var poison=this.item.type(“poison”);
}
// If there is no enemy, continue out of the loop.
if(!enemy) {
continue;
}
// 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!”);
continue;
}
// Use an if-statement to check the item’s type. If the type is “poison”, continue out of the loop.
if(item===“poison”){
continue;
}
// 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(item.pos.x,item.pos.y);
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.

Cheers

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:

if(item){
poison=item.type;
}

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.