# Mushroom noise - help

**URL:** <https://discourse.codecombat.com/t/mushroom-noise-help/13458>\
**Category:** Uncategorized\
**Created:** [January 7, 2018, 7:21am UTC](https://discourse.codecombat.com/t/mushroom-noise-help/13458 "2018-01-07T07:21:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adit](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/adit/32/7048_2.png) [@Adit](https://discourse.codecombat.com/u/Adit)\
**Post date:** [January 7, 2018, 7:21am UTC](https://discourse.codecombat.com/t/mushroom-noise-help/13458/1 "2018-01-07T07:21:06Z")

</div>

here is my code - it says e.extra.node.loc is undefined  
can someone pls help

def onSpawn (event):  
potion = pet.findNearestByType(potion)  
pet.fetch(potion)  
gold-key = pet.findNearestByType(gold-Key)  
pet.fetch(gold-key)  
pass

skeleton = pet.findNearestByType(skeleton)  
pet.on(spawn, onSpawn)

while True:  
if skeleton.health \> 0:  
hero.attack(skeleton)  
else:  
hero.moveXY(31, 38)

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [January 7, 2018, 1:02pm UTC](https://discourse.codecombat.com/t/mushroom-noise-help/13458/2 "2018-01-07T13:02:59Z")

</div>

Since you didn’t format your code correctly, we can’t see the structure. However, there are some errors that can be seen.

In your code you define three variables (potion, gold-key, and skeleton), all of which have previously undefined arguments. Arguments that are undefined should be expressed as strings, not variables. Once defined, they can be expressed as variables, but not until. The same is true for the event that triggers the onSpawn function.

From now on, please paste your code from the game using the \</\> button so we can see the structure and format. Help us help you. Thank you.

`

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [January 7, 2018, 4:17pm UTC](https://discourse.codecombat.com/t/mushroom-noise-help/13458/3 "2018-01-07T16:17:59Z")

</div>

Good Pep Talk. 😃

---

<div class="post-metadata">

**Author:** ![kyay10](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kyay10/32/7337_2.png) [@kyay10](https://discourse.codecombat.com/u/kyay10)\
**Post date:** [January 7, 2018, 10:43pm UTC](https://discourse.codecombat.com/t/mushroom-noise-help/13458/4 "2018-01-07T22:43:25Z")

</div>

in the pet.findNearestByType(something), you need to use quotation marks, so it should be pet.findNearestByType(“potion”) not pet.findNearestByType(potion), and you should correct it in the other places
