This is a bit of an odd one, and I can work around it easily enough, but I’m curious about the underlying problem.
Let’s say the player gets conked on the head, passes out, and wakes up in a strange location. We want the room name to initially appear as something “Unknown Location”, then (after the player looks around a bit) perhaps “Abandoned Warehouse” and eventually (after discovering a clue or something) “Villain’s Lair”. Or whatever.
Now, I had originally handled this with something like:
badguyRoom: Room '<<gBadguyRoomName()>>'
[...]
…where gBadguyRoomName()
is a mass of conditionals testing various gRevealed()
values to figure out how much the playe currently knows about the location in question.
That works, but I got to thinking that <<gBadguyRoomName()>>
could be replaced with something like {BadGuyRoom}
and handled via TADS3’s native message parameter substitution logic.
To jump to the punchline, here’s the problem in a simple transcript:
{Foozle}
This is a featureless {foozle}.
>i
You are empty-handed.
>l
Foo
This is a featureless foo.
That is, when the game starts and displays the name and description of the starting room it apparently does not handle any message parameter substitutions. If the player looks at anything else (like an empty inventory listing), subsequent views handle the substitution correctly.
On the other hand, if the only thing viewed is another room description (either by just typing >L
or by moving to another room) the problem persists. Another transcript-from-game-startup:
{Foozle}
This is a featureless {foozle}.
>n
Other {foozle}
This is a different {foozle}.
>l
Other {foozle}
This is a different {foozle}.
>i
You are empty-handed.
>l
Other Foo
This is a different foo.
So what’s going on here? It’s easy enough to work around (indeed, in the game I’m working on the mystery room isn’t the room the player starts out in, and so the problem never manifests except in testing). But I’m trying to figure out what’s going on under the hood here.
Here’s some sample code that illustrates the situation, along with some commented-out bits associated with some other things I’ve tried (for example, if there are any objects in the room, then it “fixes” itself after the first look, so the initial room description is borked but an immediate >L
produces the “correct” output).
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
/*
modify MessageBuilder
filterText(ostr, txt) {
return(generateMessage('[' + txt + ']'));
}
;
*/
modify Thing
foozle() { return('foo'); }
;
modify MessageBuilder
execBeforeMe = [ foozlePreinit ]
;
foozlePreinit: PreinitObject
execute() {
langMessageBuilder.paramList_
= langMessageBuilder.paramList_.append(
[ 'foozle', &foozle, nil, nil, nil ]);
}
;
startRoom: Room '{Foozle}'
"This is a featureless {foozle}. "
north = otherRoom
;
+me: Person;
/*
+pebble: Thing 'small round pebble' 'pebble'
"A small, round {foozle}."
;
*/
otherRoom: Room 'Other {Foozle}'
"This is a different {foozle}."
south = startRoom
;
versionInfo: GameID
name = 'sample'
byline = 'nobody'
authorEmail = 'nobody <foo@bar.com>'
desc = '[This space intentionally left blank]'
version = '1.0'
IFID = '12345'
;
gameMain: GameMainDef
initialPlayerChar = me
newGame() {
//statuslineBanner.removeBanner();
runGame(true);
}
;