Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Mushroom noise - help


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

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

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

while True:
if > 0:
hero.moveXY(31, 38)

1 Like

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.



Good Pep Talk. :smiley:


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