I am **SO NOT GETTING IT** like it says cannot read property 'start' of undefined, here is my code
def onSpawn (event):
# Pet should find the health potion (type is "potion"):
potion = petfindNearestByType("potion")
# and fetch it:
pet.fetch(potion)
# Pet should find the gold key (type is "gold-key"):
gold-key = petfindNearestByType("gold-key")
# and fetch it:
pet.fetch(gold-key)
pass
# Pet can find more than just items:
skeleton = pet.findNearestByType("skeleton")
pet.on("spawn", onSpawn)
while True:
if skeleton.health > 0:
hero.attack(skeleton)
else:
hero.moveXY(31, 38)
Please paste ALL of your code inside the triple back tick marks.
``` <— Triple back tick marks.
Paste ALL of your code in here.
``` <— Triple back tick marks.
There are many people here willing and able to help. If you use the </> button correctly, then ALL of your code should look like this:
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
else:
hero.say("My code is formatted properly")
If ALL of your code isn’t formatted like the code above, then you’re doing it wrong and we can’t see the structure of the code to troubleshoot whether or not that is the issue. Use the </> button and help us help you. This works when sending a private message as well.