parent $user_interfaces object $interaction var $root child_index 0 var $root owners [$interaction] var $root fertile 0 var $has_commands commands [["wh?isper * to *", 'whisper_cmd], ["@register-ch?annel|@reg-ch?annel *", 'register_channel_cmd], ["@delete-ch?annel|@del-ch?annel *", 'delete_channel_cmd], ["say *", 'say_cmd], ["to * say *", 'say_to_cmd], ["@paste *", 'paste_cmd], ["page * with *", 'page_cmd], ["emote *", 'emote_cmd], ["strip *", 'strip_cmd], ["@tuned|@ch?annels *", 'channels_cmd], ["repeat *", 'repeat_cmd], ["@tune in|out *", 'tune_channel_cmd], ["on * say *", 'on_subj_cmd], ["vowel?ize *", 'late_vowels_cmd], ["epage * with *", 'page_emote_cmd]] var $has_commands shortcuts [["|*", '_interact, ["|", 1]], ["<*", '_interact, ["<", 1]], ["think *", 'think_cmd, [1]], ["%*", 'think_cmd, [1]], ["#*", 'channel_cmd, ["#", 1]], ["\"*", 'say_cmd, ["", 1]], [":*", 'emote_cmd, ["", 1]], ["!*", 'polite_spoof_cmd, [1]], ["''*", 'say_to_cmd, ["to", "", "say", 1]], ["'* *", 'say_to_cmd, ["to", 1, "say", 2]], ["--*", 'page_cmd, ["page", "", "with", 1]], ["-* *", 'page_cmd, ["page", 1, "with", 2]], ["++*", 'page_emote_cmd, ["epage", "", "with", 1]], ["+* *", 'page_emote_cmd, ["epage", 1, "with", 2]], ["]*", 'right_encapsulate_cmd, ["]", 1]], [")*", 'right_encapsulate_cmd, [")", 1]]] var $root inited 1 var $interaction stage #[[">", " -> "], ["<", " <- "], ["[", " ["], ["|", " | "]] var $interaction last_interacted_with 0 var $root owned [$interaction] var $root manager $interaction var $root writable [$interaction] var $root readable ['parameters, 'methods, 'code] var $root dbref 'interaction var $root info [" ] [Lynx text] | Lynx | text", " [ Lynx [text]: < Lynx <- text", " ) (Lynx text) > Lynx -> text", " ( Lynx (text): ! text -- Lynx", " % Lynx . o O ( text ) \" Lynx says, \"text\"", " ' Lynx to who, \"text\" '' Lynx [to who]: text", " ` Lynx [to who]: text `` Lynx [to who]: text", " - Lynx pages: text -- Lynx pages: text", " + (from...) Lynx text ++ (from...) Lynx text", " , Lynx jumps, \"text\" ,, Lynx jumps, \"text\"", " : Lynx text :: Lynxtext", " . Lynx text (pose) ; ;eval", " # <Channel - Lynx> text", "Unused: ~ $ & * =", "Dont use: ?"] var $old_command_environment verb_cache #[] var $old_command_environment command_cache [["wh?isper * to *", 'whisper_cmd], ["@register-ch?annel|@reg-ch?annel *", 'register_channel_cmd], ["@delete-ch?annel|@del-ch?annel *", 'delete_channel_cmd], ["say *", 'say_cmd], ["to * say *", 'say_to_cmd], ["@paste *", 'paste_cmd], ["page * with *", 'page_cmd], ["emote *", 'emote_cmd], ["strip *", 'strip_cmd], ["@tuned|@ch?annels *", 'channels_cmd], ["repeat *", 'repeat_cmd], ["@tune in|out *", 'tune_channel_cmd], ["on * say *", 'on_subj_cmd], ["vowel?ize *", 'late_vowels_cmd], ["epage * with *", 'page_emote_cmd]] var $old_command_environment shortcuts_cache [["|*", '_interact, ["|", 1]], ["<*", '_interact, ["<", 1]], ["think *", 'think_cmd, [1]], ["%*", 'think_cmd, [1]], ["#*", 'channel_cmd, ["#", 1]], ["\"*", 'say_cmd, ["", 1]], [":*", 'emote_cmd, ["", 1]], ["!*", 'polite_spoof_cmd, [1]], ["''*", 'say_to_cmd, ["to", "", "say", 1]], ["'* *", 'say_to_cmd, ["to", 1, "say", 2]], ["--*", 'page_cmd, ["page", "", "with", 1]], ["-* *", 'page_cmd, ["page", 1, "with", 2]], ["++*", 'page_emote_cmd, ["epage", "", "with", 1]], ["+* *", 'page_emote_cmd, ["epage", 1, "with", 2]], ["]*", 'right_encapsulate_cmd, ["]", 1]], [")*", 'right_encapsulate_cmd, [")", 1]]] method page_cmd arg com, who, prep, message; var user, recipient, targets; .perms(sender(), 'parser); who = (who && ($string.explode_english_list(who))) || []; if (!who) { if (last_interacted_with) who = last_interacted_with[2]; else $parse.tell_error("You must specify somebody or something to speak to."); } targets = who; for recipient in (who) { if (type(recipient) == 'dbref) { user = recipient; } else { user = (| $user_db.match_begin(recipient) |); if (!user) user = (| .match_environment(recipient) |); } if (user && ((user.has_ancestor($user)) && (user.connected()))) { user.tell(((.namef()) + " pages: ") + message); who = replace(who, recipient in who, user.namef()); targets = replace(targets, recipient in targets, user); } else { .tell(("! " + ($data.unparse(recipient))) + " is either not connected, not a user, or misspelled."); who = setremove(who, recipient); targets = setremove(targets, recipient); } } if (targets) { last_interacted_with = [time(), targets]; .tell(((("You page \"" + message) + "\" to ") + ($list.to_english(who, 'namef))) + "."); } . method wall_cmd arg what; .perms(sender(), 'parser); ._interact("|", what); . method polite_spoof_cmd arg what; var name; .perms(sender(), 'parser); // Polite spoof: Send what unmarred if it contains " "+.namef()+" ", // otherwise, tack on " -- "+.namef() name = .namef(); if (!(((name + " ") in what) || ((" " + name) in what))) what = (what + " -- ") + name; (.location()).announce(what); . method say_to_cmd arg com, who, prep, msg; var thing, x, recipient, tmp, targets, errargs, how; .perms(sender(), 'parser); who = (who && ($string.explode_english_list(who))) || []; if (!who) { if (last_interacted_with) who = last_interacted_with[2]; else $parse.tell_error("You must specify somebody or something to speak to."); } targets = who; for x in [1 .. listlen(who)] { recipient = who[x]; if (type(recipient) == 'dbref) { thing = recipient; } else { catch ~ambig { thing = .match_env_nice(recipient); } with handler { eargs = (traceback[1])[3]; tmp = $list.map(errags, 'namef); who = (sublist(who, 1, x - 1) + tmp) + sublist(who, x + 1); targets = (sublist(who, 1, x - 1) + errargs) + sublist(who, x + 1); } } if (thing) { who = replace(who, x, thing.namef()); targets = replace(targets, recipient in targets, thing); } } if (msg) how = $code.punctuation_type(msg); else how = "say"; last_interacted_with = [time(), targets]; (.location()).announce((((((((.namef()) + " (to ") + ($list.to_english(who))) + ") ") + how) + "s, \"") + msg) + "\""); . method whisper_cmd arg com, what, prep, who; var loc; .perms(sender(), 'parser); who = .match_env_nice(who); loc = .location(); if ((who.location()) != loc) { .tell("You must be in the same room as a person, to whisper to them."); return; } who.tell((((.namef()) + " whispers, \"") + what) + "\""); .tell(((("You whisper, \"" + what) + "\" to ") + (who.namef())) + "."); loc.announce((((.namef()) + " whispers to ") + (who.namef())) + ".", who, this()); . method wiz_cmd arg what; if (sender() != this()) throw(~perm, "Sender not this."); $comm_tuner.channel_announce('wiz, what); . method _interact arg verb, what; var stage; .perms(sender(), 'parser); stage = $interaction.get_stage(); // echo .namef()+stage[verb]+what to the room if (verb in dict_keys(stage)) (.location()).announce(((.namef()) + (stage[verb])) + what); else throw(~unknownverb, ("Unknown verb '" + verb) + "'"); . method get_stage return stage; . method think_cmd arg what; .perms(sender(), 'parser); (.location()).announce((((.namef()) + " . o O ( ") + what) + " )"); . method channel_cmd arg com, what; var channel, text, syntax, sep_loc; syntax = "`#<channel> <text>'"; if (sender() != this()) throw(~perm, "Sender not this."); catch any { sep_loc = " " in what; channel = $channels.match_channel(substr(what, 1, sep_loc - 1)); if (!channel) $parse.tell_error("That channel does not exist.", syntax); if (listlen(channel) > 1) $parse.tell_error(("Which channel? That could refer to any of these: " + ($data.unparse(channel))) + ".", syntax); channel = channel[1]; text = substr(what, sep_loc + 1); $channels.announce(channel, text); } with handler { switch (error()) { case ~range: $parse.tell_error("You must specify some text to send", syntax); default: $parse.tell_error((traceback()[1])[2], syntax); } } . method tune_channel_cmd arg com, inout, channel; var syn; .perms(sender(), 'parser); syn = com + " <channel>"; if ((channel[1]) == "#") channel = substr(channel, 2); catch any { switch (inout) { case "in": channel = $channels.validate_channel(channel); $channels.tune_in(channel); case "out": channel = $channels.validate_channel(channel); $channels.tune_out(channel); default: $parse.tell_error("You must tune a channel \"in\", or \"out\".", syn); } } with handler { $parse.tell_error((traceback()[1])[2], syn); } .tell(((("Channel #" + tostr(channel)) + " tuned ") + inout) + "."); . method channels_cmd arg com, who; .perms(sender(), 'parser); if (!who) who = this(); else who = .match_env_nice(who); .tell("Communication Channels:"); .tell($list.lcolumnize(who.get_channels(), .linelen())); . method register_channel_cmd arg com, what; var syn, name, tunable, senders; if (sender() != this()) throw(~perm, "Sender is not this"); syn = [("Syntax: `" + com) + " <name> [<tunable> <senders>]'", "<tunable> and <senders> can be either 1, 0, or a list of users"]; what = explode(what); name = [@what, "BAD NAME"][1]; tunable = [@what, 1, 1][2]; senders = [@what, 1, 1, 1][3]; catch any { $channels.new_channel(name, tunable, senders, sender(), [sender()]); } with handler { $parse.tell_error(syn + [(traceback()[1])[2]]); } .tell(("New channel registered with the name `" + tostr(name)) + "'."); . method delete_channel_cmd arg com, name; var syn; if (sender() != this()) throw(~perm, "Sender is not this"); syn = ("`" + com) + " <name>'"; catch any { $channels.del_channel($channels.validate_channel(name)); } with handler { $parse.tell_error((traceback()[1])[2], syn); } .tell("Channel deleted"); . method emote_cmd arg com, what; if (what && ((what[1]) == ":")) (.location()).announce((.namef()) + ($string.match_sub_tag(substr(what, 2), "^"))); else (.location()).announce(((.namef()) + " ") + ($string.match_sub_tag(what, "^"))); . method late_vowels_cmd arg what; var output, letter, index; if (sender() != this()) throw(~perm, "Sender not this."); output = ["", ""]; while (what) { letter = what[1]; what = substr(what, 2); if (letter in ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]) output = [output[1], (output[2]) + letter]; else if (letter != " ") output = [(output[1]) + letter, output[2]]; else output = [(output[1]) + letter, (output[2]) + letter]; } (.location()).announce(((.namef()) + " ") + (output[1])); $scheduler.add_task(1, 'emote_cmd, "", output[2]); . method say_cmd arg say, what; var type, how, idx; .perms(sender(), 'parser); // .location().announce(pad(.name(), -9) + "->ALL " + what); // return; if (what) how = $code.punctuation_type(what); else how = "say"; (.location()).announce((((((.name()) + " ") + how) + "s, \"") + what) + "\""); . method pose_cmd arg dummy1, str; var actor; actor = sender(); if (str && ((str[1]) == ":")) (.location()).announce((actor.namef()) + substr(str, 2)); else (.location()).announce(((actor.namef()) + " ") + str); . method paste_cmd arg com, [who]; var obj, text; .perms(sender(), 'parser); who = [@who, 0][1]; if (who) { who = $list.to_string(sublist(explode(who), 2)); obj = (| .find_object(who, 'environment, 'environment, 'grasp) |); if (!obj) $parse.tell_error(("No user found by the name \"" + who) + "\".", "Syntax: '@paste [to <user>]'"); } text = .read(); if (text == 'aborted) return .tell("@paste aborted."); else if (!text) return .tell("@paste nothing?"); text = [$string.center((" " + (.namef())) + " (@paste's) ", 79, "-"), @text, $string.center(" + Finis + ", 79, "-")]; if (obj) { obj.tell(text); .tell(("Text pasted to " + (who.namef())) + "."); } else { (.location()).announce(text); } . method paste_done arg text, who; var padlen; if (sender() != this()) throw(~perm, "Sender not this."); padlen = 79; text = [$string.center((" " + (.namef())) + " (@paste's) ", padlen, "-"), @text, $string.center(" + Finis + ", padlen, "-")]; if (who) { who.tell(text); .tell(("Text pasted to " + (who.namef())) + "."); } else { (.location()).announce(text); } . method strip_cmd arg com, str; str = ((.namef()) + " ") + str; (.location()).announce($string.strip(str, str[random(strlen(str))])); . method get_channels var ch, chs, entry, new_chs, len, public, subscribed; .perms(sender()); chs = $channels.channels(); new_chs = []; public = $channels.all_tuners(); // pick a random dictionary to get the name list from len = $list.element_maxlength(chs); for ch in (chs) { subscribed = $channels.listeners(ch); entry = ((this() in subscribed) ? "+" | "") + tostr(ch); entry = pad(entry, -(len + 2)); entry = entry + (((public[ch]) == 1) ? " - Public " | " - Private"); new_chs = [@new_chs, entry]; } return new_chs; . method repeat_cmd arg com, [args]; var syntax, x, times, line, out, repeat, other; syntax = ("`" + com) + " [+times|+t=<times>] <what>'"; args = explode(args ? args[1] | ""); if (!args) $parse.tell_error("You must specify something to repeat antisocially.", syntax); if (match_begin(args[1], "+t")) { x = (| explode(args[1], "=")[2] |); if (!x) $parse.tell_error("You must define repeat times as +times=* to something.", syntax); times = toint(x); args = sublist(args, 2); if (!args) $parse.tell_error("You must specify something to repeat antisocially.", syntax); } if (!times) times = 3; repeat = args[1]; other = (| sublist(args, 2) |) || []; // line = ""; for x in [1 .. times] line = line + repeat; args = sublist(args, 2); // .emote_cmd("emote", $list.to_string([line] + other)); . method page_emote_cmd arg com, who, prep, message; var user, recipient, targets, name; .perms(sender(), 'parser); who = (who && ($string.explode_english_list(who))) || []; if (!who) { if (last_interacted_with) who = last_interacted_with[2]; else $parse.tell_error("You must specify somebody or something to speak to."); } targets = who; name = (.namef()) + " "; for recipient in (who) { if (type(recipient) == 'dbref) { user = recipient; } else { user = (| $user_db.match_begin(recipient) |); if (!user) user = (| .match_environment(recipient) |); } if (user && ((user.has_ancestor($user)) && (user.connected()))) { user.tell(((("[from " + ((.location()).namef())) + "] ") + name) + message); who = replace(who, recipient in who, user.namef()); targets = replace(targets, recipient in targets, user); } else { .tell(("! " + ($data.unparse(recipient))) + " is either not connected, not a user, or misspelled."); who = setremove(who, recipient); targets = setremove(targets, recipient); } } if (targets) { last_interacted_with = [time(), targets]; who = who.to_english(); .tell((((("You epage \"" + name) + (message.chop(((.linelen()) - 17) - strlen(who)))) + "\" to ") + who) + "."); } . method right_encapsulate_cmd arg right, line; var space, line, left, right; .perms(sender(), 'parser); space = " "; if (!line) space = ""; switch (right) { case "]": left = "["; case ")": left = "("; } (.location()).announce((((left + (.namef())) + space) + line) + right); .