userexperience.js 1.2 KB

1234567891011121314151617181920212223242526
  1. module.exports = class UserExperience {
  2. help(room, mobile, input) {
  3. var topic = input.join(" ").trim();
  4. switch(topic) {
  5. case "alias":
  6. libs.Output.toMobile(mobile.id, "Key commands are sometimes too long to type quickly, or you want to set up a series of instructions to be run in order. Aliases can allow you to do both!");
  7. libs.Output.toMobile(mobile.id, "* alias [key] [instruction] - create or overwrite an alias with an instruction. A command like 'alias hi say hi' would result in your character saying 'hi' when you typed it in.");
  8. libs.Output.toMobile(mobile.id, "* alias [key] [instruction];[instruction] - you can chain instructions behind aliases. A command like 'alias gearup wear hat;wear shirt;wear pants;wear boots' would result in your character putting on their clothes when typing 'gearup'.");
  9. return true;
  10. }
  11. }
  12. alias(room, mobile, input) {
  13. var aliasKey = input.shift();
  14. //TODO: prevent aliases overwriting dangerous functions
  15. var instructions = input.join(" ");
  16. //TODO: prevent instructions that would break the server (like setting aliases)
  17. mobile.mud_setAlias(aliasKey, instructions);
  18. }
  19. mud_getErrorMessage() {
  20. return "You {error}forget{/error} what you were doing.";
  21. }
  22. };