# \[SOLVED\] Pet cant fetch potion?

**URL:** <https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149>\
**Category:** Level Help\
**Created:** [June 10, 2020, 8:47am UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149 "2020-06-10T08:47:21Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 8:47am UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/1 "2020-06-10T08:47:21Z")

</div>

hello, in “chase them” the couger says “i cannot carry that” on potion… ? stage is simple, dont understand what could go wrong… also - cant change couger if it makes any difference  
i tried simple

```python
pet.fetch("potion");

```

and

```python
javascript
        // Find and fetch a "potion":
        var item = pet.findNearestByType("potion");
        if (item.type==="potion") {
        pet.fetch("potion");

```

 ![cantcarry.PNG](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/2/26fda54b2c5112919a81a4fff8dd12ff82197dcd.jpeg)  
ty for help^^

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [June 10, 2020, 9:01am UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/2 "2020-06-10T09:01:40Z")

</div>

> [@Ksensei](#):
>
> `if (item.type==="potion") {`

Delete this if. Item will be a potion.

> [@Ksensei](#):
>
> `pet.fetch("potion")`

Instead of “potion” put item

---

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 10:03am UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/3 "2020-06-10T10:03:19Z")

</div>

I tried it already it doesnt work :c

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [June 10, 2020, 10:52am UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/4 "2020-06-10T10:52:19Z")

</div>

Can you show me your whole code?

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 10, 2020, 2:15pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/5 "2020-06-10T14:15:52Z")

</div>

Read comments

```python
// Find and fetch a "potion":
        var potion = pet.findNearestByType("potion"); # There are other items too
        if (item.type==="potion") { # Why did you put three equals？
        pet.fetch("potion"); # Put potion instead, if you use a string
# then why did you define potion (item)

```

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 10, 2020, 2:20pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/6 "2020-06-10T14:20:21Z")

</div>

Example

```python
from turtle import *

screen = Screen() # You define it like this '==' means equal, '=' means assign
screen.setup(400, 400)
screen.bgcolor('dodge blue')

```

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [June 10, 2020, 2:23pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/7 "2020-06-10T14:23:39Z")

</div>

```python
// You always need to define, heres a piece of script I used when playing games
(function(){//info
    if(window.updateInfo) return;
 
 
    var info = {};
    var info_container = document.createElement("div");
    info_container.style.position = "fixed";
    info_container.style.color = "white";
    info_container.style["pointer-events"] = "none";
    document.body.appendChild(info_container);
 
    function toggle_info_container(e){
        if(e.key == "i"){
            info_container.style.display = info_container.style.display=="block" ? "none" : "block";
        }
    }
    window.addEventListener("keyup", toggle_info_container);
 

```

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [June 10, 2020, 2:40pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/8 "2020-06-10T14:40:55Z")

</div>

@Ksensei - as @AnSeDra says can you post all your code for the level? That way we can try running it and see where the problem is.

---

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 3:34pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/9 "2020-06-10T15:34:57Z")

</div>

ive been trying different stuff since most basic didnt work (answering to why did i === for exeple)

```python
javascript
function onSpawn(e) {
    while (true) {
        var enemy = pet.findNearestByType("munchkin");
        if (enemy && pet.isReady("chase")) {
            pet.chase(enemy);
        }
        // Find and fetch a "potion":
        var nearest = pet.findNearestByType("potion");
        pet.fetch("potion");
    }
}

```

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [June 10, 2020, 3:36pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/10 "2020-06-10T15:36:03Z")

</div>

> [@Ksensei](#):
>
> `"potion"`

Instead of **“potion”** put **nearest**. Does it work now?

---

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 3:47pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/11 "2020-06-10T15:47:43Z")

</div>

nope ☹ tried it again just to make sure but no

---

<div class="post-metadata">

**Author:** ![AnSeDra](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ansedra/32/13123_2.png) [@AnSeDra](https://discourse.codecombat.com/u/AnSeDra)\
**Post date:** [June 10, 2020, 3:50pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/12 "2020-06-10T15:50:54Z")

</div>

Can you send us the whole code?

---

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 4:05pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/13 "2020-06-10T16:05:54Z")

</div>

its what i posted above  
it chases the ogres when its done with cooldown, but doesnt fetch saying “cant carry”

 ![cantcarry.PNG](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/d/d1a0e89555842669c518e40bc286702614972baa.jpeg)

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [June 10, 2020, 4:52pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/14 "2020-06-10T16:52:20Z")

</div>

> [@AnSeDra](#):
>
> Instead of **“potion”** put **nearest**. Does it work now?

Do this, and check _ **whether** _ there’s a potion. What if there isn’t one? What will happen then?  
Danny

---

<div class="post-metadata">

**Author:** ![Ksensei](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ksensei/32/12821_2.png) [@Ksensei](https://discourse.codecombat.com/u/Ksensei)\
**Post date:** [June 10, 2020, 5:18pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/15 "2020-06-10T17:18:55Z")

</div>

> [@Deadpool198](#):
>
> o this, and check _ **whether** _ there’s a potion. What if there isn’t one? What will ha

when there was “nearest” instead of " “potion” " couger actually did go for the potions BUT it went for the second potion as well without waiting for cooldown of chase thus he braught both potions but 1 ogre stayed,  
code works fully after i moved in the loop  
_code solution deleted_

i understand the logic here of the loop, I just try to follow instructions in their order unless i dont make it work i improvise, i would have expected for “fetch(“potion”)” to work tho, potion is a constant the game recognizes, doesnt it?

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [June 10, 2020, 6:29pm UTC](https://discourse.codecombat.com/t/solved-pet-cant-fetch-potion/22149/16 "2020-06-10T18:29:51Z")

</div>

> [@Ksensei](#):
>
> “potion”

“potion” is a string (text in quotes), a type of item. You want to target an object. A thing in the game, like a friend, and enemy or an item. The object’s name doesn’t represent it exactly.  
Earlier you were able to attack a specific enemy e.g. hero.attack(“Kronk”), “potion” isn’t a specific thing, unlike “Kronk”.  
Danny
