Dollars to doughnuts I’m going to have to email Eric Eve about this, but I don’t like to keep bugging him, so I’ll start here and see if anyone can offer any insight.
Here’s the problem, in plain words: The PC is in a room with an NPC, and there are quite a lot of things that the PC shouldn’t try doing. The NPC (a wizard) is sitting at his desk. The desk has a drawer, and there’s something important in the drawer. The wizard would quite obviously not want the young lady to be trying to do anything at all with the drawer, such as trying to unlock it or open it, or even touch it. If the player tries those actions or other similar things, the wizard should put up a roadblock.
But that doesn’t happen. I’ve given the NPC an actorBeforeAction, which is intended to snag any such actions. Here’s the relevant code:
actorBeforeAction() {
"Test: gAction is <<gAction>>. ";
if (((gDobj == drawer) || (gIobj == drawer)) && (gAction != Examine)) {
"Porfiru lowers his eyebrows to gaze at you meaningfully, and you
decide not to try that right now. ";
exit;
}
}
This seems sensible enough to me (though of course I’m quite capable of writing bad code). But here’s the output:
>x drawer
Test: gAction is Examine ( 670). The drawer is tucked away beneath the desk. On the front of the drawer is, you guessed it, a keyhole.
>open drawer
The drawer is locked.
As you can see, the attempted action “open drawer” never reaches the wizard’s actorBeforeAction routine. Why doesn’t it? Because the parser has already decided the action ain’t gonna happen, so there’s no need to consult the actorBeforeAction.
Unfortunately, this is a total violation of the world model. The PC should not be allowed even to try that action.
Adv3Lite provides an option (in gameMain) called beforeRunsBeforeCheck. Worth a try, right? It does change the output a bit. Now I get this:
>open drawer
Test: gAction is Open (TAction). The drawer is locked.
Now the actorBeforeAction is being reached – but its output message is still not being displayed. The parser evidently has to choose between two output strings, and chooses its own rather than mine.
Does anyone have any thoughts about how to make this work?