[SOLVED] Bugs and please help on Double Agent

hi it says an error but it doesn’t say which line it’s on.
here’s my code:

def passagePosByNum(n):
    return {"x": 60, "y": n * 12 + 8}
def onHear(event):
    message = event.message
    clearMessage = message.trim()
    n = clearMessage.len
    h = passagePosByNum(n)
    if h:
        pet.moveXY(h)
    pet.moveXY(1, pet.pos.y)
pet.on("hear", onHear)
while True:
    hero.move(pet.pos)

2 Likes

Can you send me a link to the level?

1 Like

https://codecombat.com/play/level/double-agent? there

2 Likes

Here is the issue. Try to put this instead:

n = len(message) - len(clearMessage)

Does it work now @ActualllOLLIEpop ?

thanks, but there’s still the error

2 Likes

Can you send me your current code?

1 Like

here:

def passagePosByNum(n):
    k = {"x": 60, "y": n * 12 + 8}
    return k
def onHear(event):
    message = event.message
    clearMessage = message.trim()
    n = len(message) - len(clearMessage)
    h = passagePosByNum(n)
    if h:
        pet.moveXY(h)
    pet.moveXY(1, pet.pos.y)
pet.on("hear", onHear)
while True:
    hero.move(pet.pos)

2 Likes

Here put

pet.moveXY(h.x, h.y)

Does it work now?

1 Like

yes it worked! thanks @AnSeDra! :partying_face:

2 Likes

No problem! And congratulations for completing the level! :partying_face:

1 Like