Remove/disable all default verbs and directional commands

Hello TADS folks,

I am new to writing TADS IF and I am trying to implement/simulate the players ability to log into a computer terminal. When logged into the terminal the usual default verbs and directional commands (look, examine, smell, north, up, down, for example) should be answered with an “error message” like “Command not found” whereas I define my own commands for listing files and displaying their contents and so on.

I know how to define my own verbs and for words unknown to TADS, I modify the playerMessages to get the “error message” like this:

modify playerMessages
    askUnknownWord(which, txt) {
        if (computerTerminal.isOpen) {
            "Command not found. ";
        }
    };
;

but when it comes to removing/disabling the default TADS words I am at a loss. After lots of searching this forum and the TADS documentation, I think the way to go is to remove the words in cmdDict using cmdDict.removeWord( obj, str, vocabType ) as mentioned in this thread: https://intfiction.org/t/tads-3-remove-all-vocabulary-on-a-thing-at-runtime-how/4436/1

If anyone would help me along, I should be grateful.

You can use a beforeAction() method to block verbs.

+me: Actor { beforeAction() { inherited; if(gActionIs(Look)) { reportFailure('Command not found. '); exit; } } }

What Zombie said. Best way I see is to have a list of terminal commands and check if the action was one of them when in terminal mode. If not, block it, otherwise, allow it.

Thank you very much for your fast and useful answer. Below is what I got working. Thanks again!

+me: Actor
{
    beforeAction()
    {
        inherited;
        if ((computerTerminal.isOpen) && !gActionIs(myCommand))
        {
            reportFailure('Command not found. ');
            exit;
        }
    }
}

You might want to exclude some system commands, like save, restore and undo. Or perhaps all system commands by checking for ofKind(SystemAction).