Runtime Error (adv3Lite)

This is a tricky one. In the game I have a sheet of paper and a pen, or equivalent. I’ve implemented the WriteOn action exactly as shown in the library manual, and it works. I can enter WRITE DAFFY DUCK ON PAPER and get the desired result.

However, when I enter a bare WRITE ON PAPER command, I get a runtime error on line 1532 of action.t. This player command ought to trigger the Write action, which is defined in actions.t as follows:

DefineLiteralAction(Write)
    againRepeatsParse = nil

    execAction(cmd) { askForIobj(WriteOn); }
;

It appears that the result ought to be that the parser asks the player what they want to write on. But that’s not what happens.

If I try a different input, such as WRITE ON TABLE (the table being in scope), I get a run-time error at line 2392 of action.t. This bug occurs only when there is an object (the piece of paper in this case) which uses the WriteOn action. If there’s nothing in scope for which WriteOn is implemented, I get the library’s response when I try WRITE ON BRICK WALL or whatever.

This may be a library bug – I don’t know. I think I’ve copied my code for WriteOn precisely from the Library Manual, so I don’t think that’s the problem, though it might be. My own code doesn’t include a Write action of any kind, so that’s not the source of the problem.

For reference, here (not really a spoiler, as these objects will definitely show up when you enter the room) is as follows:

    writtenText = ''
    dobjFor(WriteOn) {
        verify() {}
        check() {
            if (gLiteral == nil) "You'll need to say what you want to write. ";
            if (!quillPen.isDirectlyIn(gPlayerChar)) 
                "You have nothing to write with. ";
            else if (!inkBottle.isDirectlyIn(gPlayerChar))
                "You'll need some ink. ";
        }
        action() {
            "Using your best penmanship, you write <q><<gLiteral>></q> on the
            parchment. ";
            writtenText += (gLiteral + ' ');
        }
    }

I think I’m going to simplify the puzzle (for other reasons) so as to eliminate the need for WriteOn. But I still think it would be useful to try to track down what’s going on here. If it’s a library bug, I’d like to notify Eric. I don’t know if he’s still active in IF, but it would be a courtesy to let him know.

1 Like

Can you distill the problem into a minimal stand-alone example which always results in the error? That would be great both for troubleshooting the issue here in the forum, and also for Eric, if it turns out to be a library bug.

I’ve been trying to reproduce it by putting your code into a paper object, and at one point ran into something similar: the game stopped when I entered “WRITE BLAH” without specifying the paper; and it didn’t ask what I wanted to write on.

Unfortunately, I couldn’t reproduce this behaviour later, nor the problem you’re describing. (They might both be the same, because I’m not sure there’s a difference here between “WRITE BLAH” and “WRITE ON PAPER”; the latter doesn’t seem to be parsed as “write (<unspecified gLiteral>) on the paper object”, but rather as “write the words ‘on paper’ (<on some unspecified object>).”)

This is the (acceptable?) output I’m getting when I have two other things in the room, one of which can also be written on:

You can see a wall, a paper, and a blackboard here.

>write on paper
What do you want to write that on?

>paper
Using your best penmanship, you write “on paper” on the parchment.

>write on paper on blackboard
Using your best penmanship, you write “on paper” on the blackboard.

>write on blackboard on paper
Using your best penmanship, you write “on blackboard” on the parchment.

>write 42
(on the paper)
Using your best penmanship, you write “42” on the parchment.
[side note: the automatic choice of the paper here is because the parser keeps track of the last object written on and gives it a better score.]

>write on paper on wall
You can’t write anything on the wall.

>write on wall on paper
Using your best penmanship, you write “on wall” on the parchment.

Side note: I think instead of overriding verify(), you can also set canWriteOnMe = true on the relevant objects.

1 Like

I don’t seem able to reproduce this error either.