I7: decide scope + "when x is visible" freezes my code chunk

This is probably imperfect coding practice, but I ran into this scenario. Let’s say I have 2 items with “button 1” on them, and I want to be able to remotely activate one, for whatever reason.

[code]“b1 scope” by andrew

room 1 is a room. room 2 is a room.

the radio is a thing in room 1.

b1 is a privately-named thing. b1 is part of the radio. understand “button 1” as b1 when b1 is visible.

b2 is a privately-named thing. b2 is part of the radio. understand “button 2” as b2.

the heffalump is a person. description of heffalump is “You’re sure it was behind you, but when you turn around, it’s not there.”

after deciding the scope of the player:
do nothing; [delete the comment below and this works okay]
place heffalump in scope;

the television is a thing in room 2.

b1t is a privately-named thing. b1t is part of the television. understand “button 1” as b1t when b1t is visible.

test hang with “x button 2/x button 1”[/code]

This hangs if we don’t comment out the heffalump line but works OK with it in. The culprit appears to be button 1.

What should I do for a workaround, or what am I doing that is absolutely incorrect?


I believe, without any deep investigation, that you’re running into inform7.com/mantis/view.php?id=808 . The visibility test in your Understand line causes parsing to get stuck.

(What you’re doing should not be illegal, but it runs into a library bug.)

In this case, your conditional understand lines are not accomplishing anything. You never need to say “Understand X as … when X is visible”, because if the object weren’t visible, its name wouldn’t be matched against in the first place.

I expect that you mean something else, maybe “Understand ‘button 1’ as b1 when b1t is not visible.” (As a way to disambiguate input.) It would be better to change this to a simpler test, maybe involving location, rather that invoking a visibility test. Or you could disambiguate with a “does the player mean” rule.

Thanks! That makes a lot of sense. I thought of “does the player mean” but I wanted my code to be succinct & this seemed the way to do it. I suspect that “does the player mean” will be straightforward and easy to edit, and I shouldn’t care if it’s a few words longer.

My actual coding case is more about being able to consult a book about things not visible, so in that case, yes, the disambiguation makes much more sense.

Even though I’m not a code-golf fan, I still seem to get suckered into feeling I have to do it when I don’t understand things 100%. So I appreciate the reality check.