Output filters not working in action handlers

FWIW, in my quest to implement a quick-and-dirty “FFW” capability to execute a canned series of commands bypassing output (to quickly zip to the gamepoint under debug/development), I could not find a master “output off” switch. I also struggled to get OutputFiltering/gTranscript to work the way I wanted. The below seemed an effective alternative.

modify mainOutputStream
    /* the new enable/disable capability */
    outputOn = true
    enable() { outputOn = true; }
    disable() { outputOn = nil; }

    writeFromStream(txt) {
        /* if an input event was interrupted, cancel the event */
        inputManager.inputEventEnd();

        /* write the text to the console - NEW:  if output enabled */
        if (outputOn) aioSay(txt);
    }
;

invokingMethod() {
        local cmdLst = ['get foo', 'get bar', 'get baz', 'e', 'e'];  //commands to run, hardcoded for now
        mainOutputStream.disable();
        foreach(local x in cmdLst)
            executeCommand(gPlayerChar, gPlayerChar, Tokenizer.tokenize(x), true);
        mainOutputStream.enable();
}

Yes, I was so lazy I did not want to replay a command file and have to spam space bar. This big hammer is probably not what you were initially looking for, but helped me!

1 Like