function gender(context) { if (!UTIL.has(['male', 'female'], context.command)) { context.log("<p>For the purpose of the narrative, “male” and “female” are the gender options, not “" + HTML.escape(context.command) + "”.</p>"); } else { context.log("<p>Okay, people will recognize your gender now.</p>"); player.gender = context.command; } }
var handler = function (context) { var parsed = readCommand(context.command); if (UTIL.has(commands, parsed.command)) { context.path = (context.path || '') + parsed.command + " "; context.command = parsed.arg; return commands[parsed.command](context); } else { return nextHandler(context); } };
function goCommand(context) { if (!UTIL.has(room.allExits, context.command)) { context.log( "<p>There is no way to go “" + HTML.escape(context.command) + "” from here.</p>" ); } else { go(room.allExits[context.command].href); } }
}, function (context) { if (context.command) { var exitName = context.command.toLowerCase(); if (UTIL.has(room.allExits, exitName)) { go(room.allExits[exitName].href); context.log("<p>You go " + HTML.escape(exitName) + ".</p>"); } else { return commonHandler(context); } } else { context.log("<p><b>[command mode]</b></p>"); channel.send(JSON.stringify({ "to": "mode", "content": "command" })); modeHandler = commandHandler; } });