In scope or can reach

Previous to the new darkness rules I would use (player can see #thingy)

Now, with the new rules, that doesn’t always do what I expect. Is it best therefore to use (#thingy is in scope) - which in another thread it is advised not to negate - or, the apparently undocumented, (player can reach #thingy) or, is there another preferred method?


Could you give an example of what doesn’t work? It might be a bug.

I don’t think it’s a bug, more likely a flaw in my logic.

(current player #player)
(#player is #in #in_secret_canyon)

(name *) in secret canyon
(proper *)
(room *)
(inherently dark *)
(from * go #east to #in_secret_e_w_canyon)

(prevent [leave * #east]) 
	(player can see #dragon) 
	The dragon looks rather nasty. You'd best not try to get by.

(name *) dragon
(* is #in #in_secret_canyon)
(descr *) I wouldn't mess with it if I were you.
(animate *)

(name *) secret E/W canyon above tight canyon
(room *)
(from * go #west to #in_secret_canyon)

Going east in the dark avoids the dragon, with light the dragon blocks your way. Adventure is meant to be played with light, and I worked the puzzles as if light was always there - after all moving in the dark could cause death. and when the lantern finally expires the game ends.

The new darkness rules has made me look again at the code and remove the assumption that there will always be light. Replacing (player can see $) with either (player can reach $) or ($ is in scope) or ($ is #in $room) works.

In the example above the fix is simple, any of the above work. for more complicated scenarios it may not be so simple. My question therefore is “what is the best method to use” given that: (player can reach $) isn’t documented, ($ is in scope) shouldn’t be negated, ($ is #in $room) is good for a single room but if multiple room are involved could get messy.


Right! There are several interesting points.

  • First, I don’t remember why (player can reach $) isn’t documented. Looks like an oversight on my part; it should be safe to use, and I’ll make sure to document it.

  • Second, to clarify, it is fine to make a negated query for ~($ is in scope). Problems occur if we define a negated rule for it. Here’s that other thread.

  • Third, there is indeed a problem with the game logic if the dragon only blocks passage when the player can see it. I mean, it would accurately describe the Ravenous Bugblatter Beast of Traal (from Hitchhiker’s Guide), but not a dragon.

So in conclusion, any of your proposed methods should work. In a simple situation like this, I would use (#dragon has parent #in_secret_canyon) because it is fast. If the dragon moves around, I’d probably use:

        (current room $Room)
        (#dragon is in room $Room)

I’d say it comes down to style or personal preference.