Does T3/adv3 provide any mechanism for causing an action to fail before any disambiguation prompts are given?
For example, say we want to be able to define a flag on a room to prevent the player from being able to >TAKE
any objects while in the room. We can do something like:
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
class DemoRoom: Room
takeFlag = nil
;
checkTakeFlag: PreCondition
checkPreCondition(obj, allowImplicit) {
local rm;
if(((rm = gActor.getOutermostRoom()) == nil)
|| (rm.takeFlag != true)) {
reportFailure('{You/he} can\'t take anything here. ');
exit;
}
return(nil);
}
;
modify TakeAction
preCond = [ checkTakeFlag ]
;
startRoom: DemoRoom 'Void'
"This is a featureless void. The other room is to the north. "
north = otherRoom
;
+me: Person;
+blackStone: Thing '(black) (go) stone' 'black go stone' "A black go stone. ";
+whiteStone: Thing '(white) (go) stone' 'white go stone' "A white go stone. ";
otherRoom: DemoRoom 'The Other Room'
"This is the other room. The void is to the south. "
south = startRoom
takeFlag = true;
;
+rock: Thing 'ordinary rock' 'rock' "An ordinary rock. ";
versionInfo: GameID;
gameMain: GameMainDef initialPlayerChar = me;
This works as expected:
Void
This is a featureless void. The other room is to the north.
You see a black go stone and a white go stone here.
>take black go stone
You can't take anything here.
But:
>take stone
Which stone do you mean, the white go stone, or the black go stone?
>black
You can't take anything here.
In this case forcing the player to provide disambiguation when all of the options would produce the same failure message seems…unfortunate.
But I don’t know of any way of forcing a failure/command termination prior to the disambiguation prompt, short of messing around (again) with parser internals.
Am I missing something?