@@ This is a very simple +News/+Help system. @@ @@ Minimal text replacement is required to quote this code into a MUSH. @@ @@ Replace with the dbref of the object the mortal @@ commands will live on. @@ @@ Replace with the dbref of the object the news contents @@ will live on. It should be accessible to for evaluation. @@ @@ Replace with the dbref of the object the admin commands @@ will live on. It should have permissions to modify attributes on @@ and be use locked to prevent unauthorized use of the @@ commands. This can also be accomplished by modifying the commands to perform @@ a check for user permissions. @@ @@ The admin commands are very basic and do not provide any safeguards against @@ accidental replacement of existing topics or entries. @@ @@ The addtopic and addnews will only work on PennMUSH 1.8.1p6 or later. @@ @@ Topics can manually be added by adding them to the | separate list stored in @@ the TOPICS attribute on and setting a DESC` @@ attribute on containing the short description of the topic. @@ should have any spaces replaced with a _. @@ @@ Entries can be manually added by setting a NEWS` containing the @@ unevaluated contents to be displayed for the entry. should have @@ any spaces repalced with a _. @@ @@ Entries can be hidden from the results of a +Keyword search by adding them @@ to the HIDDENENTRIES attribute on the . @@ @@ Copyright (c) 1998-2008 Ervin Hearn @@ @@ Permission is hereby granted, free of charge, to any person @@ obtaining a copy of this software and associated documentation @@ files (the "Software"), to deal in the Software without @@ restriction, including without limitation the rights to use, @@ copy, modify, merge, publish, distribute, sublicense, and/or sell @@ copies of the Software, and to permit persons to whom the @@ Software is furnished to do so, subject to the following @@ conditions: @@ @@ The above copyright notice and this permission notice shall be @@ included in all copies or substantial portions of the Software. @@ @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, @@ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES @@ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR @@ OTHER DEALINGS IN THE SOFTWARE. @@ &DATA`NEWSARCHIVE = &CMD`NEWS =$^\+(News|Help)$:@pemit/s %#=%r[repeat(=,78)]%R[center(--= [ansi(h,mudname() News)] =--,78)]%r[repeat(=,78)]%r[iter(get(v(DATA`NEWSARCHIVE)/TOPICS),[ljust(capstr(itext(0)),14)][ljust(center(%b--==--,10),10)][capstr(u(v(DATA`NEWSARCHIVE)/DESC`[edit(itext(0),%b,_)]))],|,%r)]%r%rFor more information on these topics see: [ansi(h,+News )]%r[repeat(=,78)]%r @set /CMD`NEWS=regexp &CMD`NEWS-TOPIC =$^\+(News|Help) (.+)$:@switch [hasattr(v(DATA`NEWSARCHIVE),NEWS`[edit(%2,%b,_)])]=1,@pemit/s %#=%r[repeat(=,78)]%r[center(--= [ansi(h,mudname() News for [ucstr([edit(%2,_,%b)])])] =--,78)]%r[repeat(=,78)]%r[wrap(u(v(DATA`NEWSARCHIVE)/NEWS`[edit(%2,%b,_)]),78)]%r[repeat(=,78)]%r,@pemit/s %#=[ansi(h,News:)] That isn't a News Topic! @set /CMD`NEWS-TOPIC=regexp &CMD`KEYWORD =$+Keyword *:@pemit/s %#=[repeat(=,78)]%r[center(News Topics Referencing: [ansi(h,[ucstr(itemize(%0,&,&,))])],78)]%r[repeat(=,78)]%r[table(%b[squish(iter(%0,[iter(setdiff(setunion([iter([lattr(v(DATA`NEWSARCHIVE)/NEWS`*)],[switch([itext(0)],*[edit([itext(1)],%b,_)]*,[itext(0)])])],[grepi(v(DATA`NEWSARCHIVE),NEWS`*,[itext(0)])]),get(v(DATA`NEWSARCHIVE)/HIDDENENTRIES)),[edit([after([itext(0)],NEWS`)],_,%b)]|)],&))],24,78,|)]%r[repeat(=,78)]%r &CMD`ADDTOPIC =$+Addtopic *=*:@set v(DATA`NEWSARCHIVE)=TOPICS:[trim(sort(get(v(DATA`NEWSARCHIVE)/TOPICS)|%0,,|),|)];@set v(DATA`NEWSARCHIVE)=DESC`[edit(%0,%b,_)]:[decompose(%1)];@pemit/s %#=Topic [ansi(h,%0)] has been added with a description of: %1 &CMD`ADDNEWS =$+Addnews *=*:@set v(DATA`NEWSARCHIVE)=NEWS`[edit(%0,%b,_)]:[decompose(%1)];@pemit/s %#=News entry [ansi(h,%0)] was added with content:%r%r%1 &NEWS`+KEYWORD =This command allows you to list all news topics which contain a specified keyword or keywords. Multiple Keywords may be searched for by separating them with an ampersand (&).%r%rExample: [ansi(h,+Keyword coding&example)]%r%rThis can become rather lengthy when checking for ambiguous letter combinations or common words.%r%rSyntax: [ansi(h,+Keyword )]%rSyntax: [ansi(h,+Keyword <1st Keyword>&<2nd Keyword>&)] &NEWS`ADDTOPIC =This command allows game administrators to add new topics with a short description to the news system main menu. Short descriptions can contain ansi and other code if desired.%r%rSyntax: [ansi(h,+addtopic =)] &NEWS`ADDNEWS =This command allows game administrators to add new entries to the news system. Entry names can contain spaces or any other characters allowed in attribure names. The entry contents are stored in an unevaluated form, allowing code to be used in the entry if desired.%r%rSyntax: [ansi(h,+Addnews =)]