Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

The Wizards Door Bug


#1

Hello there,
I was wondering if you can help me with this level? I have been trying to get through the level but it just seems there is a weird bug. I was trying to type in the code, but then it appeared with a message saying:
Line 9: TypeError: Attempted to assign read-only property.
I don’t know what I got wrong with the level, so I would like to show you my code.

hero.moveXY(30, 13);
var las = hero.findNearestFriend().getSecret();
var erz = las + 7;
hero.moveXY(17, 26);
hero.say(erz);
var sim = erz % 4;
hero.moveXY(30, 39);
hero.say(sim);
var aga = sim * laz;
hero.moveXY(43, 26);
hero.say(aga);

It only highlights the say commands with the read-only property. Can you fix the problem, please?


#2

So this is an error that I don’t care for too much myself. In general it indicates that you probably misspelled something. So check that first, if you have not, then look to see if you can actually use that command. I have had times when my gear was different and I wasn’t able to use a command from prior code.

I would check line 9 again and ask yourself those questions.


#3

I have tried what you asked, but it still doesn’t work. I even changed sim to 1, but it just went to line 8 and said the attempt to read the read-only property. I really think this is a bug and I have no way around it.


#4

Apparently, when I stripped down to only wearing boots, leaving the comments and doing this:

[redacted, please don’t post solutions]

It works. So thanks.


#5

just remember line 2:

las

line 9

laz


#7

@Watermeloon9
Please don’t post finished solutions. This board isn’t here to provide solutions just so that people can move on to the next level. It’s here to help people find the solutions so that when they move to the next level, they know how to find the solution on their own. You can’t learn to code if you don’t learn how to figure things out. Being given solutions is counter-productive to this goal. Thanks.


#8

this is my code but when I submitted it the numbers changed and I failed the level please help me `# Move to ‘Laszlo’ and get his secret number.
hero.moveXY(30, 13)
las = hero.findNearestFriend().getSecret()

Add 7 to 'Laszlo’s number to get 'Erzsebet’s number.

Move to ‘Erzsebet’ and say her magic number.

erz = las + 7
hero.moveXY(17, 26)
hero.say(erz)

Divide 'Erzsebet’s number by 4 to get 'Simonyi’s number.

Go to ‘Simonyi’ and tell him his number.

hero.moveXY(30, 39)
erz = las + -2.75
hero.say(erz)

Multiply 'Simonyi’s number by 'Laszlo’s to get 'Agata’s number.

Go to ‘Agata’ and tell her her number.

hero.moveXY(43, 26)
erz = las + 17.5
hero.say(erz)`
this was my code but the numbers changed


#9

All of your calculations involve erz and laz. Where are the calculations for sim and aga? Also, you’re supposed to say sim and aga’s number when the comments tell you to, not just say erz all at every position.

Please learn to post your code properly. It’s really easy and only requires a very small amount of effort.

FormatCode

To post your code from the game, use the </> button or it won’t format properly. When you click the </> button, the following will appear:

PostCode

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.

Thank you.