Logical Path kicking my butt

Not sure what the problem is, but the level keeps telling me that the lines of code included when I open/start the level are incorrect. Error message says, "TypeError: Can’t read protected property: findNearestFriend.

I have no idea what that means and can’t find any information on the error on this site. One would think that the lines of code written by the site to get us started on a level would be correct, not errors.

The line says, secretA = hero.findNearestFriend().getSecretA()

Since the error is on the first, initial lines of code supplied by the game, when run the code fails immediately. I’m at a loss. No idea what to do.

1 Like

I looked into this and have fixed it.

I apologize for this, we recently switched from an old style of parsing user code to a new one, and there will be a few rocky spots as we verify the transition worked accordingly.

I appreciate you reporting it instead of giving up, it helps us fix these problems instead of letting them block other people as well! Please let us know if you hit any more oddities.

1 Like

Line 2: TypeError: Can’t read protected property:moveXY

1 Like
// Get two secret true/false values from the wizard.
hero.moveXY(14, 24);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();

// If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.
// Check the guide for notes on how to write logical expressions.
var secretC = secretA && secretB;
if (secretC)
    hero.moveXY(20, 33);
else
    hero.moveXY(20, 15);
hero.moveXY(26, 24);

// If EITHER secretA or secretB is true, take the high path.
if (secretA === true || secretB === true) {
    hero.moveXY(32, 33);
}

// If secretB is NOT true, take the high path.
if (secretB !== true) {
    hero.moveXY(44, 33);
}

Can someone explain to me what is wrong with this?

For everyone that is having troubles using the protected properties. I had the same problem its because the equipment your wearing does not support that function. Buy the correct armor or wepon you need and that will fix the protected property issue. You need better glasses to get the findFriend property.