@create $room named Generic Room 2:Generic Room 2 @prop $room2."remit_msg" "" rc @prop $room2."broadcasting" 0 r @prop $room2."broadcast_to" #-1 r @prop $room2."region" 0 r @prop $room2."buffer" {} "" #378 @prop $room2."buffer_okay" {} c @prop $room2."buffer_length" 20 rc @verb $room2:"contents" this none this @program $room2:contents "Returns the content list like normal, but hides disconnected players"; stuff = {}; for dude in (this.contents) if ((is_player(dude) && `connected_seconds(dude) ! ANY => 0') || (!is_player(dude))) stuff = {@stuff, dude}; else "Player and disconnected."; endif endfor return stuff; . @verb $room2:"@sweep" none none none @program $room2:@sweep buggers = 1; found_listener = 0; here = this; for thing in (setremove(here.contents, caller)) tellwhere = $object_utils:has_verb(thing, "tell"); notifywhere = $object_utils:has_verb(thing, "notify"); if (thing in connected_players()) caller:notify(tostr(thing.name, " (", thing, ") is listening.")); found_listener = 1; elseif ($object_utils:has_callable_verb(thing, "sweep_msg") && (typeof(msg = thing:sweep_msg()) == STR)) caller:notify(tostr(thing.name, " (", thing, ") ", msg, ".")); found_listener = 1; elseif (tellwhere && (((owner = verb_info(tellwhere[1], "tell")[1]) != caller) && (!owner.wizard))) caller:notify(tostr(thing.name, " (", thing, ") has been taught to listen by ", owner.name, " (", owner, ")")); found_listener = 1; elseif (notifywhere && (((owner = verb_info(notifywhere[1], "notify")[1]) != caller) && (!owner.wizard))) caller:notify(tostr(thing.name, " (", thing, ") has been taught to listen by ", owner.name, " (", owner, ")")); found_listener = 1; elseif ($object_utils:isa(thing, $puppet) && `thing.listening ! E_PROPNF => 0') caller:notify(tostr(thing.name, " (", thing, ") is puppeted by ", thing.owner.name, " (", thing.owner, ")")); found_listener = 1; endif endfor buggers = {}; for v in ({"announce", "announce_all", "announce_all_but", "say", "emote", "huh", "here_huh", "huh2", "whisper", "here_explain_syntax"}) vwhere = $object_utils:has_verb(here, v); if (vwhere && (((owner = verb_info(vwhere[1], v)[1]) != caller) && (!owner.wizard))) buggers = setadd(buggers, owner); endif endfor if (buggers != {}) if ($object_utils:has_verb(here, "sweep_msg") && (typeof(msg = here:sweep_msg()) == STR)) caller:notify(tostr(here.name, " (", here, ") ", msg, ".")); else caller:notify(tostr(here.name, " (", here, ") may have been bugged by ", $string_utils:english_list($list_utils:map_prop(buggers, "name")), ".")); endif elseif (!found_listener) caller:notify("Communications look secure."); endif . @verb $room2:"announce_all" this none this rxd #2 @program $room2:announce_all "Copied from generic room (#3):announce_all by God (#2) Fri Aug 15 04:35:24 2003 EDT"; for dude in (this:contents()) try dude:tell(@args); except (ANY) "Just ignore the dude with the stupid :tell"; continue dude; endtry endfor this:remit(@args); if (this.buffer_length == 0) return; else if (this.buffer_length == 0) return; else buffer = $string_utils:from_list(args); if (length(this.buffer) >= this.buffer_length) this.buffer = {@listdelete(this.buffer, 1), buffer}; else this.buffer = setadd(this.buffer, buffer); endif endif endif . @verb $room2:"announce_all_but" this none this rxd #2 @program $room2:announce_all_but "Copied from generic room (#3):announce_all_but by God (#2) Fri Aug 15 04:35:46 2003 EDT"; ":announce_all_but(LIST objects to ignore, text)"; {ignore, @text} = args; contents = this:contents(); for l in (ignore) contents = setremove(contents, l); endfor for listener in (contents) try listener:tell(@text); except (ANY) "Ignure listener with bad :tell"; continue listener; endtry endfor this:remit(@text); if (this.buffer_length == 0) return; else buffer = $string_utils:from_list(args); if (length(this.buffer) >= this.buffer_length) this.buffer = {@listdelete(this.buffer, 1), buffer}; else this.buffer = setadd(this.buffer, buffer); endif endif . @verb $room2:"announce" this none this rxd #2 @program $room2:announce "Copied from generic room (#3):announce by God (#2) Fri Aug 15 04:40:10 2003 EDT"; for dude in (setremove(this:contents(), player)) try dude:tell(@args); except (ANY) "Just skip the dude with the bad :tell"; continue dude; endtry endfor this:remit(@args); if (this.buffer_length == 0) return; else buffer = $string_utils:from_list(args); if (length(this.buffer) >= this.buffer_length) this.buffer = {@listdelete(this.buffer, 1), buffer}; else this.buffer = setadd(this.buffer, buffer); endif endif . @verb $room2:"remit" this none this @program $room2:remit "Usage: :remit(string)"; "Sends the given string to either the remit-to room, or the remit-to channel. If a room, then the remit message is prefixed."; if (this.broadcasting) if (loc = this.broadcast_to) msg = (to_obj = typeof(loc) == OBJ) ? tostr($string_utils:pronoun_sub(this.remit_msg), " ", tostr(@args)) | tostr(@args); if (to_obj) this.broadcast_to:announce_all(msg); else $channel:send_channel(this.broadcast_to, msg); endif else return; endif else return; endif . @verb $room2:"!* @emit" any any any @program $room2:! if ((verb[1] == "!") && (length(verb) > 1)) message = tostr((verb[2..$] + " ") + argstr); else message = argstr; endif this:announce_all(message); . "***finished*** @create $room2 named Generic Exitless Room:Generic Exitless Room @prop $exitless."links" {} rc @prop $exitless."help_msg" {} r ;;$exitless.("help_msg") = {"{Name, {Aliases}, #dest, {leave, oleave, arrive, oarrive, nogo, onogo}, #owner, key, obvious, {transparent, Transparency_message}, Description, {extra}}", "", "Commands:", "", "+dig Name,alias,alias|Name,alias,alias to New-Room-Name or Old-Room-Number", "--Same as @dig. Digs exitless rooms, makes links, etc.", "+Undig -- Removes from the virtual links.", "+leave/+oleave/+arrive/+arrive/+nogo/+onogo is \"Whatever\"", "+desc*ribe as \"Whatever\" -- Same as normal exit description", "+lock with Something -- Sets the Lock on .", "+unlock -- Unlocks ", "+exits -- Lists all +exits.", "+obvious*! -- '+obvious' makes exit visible. '+obvious!' makes it invisible.", "+addalias to -- Adds aliases to an exit.", "+rmalias from -- Removes an alias from the exit.", "+rename to -- Renames an exit.", "+transparent*! -- '+transparent' lets you 'look through' the exit. '+transparent!' negates.", "---"} @verb $exitless:"find_link_number" this none this @program $exitless:find_link_number plinks = {}; for lp in [1..length(this.links)] if (args[1] in this.links[lp][2]) plinks = {@plinks, lp}; endif endfor return (length(plinks) == 1) ? plinks[1] | (plinks ? #-2 | #-3); . @verb $exitless:"l*ook" any any any rxd @program $exitless:look if (!index(argstr, "at")) pexit = $string_utils:trim(argstr); else pexit = $string_utils:trim(argstr[index(argstr, "at") + 3..$]); endif if (n = this:find_link_number(pexit)) player:tell(this.links[n][1]); player:tell_lines(this.links[n][9] ? this.links[n][9] | "You see nothing special."); if (this.links[n][8][1]) player:tell(this.links[n][8][2] ? this.links[n][8][2] | (("Looking through " + this.links[n][1]) + ", you see:")); this.links[n][3]:look_self(); endif return; else pass(@args); endif . @verb $exitless:"+desc*ribe" any any any rxd @program $exitless:+describe if (!this:can_change()) return E_PERM; endif if (!(i = index(argstr, "as"))) player:tell("+desc as \"Whatever\""); else if ((length(args) == ("as" in args)) || (!("as" in args))) player:tell("Syntax: ", verb, " is \"Whatever\""); return; endif link = $string_utils:trim(argstr[1..i - 2]); message = args[("as" in args) + 1]; n = this:find_link_number(link); if (n == #-2) player:tell("I don't know which ", link, " you mean!"); return; elseif (n == #-3) player:tell("No such link."); endif this.links[n][9] = message; player:tell("You set the ", verb, " of ", this.links[n][1], " to '", message, "'"); endif . @verb $exitless:"+lock" any with any rxd @program $exitless:+lock if (!this:can_change()) return E_PERM; endif if (ln = this:find_link_number(dobjstr)) key = $lock_utils:parse_keyexp(iobjstr, player); if (typeof(key) == STR) player:tell("That key expression is malformed:"); player:tell(" ", key); else res = this.links[ln][6] = key; if (typeof(res) == ERR) player:tell(tostr(res), "."); else player:tell("Locked ", this.links[ln][1], " to the key:"); player:tell(" ", $lock_utils:unparse_key(key)); endif endif else player:tell("No such exit. Syntax: +lock with "); endif . @verb $exitless:"+unlock" any none none rxd @program $exitless:+unlock if (!this:can_change()) return E_PERM; endif if (ln = this:find_link_number(dobjstr)) this.links[ln][6] = 0; player:tell("You unlocked ", this.links[ln][1], "."); else player:tell("No such link."); endif . @verb $exitless:"+exits" none none none rxd @program $exitless:+exits if ((player == this.owner) || player.wizard) if (this.links) for lp in (this.links) player:tell(lp[1], "(aka ", $string_utils:english_list(lp[2]), ") is a link to ", lp[3].name, " (", tostr(lp[3]), ")"); endfor else player:tell("This room has no +exits."); endif else player:tell("You can't do that."); endif . @verb $exitless:"+obvious*!" any none none rxd @program $exitless:+obvious! if (!this:can_change()) return E_PERM; endif if (ln = this:find_link_number($string_utils:trim(dobjstr))) if (verb == "+obvious") this.links[ln][7] = 1; player:tell("Link ", this.links[ln][1], " is set obvious."); else this.links[ln][7] = 0; player:tell("Link ", this.links[ln][1], " is not obvious."); endif else player:tell("No such link."); endif . @verb $exitless:"+addalias" any to any rxd @program $exitless:+addalias if (!this:can_change()) return E_PERM; endif if ((!dobjstr) || (!iobjstr)) player:tell("Syntax: +addalias to "); else n = this:find_link_number(iobjstr); if (n) aliases = $string_utils:explode(dobjstr, ","); this.links[n][2] = {@this.links[n][2], @aliases}; this.links[n][2] = $list_utils:remove_duplicates(this.links[n][2]); player:tell("Exit now has aliases of ", $string_utils:english_list(this.links[n][2]), "."); else player:tell("No such exit."); endif endif . @verb $exitless:"+rmalias" any from any rxd @program $exitless:+rmalias if (!this:can_change()) return E_PERM; endif if ((!dobjstr) || (!iobjstr)) player:tell("Syntax: +rmalias from "); else n = this:find_link_number(iobjstr); if (n) alias = $string_utils:trim(dobjstr); if (an = alias in this.links[n][2]) this.links[n][2] = listdelete(this.links[n][2], an); player:tell("Link aliases are now ", $string_Utils:english_list(this.links[n][2]), "."); else player:tell("No such alias for that exit."); endif else player:tell("No such exit."); endif endif . @verb $exitless:"+transparent*!" any none none rxd @program $exitless:+transparent! if (!this:can_change()) return E_PERM; endif if (ln = this:find_link_number($string_utils:trim(dobjstr))) if (verb == "+transparent") this.links[ln][8][1] = 1; player:tell("Link ", this.links[ln][1], " set transparent."); else this.links[ln][8][1] = 0; player:tell("Link ", this.links[ln][1], " set not transparent."); endif else player:tell("No such link."); endif . @verb $exitless:"announce_msg" this none this @program $exitless:announce_msg ":announce_msg(place, what, msg)"; " announce msg in place (except to what). Prepend with what:title if it isn't part of the string"; msg = args[3]; what = args[2]; title = what:titlec(); if (!$string_utils:index_delimited(msg, title)) msg = tostr(title, " ", msg); endif args[1]:announce_all_but({what}, msg); . @verb $exitless:"+rename" any to any rxd @program $exitless:+rename if (!this:can_change()) return E_PERM; endif if ((!dobjstr) || (!iobjstr)) player:tell("Syntax: +rename to \"Whatever\""); else n = this:find_link_number(dobjstr); if (n) newname = $string_utils:trim(iobjstr); this.links[n][1] = newname; this.links[n][2] = {newname}; player:tell("Link name changed to ", newname, " (aka ", $string_utils:english_list(this.links[n][2]), ")."); else player:tell("No such link."); endif endif . @verb $exitless:"here_huh" this none this @program $exitless:here_huh ":here_huh(verb,args) -- room-specific :huh processing. This should return 1 if it finds something interesting to do and 0 otherwise; see $command_utils:do_huh."; "For the generic room, we check for the case of the caller specifying an exit for which a corresponding verb was never defined."; set_task_perms(caller_perms()); if (args[2]) pexit = (args[1] + " ") + $string_utils:from_list(args[2], " "); else pexit = args[1]; endif exit = this:match_exit(pexit); link = this:match_link(pexit); if (valid(exit) && link) "... ambiguous exit and link ..."; player:tell("I don't know which direction '", pexit, "' you mean."); elseif (valid(exit)) exit:invoke(); elseif (link) this:invoke(link); elseif (exit == #-2) "... ambiguous exit ..."; player:tell("I don't know which direction '", pexit, "' you mean."); elseif (link == #-2) "... ambiguous link ..."; player:tell("I don't know which direction '", pexit, "' you mean."); else "... okay, it's not an exit. I give up..."; return 0; endif return 1; . @verb $exitless:"invoke_save" this none this @program $exitless:invoke_save ":invoke(link)"; ename = args[1][1]; to = args[1][3]; from = player.location; leave = args[1][4][1]; oleave = args[1][4][2]; arrive = args[1][4][3]; oarrive = args[1][4][4]; nogo = args[1][4][5]; onogo = args[1][4][6]; lock = args[1][6]; if (!$lock_utils:eval_key(lock, player)) "... You can't go that way ..."; if (onogo) this:announce_msg(this, player, $string_Utils:pronoun_sub(onogo, player)); endif player:tell(nogo ? $string_utils:pronoun_sub(nogo, player) | "You can't go that way."); return; endif "... Get here, you can move the person ..."; if (leave) player:tell($string_utils:pronoun_sub(leave, player)); endif if (oleave) this:announce_msg(this, player, $string_utils:pronoun_sub(oleave, player)); else this:announce_all_but({player}, player:titlec() + " has left."); endif player:moveto(to); if (arrive) player:tell($string_utils:pronoun_sub(arrive, player)); endif if (oarrive) to:announce_msg(to, player, $string_utils:pronoun_sub(oarrive, player)); else to:announce_all_but({player}, player:titlec() + " has arrived."); endif . @verb $exitless:"tell_obvious_exits" this none this @program $exitless:tell_obvious_exits elist = ""; for lp in (this.exits) if (lp.obvious) elist = (elist + lp.name) + " "; endif endfor for lp in (this.links) if (lp[7]) elist = (elist + lp[1]) + " "; endif endfor if (elist) player:tell("Obvious Exits:"); player:tell(elist); endif . @verb $exitless:"match_link" this none this @program $exitless:match_link pos = {}; for lp in (this.links) if (args[1] in lp[2]) pos = {@pos, lp}; endif endfor return (length(pos) == 1) ? pos[1] | (pos ? #-2 | #-3); . @verb $exitless:"+dig" any any any rxd @program $exitless:+dig if (this:can_change()) set_task_perms(player); nargs = length(args); if (nargs == 1) room = args[1]; exit_spec = ""; elseif ((nargs >= 3) && (args[2] == "to")) exit_spec = args[1]; room = $string_utils:from_list(args[3..nargs], " "); elseif (argstr && (!prepstr)) room = argstr; exit_spec = ""; else player:notify(tostr("Usage: ", verb, " ")); player:notify(tostr(" or ", verb, " to ")); return; endif if (room != tostr(other_room = toobj(room))) room_kind = player:build_option("dig_room"); if (room_kind == 0) room_kind = $exitless; endif other_room = player:_create(room_kind); if (typeof(other_room) == ERR) player:notify(tostr("Cannot create new room as a child of ", $string_utils:nn(room_kind), ": ", other_room, ". See `help @build-options' for information on how to specify the kind of room this command tries to create.")); return; endif other_room.name = room; other_room.aliases = {room}; player:notify(tostr(other_room.name, " (", other_room, ") created.")); elseif (nargs == 1) player:notify("You can't dig a room that already exists!"); return; elseif ((!valid(player.location)) || (!($room in $object_utils:ancestors(player.location)))) player:notify(tostr("You may only use the ", verb, " command from inside a room.")); return; elseif ((!valid(other_room)) || (!($room in $object_utils:ancestors(other_room)))) player:notify(tostr(other_room, " doesn't look like a room to me...")); return; endif if (exit_spec) exits = $string_utils:explode(exit_spec, "|"); if ((length(exits) < 1) || (length(exits) > 2)) player:notify("The exit-description must have the form"); player:notify(" [name:]alias,...,alias"); player:notify("or [name:]alias,...,alias|[name:]alias,...,alias"); return; endif tlink = $building_utils:parse_names(exits[1]); this.links = setadd(this.links, {tlink[1], tlink[2], other_room, {0, 0, 0, 0, 0, 0}, player, 0, 1, {0, 0}, {}, {}}); player:tell("Link from ", player.location.name, " to ", other_room.name, " created with a name of ", tlink[1], "(aka ", $string_utils:english_list(tlink[2]), ")."); if (length(exits) == 2) flink = $building_utils:parse_names(exits[2]); other_room.links = setadd(other_room.links, {flink[1], flink[2], player.location, {0, 0, 0, 0, 0, 0}, player, 0, 1, {0, 0}, {}, {}}); player:tell("Link to ", player.location.name, " from ", other_room.name, " created with a name of ", flink[1], "(aka ", $string_utils:english_list(flink[2]), ")."); endif endif else player:tell("Sorry, not allowed to do that."); return E_PERM; endif . @verb $exitless:"+undig" any none none rxd @program $exitless:+undig if (!this:can_change()) return E_PERM; endif if (!dobjstr) player:tell("Syntax: +undig "); else n = this:find_link_number(dobjstr); if (n) player:tell("Link ", this.links[n][1], " deleted."); this.links = listdelete(this.links, n); elseif (n == #-2) player:tell("I don't know which ", dobjstr, " you mean!"); else player:tell("No such link."); endif endif . @verb $exitless:"can_change" this none this @program $exitless:can_change if (player.wizard || (player.location.owner == player)) return 1; else return 0; endif . @verb $exitless:"+leave +oleave +arrive +oarrive +nogo +onogo" any any any @program $exitless:+leave if (!this:can_change()) return E_PERM; endif if (!(i = index(argstr, "is"))) player:tell("Syntax: ", verb, " is \"Whatever\""); else if ((length(args) == ("is" in args)) || (!("is" in args))) player:tell("Syntax: ", verb, " is \"Whatever\""); return; endif link = $string_utils:trim(argstr[1..i - 2]); message = args[("is" in args) + 1]; n = this:find_link_number(link); if (n == #-2) player:tell("I don't know which ", args[1], " you mean!"); return; elseif (n == #-3) player:tell("No such exit."); return; endif this.links[n][4][verb in {"+leave", "+oleave", "+arrive", "+oarrive", "+nogo", "+onogo"}] = message; player:tell("You set the ", verb, " message for ", this.links[n][1], " to '", message, "'"); endif . @verb $exitless:"html_description" this none this @program $exitless:html_description desc = this:description(); if (typeof(desc) == STR) desc = {desc}; endif lines = ""; if (desc) for line in (desc) if (line != "") lines = tostr(lines, "

", line, "

"); endif endfor endif return lines; . @verb $exitless:"html_contents" this none this @program $exitless:html_contents contents = this:contents(); contentlist = {}; contstr = ""; for object in (contents) contentlist = {@contentlist, tostr("", $html_utils:object_anchor(object), "")}; endfor count = 1; for object in (contentlist) contstr = tostr(contstr, object); if (count == 2) contstr = tostr(contstr, ""); count = 0; endif count = count + 1; endfor contstr = tostr("

", contstr); contstr = tostr(contstr, (contstr[length(contstr) - 5..$] == "") ? "
Contents:
" | ""); contstr = tostr(contstr, "

"); return contstr; . @verb $exitless:"html_exits" this none this @program $exitless:html_exits exits = {}; exitlist = ""; for lp in (this.exits) if (lp.obvious) exits = {@exits, tostr("", lp:title(), "")}; endif endfor for lp in (this.links) if (lp[7]) exits = {@exits, tostr("", $html_utils:object_anchor(lp[3]), "")}; endif endfor count = 1; for link in (exits) exitlist = tostr(exitlist, link); count = count + 1; if (count == 3) exitlist = tostr(exitlist, ""); count = 1; endif endfor exitlist = tostr("

", exitlist, "
Obvious Exits:

"); return exitlist; . @verb $exitless:"http_request" this none this @program $exitless:http_request title = tostr("

", this:title(), "

"); desc = this:html_description(); contents = this:html_contents(); exits = this:html_exits(); return {$html_utils:page_header(this:title()), title, desc, contents, exits}; . @verb $exitless:"look_self" this none this @program $exitless:look_self pass(); this:tell_obvious_exits(); . @verb $exitless:"help_msg" this none this @program $exitless:help_msg return this.help_msg; . @verb $exitless:"invoke" this none this xd #378 @program $exitless:invoke ":invoke(link)"; ename = args[1][1]; to = args[1][3]; from = player.location; leave = args[1][4][1]; oleave = args[1][4][2]; arrive = args[1][4][3]; oarrive = args[1][4][4]; nogo = args[1][4][5]; onogo = args[1][4][6]; lock = args[1][6]; if (!$lock_utils:eval_key(lock, player)) "... You can't go that way ..."; if (onogo) this:announce_msg(this, player, $string_Utils:pronoun_sub(onogo, player)); endif player:tell(nogo ? $string_utils:pronoun_sub(nogo, player) | "You can't go that way."); return; endif "... Get here, you can move the person ..."; if (leave) player:tell($string_utils:pronoun_sub(leave, player)); endif if (oleave) this:announce_msg(this, player, $string_utils:pronoun_sub(oleave, player)); else this:announce_all_but({player}, player:titlec() + " has left."); endif player:moveto(to); if (arrive) player:tell($string_utils:pronoun_sub(arrive, player)); endif if (oarrive) to:announce_msg(to, player, $string_utils:pronoun_sub(oarrive, player)); else to:announce_all_but({player}, player:titlec() + " has arrived."); endif . "***finished***