Is there any way (using adv3) to interrupt an implicit action?
As always, here’s a simple example game to illustrate. The player starts out in a hammock, wearing glasses. When the player gets out of the hammock they stumble, dropping their glasses. The starting room is, for some reason, adjacent to a rickety rope bridge over a yawning chasm. If the player attempts to cross the bridge wearing their glasses they’re fine, but if they’re not wearing their glasses they miss the bridge and plummet to the bottom of the chasm.
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
startRoom: Room 'Clearing'
"This is a clearing containing a hammock. A rickety rope
bridge leads across a chasm to the north. "
north = bridgeConnector
;
+ hammock: BasicBed, Fixture 'hammock' 'hammock'
"It's a barely-implemented hammock. "
defaultPosture = lying
allowedPostures = [ lying ]
obviousPostures = [ lying ]
makeStandingUp() {
inherited();
if(glasses.wornBy == me) {
glasses.moveInto(startRoom);
glasses.wornBy = nil;
"You fumble your way out of the hammock and
stand up, dropping your glasses in the
process. ";
} else {
"You fumble your way out of the hammock and stand up. ";
}
}
cannotGoThatWay() {
"You're not going anywhere until you get out of the hammock. ";
}
;
+ bridgeConnector: ThroughPassage
// Check to see if we're the player without their glasses
isPlayerWithoutGlasses(obj) {
if((obj == me) && (glasses.wornBy != me))
return(true);
return(nil);
}
getApparentDestination(origin, traveler) {
return(bridge);
}
getDestination(origin, traveler) {
// if we're not in the starting room, nothing special happens
if(origin != startRoom)
return(bridge);
// if we're the player and we're not wearing our glasses, fall
if(isPlayerWithoutGlasses(traveler))
return(chasm);
// go onto the bridge
return(bridge);
}
noteTraversal(traveler) {
if(isPlayerWithoutGlasses(traveler)) {
"Stumbling around nearly blind, you miss the
rope bridge and fall into the chasm below. ";
}
}
;
chasm: OutdoorRoom 'The Bottom of a Chasm'
"This is the bottom of a chasm. The only exit is up. "
up = startRoom
;
bridge: OutdoorRoom 'Rope Bridge'
"This is a rickety rope bridge, connecting a small clearing to the
south with nothing in particular to the north. "
south = startRoom
;
me: Actor
location = hammock
posture = lying
;
+ glasses: Wearable 'pair glasses' 'glasses'
"They're a nondescript pair of glasses. "
isPlural = true
wornBy = me
;
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
;
Most of the time this all works fine, but if the player just types north
at the start of the game, they’ll implicitly stand and move in a single turn, ending up at the bottom of the chasm before they’re even aware they’ve dropped their glasses.
What I’d like is some way to flag, in this case in the hammock’s makeStandingUp()
method, that no further implicit actions should be taken this turn. Basically some way of declaring that something important has happened and the player should have to opportunity of re-evaluating things before any implicit actions are taken.
If this was happening in a dobjFor()
then we have options like nonObvious
and dangerous
, but there’s no way (as far as I know) to inject that kind of thing into this sort of situation.