Is there an elegant way to let a player GO TO #someplace with no conventional connection?
This isn’t it!
#chezcollins
(room *)
(name *) Collins' Room
(from * go #chezclarkson to #chezclarkson)
(look *) Your friend Collins lives here. Typical bachelor accommodations (space) - (space) no point asking for a woman's touch here.
#chezclarkson
(room *)
(name *) Clarkson Home
(look *) This is the home of Miss Maud Clarkson. More detail TKTKTK.
(* is visited)
Collins' Room
Your friend Collins lives here. Typical bachelor accommodations - no point asking for a woman's touch here.
> go clarkson
(attempting to go Clarkson Home)
You can't reach the Clarkson Home.
Taking away the (* is visited) makes a difference but not a useful one:
> go clarkson
(I'm sorry, I didn't understand what you wanted to do.)
By default, every non-direction, non-relation object used in an action needs to be touchable. The [go $] action doesn’t override this, so if it’s given something other than a direction, it will try to touch that thing first. (This is in case of something like GO DOOR, while you’re tied down and can’t touch the door.)
For something like going to a room, why not use [go to $] (which takes a room) instead of [go $] (which takes a direction)? It’s possible to override either action to allow something like this, but the process will be different for each.
Your line (from * go #chezclarkson to #chezclarkson) isn’t considered a connection because #chezclarkson isn’t a direction. You can do this:
(direction #secret-direction)
(from #chezcollins go #secret-direction to #chezclarkson)
You might want to tweak some of the library messages, but this looks like it works from an initial test. If you don’t give #secret-direction a (name $) property, the player will never be able to type it, so you shouldn’t be opening up any additional unexpected behaviour.
You’ll also want to make sure it doesn’t appear in EXITS or GO TO, but that’s a very solid way to do it! That’s how I handled the between-maps connections in Wise-Woman’s Dog.
I mean, the real answer is “because that caused a lot more compiler yelling just now when I did.”
It does, thank you, and I’m able to suppress the ability to go there for a little while (as I hope/intend to do) with
#dancecard
(item *)
(name *) worn dance card
(descr *) This crumpled dance card has been in your jacket pocket for weeks. Three names are checked: Miss Geraldine Beatty, Miss Lois Burbank, and Miss Maud Clarkson.
(dict *) card dancecard
(* is #heldby #player)
(perform [read *]) (now) (#chezclarkson is visited) (descr *)
(smarter ways to do that are welcome)
Mmm, yes, we now have
> exits
Obvious exits are:
.
and for what I’m doing I can just disable EXITS in the library, but I see your point for people who want to do something less minimal.
Remember that any rule in Dialog can have a body, so you can always write:
(from #chezcollins go #secret-direction to #chezclarkson)
(#dancecard is examined)
Your current implementation might be simpler in this case if you’re not otherwise tracking ($ is examined) for your objects, but it’s worth remembering that you can put the logic into the connection itself if it depends on complex logic.
It looks like you should be able to copy the definition of (perform [exits]) from the library code and just replace each use of (direction $Dir) with a new (listable-direction $Dir) predicate that excludes whatever secret directions you’re adding.