I worked through this idea as something of a theoretical exercise, but now I'm looking for ways to implement it and interact with other scripts. So please share thoughts or expand the vision! (And if I am rehashing something someone else has already done, tell me that, too!) The idea is simple but powerful, so I want to make  sure I move forward smartly. CaseDriver v1.0 (May 29, 2020) Syntax: !casedriver --[ driver ]: value [...--[ case ]:value --[ case ]:value... -- crash :value ... ] As I said basic idea is simple: given a test, use the value to drive the selection of other cases in the argument list. An example: !casedriver --foo:bar --doom:smack --jangly:bits --bar:slappy When the casedriver engine sees that, it will get the value of the foo case ("bar"), and use that as the case it evaluates out of the arguments offered (returning "slappy"). At present, the value of the found case is simply sent to the chat. Here's a random insult generator: !casedriver --driver:[[1d3]]             --1:/em wonders who bottled swamp stench cologne.             --2:/em has seen prettier smiles on a fish.             --3:/em is thinking of much more important things. Argument Agnostic The script doesn't care what you call the first case (the "driver"). Nor does it care what the other arguments are that you provide. In fact, it only checks for one named argument: "crash." The crash case is what it will default to if the driver case resolves to no argument in your list. If you supply no crash case and the driver case cannot resolve, then it outputs a message to chat. Expansion I would think that ultimately it would be the most helpful to be able to trigger an Attribute, Ability, or Macro, or even another api script, building new command lines on the fly to interact with those other scripts. I could see parsing around triggers to tell the engine whether the text should be interpreted as one of those types, but, again I am wondering about the best way to approach that. Code I have a Gist , but I'm not sure how to embed it here, so for now: var casedriver = casedriver || (function () {     'use strict';     const versionInfo = function () {         const vrs = '1.0';         const vdate = 1590786860752;         const vd = new Date(vdate);         const vm = vd.getMonth() + 1;         log('\u0166\u0166 CaseDriver v' + vrs + ', ' + vd.getFullYear() + '/' + vm + '/' + vd.getDate() + ' \u0166\u0166');     };     const logsig = function () {         // initialize shared namespace for all signed projects, if needed         state.torii = state.torii || {};         // initialize siglogged check, if needed         state.torii.siglogged = state.torii.siglogged || false;         state.torii.sigtime = state.torii.sigtime || Date.now() - 300001;         if (!state.torii.siglogged || Date.now() - state.torii.sigtime > 300000) {             const logsig = '\n' +                 '   ‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗     ' + '\n' +                 '    ∖_______________________________________∕     ' + '\n' +                 '      ∖___________________________________∕       ' + '\n' +                 '           ___┃ ┃_______________┃ ┃___            ' + '\n' +                 '          ┃___   _______________   ___┃           ' + '\n' +                 '              ┃ ┃               ┃ ┃               ' + '\n' +                 '              ┃ ┃               ┃ ┃               ' + '\n' +                 '              ┃ ┃               ┃ ┃               ' + '\n' +                 '              ┃ ┃               ┃ ┃               ' + '\n' +                 '              ┃ ┃               ┃ ┃               ' + '\n' +                 '______________┃ ┃_______________┃ ┃_______________' + '\n' +                 '             ⎞⎞⎛⎛            ⎞⎞⎛⎛      ' + '\n';             log(`${logsig}`);             state.torii.siglogged = true;             state.torii.sigtime = Date.now();         }         return;     };     const getTheSpeaker = function (msg) {         var characters = findObjs({ _type: 'character' });         var speaking;         characters.forEach(function (chr) { if (chr.get('name') == msg.who) speaking = chr; });         if (speaking) {             speaking.speakerType = "character";             speaking.localName = speaking.get("name");         } else {             speaking = getObj('player', msg.playerid);             speaking.speakerType = "player";             speaking.localName = speaking.get("displayname");         }         speaking.chatSpeaker = speaking.speakerType + '|' + speaking.id;         return speaking;     };     const handleInput = (msg_orig) => {         if (msg_orig.type !== 'api') {             return;         }         if (!msg_orig.content.toLowerCase().startsWith('!casedriver ')) {             return;         }         let theSpeaker = getTheSpeaker(msg_orig);         let msg = processInlineRolls(msg_orig);         let args = msg.split(/\s--/);         args.shift(); // get rid of api handle         const driver = args.shift().split(":")[1]; // grab the next argument and assign the value portion (after the ':') to driver         // take what is left (a 1d array of elements composed of foo:bar) and break each element into a sub-array of 2 elements         // let thecase = args.map(function (v, i, a) { return v.split(":"); }).filter(a => a[0] == driver)[0].slice(1).join(":");         let cases = args.map(function (v, i, a) { return v.split(":"); });         // find the element that matches either the driver, the crash case, or get a default output         let thecase = cases.filter(a => a[0] == driver)[0] || cases.filter(a => a[0] == 'crash')[0] || ['uncaught', 'No case matched, no default case supplied.'];         // drop the first element (the case), and join the rest (there will only be multiple more if the player used a colon)         let cmdline = thecase.slice(1).join(":");         // theoretical parsing         if (cmdline.toLowerCase().startsWith('_$a_')) {             cmdline = cmdline.substring(4);             log(`CMDLINE started with _$a_`);         }         sendChat(theSpeaker.chatSpeaker, cmdline);     };     const processInlineRolls = (msg) => {         if (_.has(msg, 'inlinerolls')) {             return _.chain(msg.inlinerolls)                 .reduce(function (previous, current, index) {                     previous['$[[' + index + ']]'] = current.results.total || 0;                     return previous;                 }, {})                 .reduce(function (previous, current, index) {                     return previous.replace(index, current);                 }, msg.content)                 .value();         } else {             return msg.content;         }     };     const registerEventHandlers = () => {         on('chat:message', handleInput);     };     return {         VersionInfo: versionInfo,         LogSig: logsig,         RegisterEventHandlers: registerEventHandlers     }; })(); on('ready', () => {     casedriver.VersionInfo();     casedriver.LogSig();     casedriver.RegisterEventHandlers(); });