In-game bug reporting

I am trying to make it easy for people to report bugs right in the middle of the game (and for me to see the context in which they appeared), by asking people to turn on Scripting, and then whenever they have a comment they want to make they can simply say >bug When I do foo, foobar happens.

Of course the game won’t recognize some of the words, but all I have to do is sweep their transcript for the word “bug” and out will pop all their comments.

This sorta works, but sometimes it crashes the game.

Here is the very simple code I set up. Is there a better way to do it?


DefineIAction(Bug)
    execAction() { 
        {mainReport('Thanks. I\'ll look into it. '); }
    }
;
   
VerbRule(Bug)
    'bug' singleTopic
    : BugAction
    verbPhrase = 'bug/bugging'
    whichMessageTopic = DirectObject
    construct()
    {
        /* set up the empty direct object phrase */
        dobjMatch = new EmptyNounPhraseProd();
        dobjMatch.responseProd = inSingleNoun;
    }
;

Thanks,

–Bob

This is already implemented by Tads. You use an asterisk () at the beginning of the command. But you can change this to anything you want by changing commentPreParser.commentPrefix. By default, it’s set to '’.

If the player does not have transcript recording active, a warning will be issued.

If you want to roll your own system, you can take a look at lib/adv3/input.t, where the commentPreParser object is defined and supply an override somewhere else in your code. Or you can write your own pre-parser by subclassing StringPreParser and then set the global commentPreParser object to your own custom object. The commentPreParser object is very simple, so writing your own should be rather trivial.

Wow! Very cool. Thanks! --Bob