;return tostr("[bold][cyan]Your New Channel System:"); ;return tostr("[bold][cyan]Upgrades from older channel systems:"); ;return tostr("[bold][cyan] Easier control over how individual channels act through parent -> child."); ;return tostr("[bold][cyan] Easier creation and modification of new channels."); ;return tostr("[bold][cyan] "); ;return tostr("[bold][cyan]Channel Features:"); ;return tostr("[bold][cyan] = for talk, + for emote"); ;return tostr("[bold][cyan] \"@chanjoin /join\" to join channels."); ;return tostr("[bold][cyan] \"@chanleave /leave\" to leave channels"); ;return tostr("[bold][cyan] @whochan to view players on channel"); ;return tostr("[bold][cyan] @chanf*reeze (wizardly) to freeze a channel (nobody may talk on it)"); ;return tostr("[bold][cyan] @chanwho to view what channels a player is on"); ;return tostr("[bold][cyan] @history to view the last 15 things sent through a channel"); ;return tostr("[bold][cyan] :get_chan() to get the obj. number of a channel with the name or alias ."); ;return tostr("[bold][cyan] :is_channel() to check if is the name of a channel."); ;return tostr("[bold][cyan] @chanc*eck to check if all things in a channel's .members list are valid objects, and then valid players"); ;return tostr("[bold][cyan] "); ;return tostr("[bold][cyan]Beginning Installation..."); ;return tostr("[bold][cyan]...Creating object and corifying..."); @create $feature named New Channel System Feature,ncsf,csf,chansys @corify chansys as $chansys ;return tostr("[bold][cyan]...\"=* +*\"..."); @verb chansys:"=* +*" any any any xdo @program chansys:= chan = 0; for y in (children($chanobj)) if (verb[2..$] in y.aliases) chan = y; endif endfor if (chan == 0) return this:get_chan("Mischan"):preliminary(verb[2..$], verb[1], argstr); endif if (!chan:can_send()) return player:tell($string_utils:pronoun_sub(chan.cant_send_msg)); endif if (!(player in chan.members)) return player:tell("Either that channel doesn't exist, or you are not on it."); endif chan:prelim(verb[1], argstr); . ;return tostr("[bold][cyan]...@chanjoin /join..."); @verb chansys:"@chanjoin /join" any none none xdo @program chansys:@chanjoin chan = 0; if (!args) return player:tell("Syntax: @chanjoin "); endif for y in (children($chanobj)) if (args[1] in y.aliases) chan = y; endif endfor if (chan == 0) return player:tell("I couldn't match \"", argstr, "\" to any channel names or aliases."); elseif (player in chan.members) return player:tell("You are already a member of that channel."); elseif (!chan:join_auth()) return player:tell("You are not authorized to join that channel."); endif chan.members = setadd(chan.members, player); chan:send_msg($string_utils:pronoun_sub((("[" + chan:title()) + "] ") + chan.ojoin_msg)); . ;return tostr("[bold][cyan]...@chanleave /leave..."); @verb chansys:"@chanleave /leave" any none none xdo @program chansys:@chanleave chan = 0; if (!args) return player:tell("Syntax: @chanleave "); endif for y in (children($chanobj)) if (args[1] in y.aliases) chan = y; endif endfor if (chan == 0) return player:tell("I couldn't match \"", argstr, "\" to any channel names or aliases."); elseif (!(player in chan.members)) return player:tell("You aren't on that channel."); endif chan:send_msg($string_utils:pronoun_sub((("[" + chan:title()) + "] ") + chan.oleave_msg)); chan.members = setremove(chan.members, player); . ;return tostr("[bold][cyan]...:get_chan..."); @verb chansys:"get_chan" this none this xdo @program chansys:get_chan {chan, name} = {0, args[1]}; for channel in (children($chanobj)) if (name in channel.aliases) chan = channel; endif endfor return (chan == 0) ? player:tell(("I couldn't match \"" + args[1]) + "\" to any channel names or aliases.") | chan; . ;return tostr("[bold][cyan]...@chanlist /list..."); @verb chansys:"@chanlist /list" none none none xdo @program chansys:@chanlist cnt = 0; player:tell($string_utils:left("Name:", 20, " "), " Aliases:"); player:tell($string_utils:left("=", 20, "="), " ", $string_utils:left("=", player:linelen() - 22, "=")); for channel in (children($chanobj)) if (channel:view_auth()) player:tell($who_utils:convsize(tostr("[", channel:title(), "]", (player in channel.members) ? " [red]*[normal]" | ""), 20), " [cyan]", $string_utils:english_list(channel.aliases[2..$]), "[normal]"); cnt = cnt + 1; endif endfor player:tell($string_utils:left(tostr("==== ", cnt, " channel", (cnt != 1) ? "s" | "", " found "), player:linelen(), "=")); . ;return tostr("[bold][cyan]...@whochan..."); @verb chansys:"@whochan" any none none xdo @program chansys:@whochan chan = count = 0; if (!args) return player:tell("Syntax: @whochan "); endif for channel in (children($chanobj)) if (args[1] in channel.aliases) chan = channel; endif endfor if (chan == 0) return player:tell("I couldn't match \"", argstr, "\" to any channel names or aliases."); endif player:tell($string_utils:left("Name:", 20, " "), " Status:"); player:tell($string_utils:left("=", 20, "="), " ", $string_utils:left("=", player:linelen() - 22, "=")); for who in (chan.members) if (who in connected_players()) player:tell($who_utils:convsize(who:title(), 20), " [", who.status, "]"); coutn = count + 1; endif endfor player:tell($string_utils:left(tostr("==== ", count, " member", (length(chan.members) != 1) ? "s " | " ", "found "), player:linelen(), "=")); . ;return tostr("[bold][cyan]...@chanf*reeze..."); @verb chansys:"@chanf*reeze" any none none xdo @program chansys:@chanfreeze if (!args) return player:tell("Syntax: @chanf*reeze ."); endif for channel in (children($chanobj)) if (args[1] in channel.aliases) chan = channel; endif endfor if (chan == 0) return player:tell("I couldn't match \"", argstr, "\" to any channel names or aliases."); endif if (chan.frozen) chan.frozen = 0; player:tell("Unfroze [", chan:title(), "]."); chan:send_msg(tostr("[", chan:title(), "] This channel has been unfrozen. You are now able to talk on it.")); else chan.frozen = 1; player:tell("Froze [", chan:title(), "]."); chan:send_msg(tostr("[", chan:title(), "] This channel has been frozen. You will no longer be able to talk on it.")); endif . ;return tostr("[bold][cyan]...@chanwho..."); @verb chansys:"@chanwho" any none none xdo @program chansys:@chanwho cnt = 0; if (!args) return player:tell("Syntax: @chanwho "); endif who = $string_utils:match_player(argstr); if (!valid(who)) return player:tell("\"", $string_utils:capitalize(argstr), "\" is not a valid player."); elseif (who == player) return player:tell("Use @chanlist to see what channels you're on."); endif player:tell($string_utils:left("Name:", 20, " "), " Aliases:"); player:tell($string_utils:left("=", 20, "="), " ", $string_utils:left("=", player:linelen() - 22, "=")); for channel in (children($chanobj)) if ((who in channel.members) && channel:view_auth()) player:tell($who_utils:convsize(tostr("[", channel:title(), "]"), 20), " [cyan]", $string_utils:english_list(channel.aliases[2..$]), "[normal]"); cnt = cnt + 1; endif endfor player:tell($string_utils:left(tostr("==== ", cnt, " channel", (cnt != 1) ? "s" | "", " found "), player:linelen(), "=")); . ;return tostr("[bold][cyan]...@history..."); @verb chansys:"@history" any none none xdo @program chansys:@history chan = 0; if (!args) return player:tell("Syntax: @history ."); endif for channel in (children($chanobj)) if (args[1] in channel.aliases) chan = channel; endif endfor if (chan == 0) return player:tell("I couldn't match \"", argstr, "\" to any channel names or aliases."); endif player:tell(); $caselib:dialog_box(player, tostr("Channel history for [", chan:title(), "]"), "|", chan.history); . ;return tostr("[bold][cyan]...@chancheck..."); @verb chansys:"@chanc*heck" any none none xdo @program chansys:@chanc if (!args) return player:tell("Syntax: [green]@chanc*eck [normal]."); endif if ($chansys:get_chan(chan = args[1]) == 0) return player:tell("I couldn't match \"", chan, "\" with any channel names or aliases."); endif invalid = {}; chan = $chansys:get_chan(chan); player:tell("[bold][cyan]Checking objects on ", chan:title(), chan:title()[$] == "s" ? "[bold][cyan]'" | "[bold][cyan]'s", " [bold][cyan]members list...[normal]"); for object in (chan.members) if (!valid(object)) invalid = {@invalid, object}; endif endfor player:tell(!invalid ? "[bold][yellow]No invalid objects found.[normal]" | "[bold][yellow]The following invalid objects were found:[normal]"); if (invalid) for y in (invalid) player:tell(y, " (", $string_utils:english_ordinal(y in chan.members), " in .members)"); endfor endif invalid = {}; player:tell("[bold][cyan]Checking that all ", invalid ? "valid" | "", " objects are players...[normal]"); for member in (chan.members) if (!is_player(member)) invalid = {@invalid, member}; endif endfor player:tell(!invalid ? "[bold][yellow]No none-players found.[normal]" | "[bold][yellow]The following invalid players were found:[normal]"); if (invalid) for x in (invalid) player:tell(x, " (", $string_utils:english_ordinal(x in chan.members), " in .members)"); endfor endif . ;return tostr("[bold][cyan]...:is_channel..."); @verb chansys:"is_channel" this none this xdo @program chansys:is_channel return (parent(args[1]) == $chanobj) ? 1 | 0; . ;return tostr("[bold][cyan]Instalation of Channel System complete, installing Generic Channel Object..."); ;return tostr("[bold][cyan]Generic Channel Object is the parent for all your channels."); ;return tostr("[bold][cyan]"); ;return tostr("[bold][cyan]Beginning installation..."); ;return tostr("[bold][cyan]"); ;return tostr("[bold][cyan]...Creating and corifying..."); @create $thing named Generic New Channel Object,gnco,nco,chanobj @corify chanobj as $chanobj ;return tostr("[bold][cyan]...Writing properties..."); @prop chanobj."members" {} rc @prop chanobj."logs" {} rc @prop chanobj."frozen" {} rc @prop chanobj."ojoin_msg" "* %N has joined the channel." rc @prop chanobj."oleave_msg" "* %N has left the channel." rc @prop chanobj."cant_send_msg" "You can't send to that channel." rc @prop chanobj."history" {} rc ;return tostr("[bold][cyan]...:prelim*inary..."); @verb chanobj:"prelim*inary" this none this xdo @program chanobj:preliminary "The \"Preliminary\" is where the channel does all of the things it needs to /before/ it sends the message to the channel. For Example, in the Preliminary verb, one might put the code for who can join the channel, who can write to it, if anything is going to be done to the message (changed colour, etc.), it would happen here."; "Basically, the :prelim*inary verb makes it easier for wizards and programmers to modify what happens before the message is sent."; if ((args[1] == "=") && (args[2][1] != "`")) msg = tostr("[", this:title(), "] ", player:title(), "> ", args[2]); elseif ((args[1] == "=") && (args[2][1] == "`")) raw = $string_utils:explode(args[2], " ")[1][2..$]; if (!valid(who = $string_utils:match_player(raw))) return player:tell("\"", $string_utils:capitalize(raw), "\" is not a valid player."); elseif (!(who in connected_players())) return player:tell(who:title(), " is not online."); elseif (!(who in this.members)) return player:tell(who:title(), " is not on this channel."); endif msg = tostr("[", this:title(), "] ", player:title(), " [to ", who:title(), "]> ", $string_utils:from_list($string_utils:explode(args[2], " ")[2..$], " ")); elseif ((args[1] == "+") && (args[2][1] != "`")) msg = tostr("[", this:title(), "] * ", player:title(), " ", args[2]); elseif ((args[1] == "+") && (args[2][1] == "`")) raw = $string_utils:explode(args[2], " ")[1][2..$]; if (!valid(who = $string_utils:match_player(raw))) return player:tell("\"", $string_utils:capitalize(raw), "\" is not a valid player."); elseif (!(who in connected_players())) return player:tell(who:title(), " is not online."); elseif (!(who in this.members)) return player:tell(who:title(), " is not on this channel."); endif msg = tostr("[", this:title(), "] [to ", who:title(), "] * ", player:title(), " ", $string_utils:from_list($string_utils:explode(args[2], " ")[2..$], " ")); endif this:send_msg(msg); . ;return tostr("[bold][cyan]...\"send_msg send\"..."); @verb chanobj:"send_msg send" this none this xdo @program chanobj:send_msg ":send_msg sends the actual message to all of the members."; msg = args[1]; for x in (this.members) x:tell(msg); endfor this:add_history(tostr($time_utils:time_sub("[$2/$t/$y|$H:$M:$S]"), " ", msg)); . ;return tostr("[bold][cyan]...view_auth..."); @verb chanobj:"view_auth" this none this xdo @program chanobj:view_auth "Coding for who will see this channel in @chanlist goes here. Defaults to Everybody."; return 1; . ;return tostr("[bold][cyan]...can_send..."); @verb chanobj:"can_send" this none this xdo @program chanobj:can_send "Determines if the player can send to that channel."; return (!this.frozen) ? 1 | 0; . ;return tostr("[bold][cyan]...Add_history..."); @verb chanobj:"add_history" this none this xdo @program chanobj:add_history msg = args[1]; if (length(this.history) < 15) this.history = {@this.history, msg}; else for b in [1..length(this.history)] if (b != length(this.history)) this.history[b] = this.history[b + 1]; else this.history[b] = msg; endif endfor endif . ;return tostr("[bold][cyan]...join_auth..."); @verb chanobj:"join_auth" this none this xdo @program chanobj:join_auth return 1; . ;return tostr("[bold][cyan]...Installation of Channel Object complete, creating innitial channels \"Wiz\", \"General\" and \"Mischan\"..."); ;return tostr("[bold][cyan]"); ;return tostr("[bold][cyan]...Creating General..."); @create $chanobj named [green]General[normal],general,gen,g ;return tostr("[bold][cyan]...General created, no verbs to write..."); ;return tostr("[bold][cyan]...Creating Wiz..."); @create $chanobj named [red]Wiz[normal],wizard,wiz,w,admin,adm,a ;return tostr("[bold][cyan]...Wiz created, writing verbs..."); @verb wiz:view_auth tnt xdo @program wiz:view_auth return player.wizard; . @verb wiz:join_auth tnt xdo @program wiz:join_auth return player.wizard; . ;return tostr("[bold][cyan]...Wiz verbs written..."); ;return tostr("[bold][cyan]...Creating Mischan..."); @create $chanobj named [bold][yellow]Mischan[normal],mischan,mis ;return tostr("[bold][cyan]...Mischan created, writing verbs..."); @verb mis:prelim*inary tnt xdo @program mis:prelim msg = args[2] == "+" ? ("[[bold][yellow]" + args[1] + " " + this:title() + "[normal]] * " + player:title() + " ") | ("[[bold][yellow]" + args[1] + " " + this:title() + "[normal]] " + player:title() + "> "); msg = msg + args[3]; this:send_msg(msg); . @verb mis:can_send tnt xdo @program mis:can_send return 0; . ;return tostr("[bold][cyan]...Mischan created..."); ;return tostr("[bold][cyan]...Creation of Basic Channels complete, writing Help Files..."); ;return tostr("[bold][cyan]"); ;return tostr("[bold][cyan]...Writing player help in $help.channels..."); @prop $help.channels {} rc @edit $help.channels del 1-$ enter Channels are an easy way to communicate with people all over the MOO in realtime, regardless of their location. Everybody on a channel can hear what everybody else on that channel is saying. They are a little like Chat Rooms. This may sound complicated now, but you'll get used to it, and eventually may even become dependant on it ;) There are 7 main commands you need to know: [[cyan]1[normal]] [green]= & +[normal] These commands are the base of the channel system. By typing = following by a channel's name or alias (there is a list of aliases in [green]@chanlist[normal]) will let you talk on that channel, while + allows you to emote on them. For instance, if Joebob wanted to say Hi to everybody on the General channel, he would type: [yellow]=new Hi![normal] Everybody on General (including you) sees [[green]General[normal]] JoeBob> Hi! On the other hand, if he wanted to emote waving, he would type this: [yellow]+new waves![normal] And just as before, everybody on General sees [[green]General[normal]] * JoeBob waves![normal] You can also use "directed chat" to a person on a channel, by typing [green]= ` [normal]. That is, if JoeBob wanted to say Hi to Clancy-Sue on the General channel, he would type [yellow]=gen `clancy-sue Hi![normal] And everybody sees [[green]General[normal]] JoeBob [to Clancy-Sue]> Hi! Alternativly, if he wanted to wave to her, he would type [yellow]+gen `Clancy-sue waves![normal] And everybody sees [[green]General[normal]] [to Clancy-Sue] * JoeBob waves! [[cyan]2[normal]] [green]@chanjoin [normal] You can't talk to people on a channel if you're not on it! Type @chanjoin to join that channel. You will then be able to talk to people and listen to what they say. [[cyan]3[normal]] [green]@chanleave [normal] Fairly self explanatory. By typing this you will leave a channel, and will not be able to listen to or talk with any of the people on it. [[cyan]4[normal]] [green]@chanlist[normal] Type this in order to get a list of all the channels available to you. It tells you the name, and all of the aliases. Channels you are on are indicated with a red star ([red]*[normal]). [[cyan]5[normal]] [green]@whochan [normal] Use this to find out who's on a certain channel. It displays their name (and number), and their status. At the bottom it tells you how many members are on the channel. [[cyan]6[normal]] [green]@chanwho [normal] This useful command lets you see what channels is on. [[cyan]7[normal]] [green]@history [normal] The final command, @history, allows you to view the last 15 things said on a channel. Very useful if you move quickly through a number of rooms and lose what somebody has said, or if you're reading your mail and want to be able to view what has been said without scrolling up. Just type [green]@history [normal]. And that's all! Easy, huh? You'll get used to the channel system very quickly, since it's used in everyday MooLife. . save done ;return tostr("[bold][cyan]...Writing programmers help in $help.channel-programming..."); @prop $help.channel-programming {} rc @edit $help.channel-programming del 1-$ enter [yellow]Here is a list of all the verbs on the Channel System and Channel Object explained in detail:[normal] [bold][cyan]Channel System Verbs:[normal] [[cyan]1[normal]] [green]"=* +*"[normal] This player-callable verb is responsible for letting the player send a message to the channel. The *s make it so that anything immediatly following = or + is treated as the name of the desired channel, and the arguments are sent to that channel. If the channel does not exist, the message is sent to a channel named "Mischan." If you wish to change the name of the channel it should send to, edit this line in $chansys:= "return this:get_chan("Mischan"):preliminary(verb[2..$], verb[1], argstr); Simply change the name of "Mischan" to the channel of your choice. If you wish to completely remove this feature, do the following: @program $chansys:= chan = 0; for y in (children($chanobj)) if (verb[2..$] in y.aliases) chan = y; endif endfor if (chan == 0) return player:tell("No channel with that name or alias exists."); endif if (!chan:can_send()) return player:tell($string_utils:pronoun_sub(chan.cant_send_msg)); endif chan:prelim(verb[1], argstr); . This will display the message "No channel with that name or alias exists." when a player tries to call a channel that doens't exist. [[cyan]2[normal]] [green]@chanjoin /join[normal] Players call this to join a channel. It checks that the argument is the name or alias of a channel, and adds them to that channel's .members list if it is; if it isn't, it returns an error message. [[cyan]3[normal]] [green]get_chan[normal] Non-player-callable verb which lets you find a channel by matching it's alias or name to a string. [cyan]$chansys:get_chan("General")[normal] will return one of two things: If "General" exists, it will return that channel's object number; if there is no channel named "General," it will return 0. [[cyan]4[normal]] [green]@chanlist /list[normal] Player-callable verb for seeing all channels. The @chanlist verb does not display channels that they are not authorized to view (determined by :view_auth in $chanobj). A red start beside the channel's name means that the player is on that channel. [[cyan]5[normal]] [green]@whochan[normal] Player-callable verb for seeing who is on a specific channel, specified in args[1]. If args[1] is not a valid channel (determined by :get_chan), an error message is returned. Otherwise, a list of players and their statuses is given. [[cyan]6[normal]] [green]@chanf*reeze[normal] Wizard-callable verb for "freezing" a channel. When a channel is frozen, no *player* may send to it -- other verbs and may still send messages through it. Do not confuse this with the :can_send verb, which determines whether a player can send to a channel and is used for determining who can send to that channel, if anybody. It's more practical to use :can_send to make a channel completely unsendable, and @chanfreeze to lock a channel for a short period of time. [[cyan]7[normal]] [green]@chanwho[normal] Player-callable verb for seeing what channels valid player args[1] is on (it will only display channels the player would be able to see in @chanlist (determined in :view_auth)). [[cyan]8[normal]] [green]@history[normal] Player-callable verb for seeing the last 15 things run through :send_msg() in the channel object. :add_history on the channel object is responsible for regulating the history. [[cyan]9[normal]] [green]is_channel[normal] Non-player-callable verb for checking if object args[1] is a descendant of $chanobj, and thus a channel object. [[cyan]10[normal]] [green]@chanc*eck[normal] Wizard-callable verb for checking two things. First, whether all the objects on a channel object args[1] .members list are valid, and second, for checking if they're all players. [bold][cyan]Channel Object Verbs:[normal] [[cyan]1[normal]] [green]prelim*inary[normal] Non-player-callable verb, called from =* or +*, which takes the arguments from a player's =/+ verb and compiles them into a readable format. It is responsible for the following: [Channel] Player> Normal text. [Channel] * Player emoted text. [Channel] Player [To Other_Player]> Directed channel talk [Channel] [To Other_Player] * Player emotes directed channel talk. [[cyan]2[normal]] [green]send_msg send[normal] Non-player-callable verb, called by preliminary(), which a) passes the message on to the members of the channel's .members list, and b) calls add_history, to add the text to the channel's .history list property. [[cyan]3[normal]] [green]can_send[normal] Non-player-callable verb, called to check if a player can send to the channel. [[cyan]4[normal]] [green]add_history[normal] Non-player-callable verb, called by send_msg() to add the text to the history. It makes sure that there are no more than 15 poses recorded. If the list is at 15 and another piece of text comes in through send_msg, it deletes .history[1], shifts all the others down (history[2] becomes history[1], history[3] becomes history[2], etc), and adds the new text. [[cyan]5[normal]] [green]join_auth[normal] Non-player-callable verb determining whether a player can join a channel or not. . save done ;return tostr("[bold][cyan]...Writing of help files complete. Your channel system is now fully installed."); ;return tostr("[bold][cyan]Type @chanjoin General to join the General Channel now.");