I went ahead and stuffed the slightly kludgier-but-easier-to-use version of what I posted above into a module here.
An example:
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
#include "remoteView.h"
startRoom: Room 'Void'
"This is a featureless void with a window. The other room is
to the north. "
north = otherRoom
;
+me: Person;
+rock: Thing 'ordinary rock' 'rock' "An ordinary rock. ";
window: RemoteViewConnector 'window' 'window'
locationList = static [ startRoom, otherRoom ]
oneWay = true
oneWayFailure = 'This side of the window is tinted, so you
can\'t see through it from here. '
;
otherRoom: Room 'Other Room'
"This is the other room. The void lies to the south. "
south = startRoom
;
+pebble: Thing 'small round pebble' 'pebble' "A small, round pebble. ";
++RemoteView ->window 'It looks like a pebble seen through a window. ';
versionInfo: GameID;
gameMain: GameMainDef initialPlayerChar = me;
Transcript:
Void
This is a featureless void with a window. The other room is to the north.
You see a rock here.
>x rock
An ordinary rock.
>x pebble
You see no pebble here.
>l through window
In the other room, you see a pebble.
>x pebble
It looks like a pebble seen through a window.
>n
Other Room
This is the other room. The void lies to the south.
You see a pebble here.
>l through window
This side of the window is tinted, so you can't see through it from here.
>x rock
You see no rock here.
The difference here is that most of the “stuff” is encapsulated in a new SenseConnector
class, RemoteViewConnector
, window
in the example above. When you declare a RemoteViewConnector
, you need to define its locationList
as a two (and only two) element List
containing the two locations to connect.
The connector will start out opaque and become transparent the first time the player manages to >LOOK THROUGH
it. After that, objects visible only via that connector won’t be listed when examining the “non-remote” location, but they can be examined directly.
Optionally, you can define on objects what they should look like when viewed through a specific connector. That’s the ++RemoteView
declaration on the pebble. The template is RemoteView ->connectorObject '[description when viewed through connector]'
.
There are a couple of optional things. In the example, the connector is declared with oneWay = true
, which makes the connector “work” only in one direction (you can see otherRoom
from startRoom
but you can’t see startRoom
from otherRoom
), and you can customize the failure message by declaring oneWayFailure
.
You can also define a prefix
and suffix
on the RemoteViewConnector
to add text (via reportBefore
and reportAfter
, respectively) when the player tries to >LOOK THROUGH
the connector.
This all does more or less what I needed a “gimmick” sense connector for, but it’s still pretty limited. It also has a couple implementation warts, like the fact that looking into an empty room can return empty output (just a bare newline) because under the hood it’s using lookAround()
, which can output an empty double-quoted string (which will squash anything you add as a defaultReport()
).
And the simplified syntax of this method (compared to what I posted earlier) comes at the expense of re-writing Thing.basicExamine()
to break out one of the conditionals into its own method. This works fine in all my test cases, but it’ll probably not play well with anything else that twiddles basicExamine()
.
But, with all those caveats, it seems to work pretty well if you basically just have a few cases where the player needs to scan/witness a distant scene in a way that isn’t easily implementable with stock adv3.
Hope it helps.