Personal Bulletin Board System

A personal bulletin board system, with the commands '+list', '+read' and '+post'.

Category: Bulletin Board
Compatibility: PennMUSH, TinyBit, TinyMUX.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Personal Bulletin Board System

@create PARENT: Personal BBoard System=10
&CMD_BBHELP PARENT: Personal BBoard System=$+bhelp:th [pemit(%#,[center(%bPersonal BBoard System Help%b,78,-)]%R+list - Lists the current messages; maximum of 20.%R%R+read <#> - Reads a message #.%R%R+post <header>=<body> - writes to the bboard; when it reaches the maximum of 20, any after that will overwrite from 1 to the end again.%R[repeat(-,78)])]
&CMD_LIST PARENT: Personal BBoard System=$+list:th [pemit(%#,[center(%bBBoard System: Post List%b,78,-)]%R[ljust(Msg,5)][ljust(Title,40)][ljust(Author,30)]%R[repeat(-,78)]%R[iter([sort([lattr(%!/msgs_*)])],[ljust([after(##,_)],5)][ljust([elements([xget(%!,##)],1,|)],40)][ljust([elements([xget(%!,##)],3,|)],30)],,%R)]%R[center(%b+read <#> to read a message%b,78,-)])]
&CMD_POST PARENT: Personal BBoard System=$+post *=*:th [set(%!,msgs_[u(%!/current_msg)]:%0|%1|[name(%#)])][set(%!,current_msg:[switch([u(%!/current_msg)],20,1,[inc([u(%!/current_msg)])])][pemit(%#,You post a message, [iter(%0,[capstr(##)])].)]
&CMD_READ PARENT: Personal BBoard System=$+read *:th [ifelse([and([isnum(%0)],[member([lnum(1,[u(msg_limit)])],%0)])],[pemit(%#,[center(Bboard System,78,-)]%R[ljust(Title:,8)][ljust([elements([u(msgs_%0)],1,|)],30)][ljust(Author:,10)][ljust([elements([u(msgs_%0)],3,|)],30)]%R[repeat(-,78)]%R[elements([u(msgs_%0)],2,|)]%R[repeat(-,78)])],[pemit(%#,Invalid input.)]
&CMD_SETUP PARENT: Personal BBoard System=$+setup:th [if([hasattr(%!,setup)],[pemit(%#,You've already set up this bboard!)],[set(%!,current_msg:1)][set(%!,setup:1)][set(%!,describe:[center(Personal BBoard System,78,-)]%R%TA computer terminal\, with various commands for posting messages.%R[center(Type +bhelp for a list of commands.,78,-)])][pemit(%#,You setup the bbsystem. It's ready to go!)])]
&CURRENT_MSG PARENT: Personal BBoard System=1
@Desc PARENT: Personal BBoard System=%R%TA personal bboard sysem, created by Bahamut@Gateway/Bahamut@M*U*S*H/Return X@MVC. It works as a parent object, so it can sit in this room without you having to @decomp or @clone the object. Can be useful for various things; originally coded to be used as a sub-global-bboard in a ZMO on a freebuild MUSH. To use this bboard system:%R%R@create <your bboard>%R@set <bboard>=!no_command%R@parent bboard=[num(%!)]%R+setup%R%RThat's it. Enjoy! Also, feel free to @decomp it and use it wherever you want; just make sure the credits stay intact please.
@set PARENT: Personal BBoard System/Desc = visual
&MSG_LIMIT PARENT: Personal BBoard System=20
@set PARENT: Personal BBoard System=LINK_OK
@set PARENT: Personal BBoard System=COMMANDS
@set PARENT: Personal BBoard System=!NO_COMMAND