@Parent Organizer

A way for games to organize all their parents. Lets you create categories and see how full/empty each is.

Author: T'Eval
Category: Globals
Commands: @create, @nuke, @pemit, @switch.
Compatibility: CobraMUSH, PennMUSH.

Instructions

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

MUSHCode for @Parent Organizer

@create @parents
&CMD_ADD @parents=$@parents/add */*/*:th [switch(u(is_wiz,%#),0,[pemit(hr,You are not a wizard, sorry.)],1,[switch(u(isgroups,[secure(%0)]),1,[setq(1,[u(me/groups,[secure(%0)])])][set([r(1)],PARENT_[edit(squish(secure(%1)),[space(1)],_)]:[secure(%2)])][pemit(%#,[ansi(hy,Added parent [secure(%1)] <[secure(%2)]> to group [name(r(1))])])],[pemit(%#,[ansi(hr,That is not a valid group)])])])]
&CMD_ADDGROUP @parents=$@parents/addgroup *:th [switch([u(is_wiz,%#)],0,[pemit(hr,You are not a wizard, sorry.)],1,[switch(u(isgroups,[secure(%0)]),1,[pemit(%#,[ansi(hr,That group already exists)])],[create(secure(%0))][pemit(%#,Group [secure(%0)] created)])])]
&CMD_CREDITS @parents=$@parents/credits:@pemit %#=[ansi(hy,@parents system, coded by T'Eval @ Star Trek: Rules of Acquisition.)]
&CMD_HELP @parents=$@parents/help:@switch [u(is_wiz,%#)]=0,@pemit %#=[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])]%r%r[ansi(hy,Help File)]%r%r[ansi(hw,[ljust(@parents,45)]- Lists the current groups%r[ljust(@parents <group>,45)]- Lists the Parents inside a group%r)],1,th [pemit(%#,[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])]%r%r[ansi(hy,Help File)]%r%r[ansi(hw,[ljust(@parents,45)]- Lists the current groups%r[ljust(@parents <group>,45)]- Lists the Parents inside a group%r[ljust(@parents/addgroup <group name>,45)]- Adds a group%r[ljust(@parents/remgroup <group name>,45)]- Removes a group%r[ljust(@parents/add <group>/<parent name>/<dbref>,45)]- Add an entry to a group%r[ljust(@parents/rem <group>/<parent name>,45)]- Remove a parent from a group)]%r%r[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])]
&CMD_PARENTS @parents=$@parents:th [pemit(%#,[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])]%r%r[center([ansi(hy,Parents category list for [mudname()])],79)]%r%r[u(me/disp_category)]%r%r[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])])]
&CMD_PARENTS_2 @parents=$@parents *:th [setq(1,[u(me/groups,[secure(%0)])])][switch([r(1)],#*,[pemit(%#,[ansi(hb,[center(\[[ansi(hy,[name(r(1))])]\],39,=)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])]%r%r[u(me/disp_list,[r(1)])]%r%r[ansi(hb,[repeat(=,39)][center([ansi(hy,[ansi(hb,\[)]@parents[ansi(hb,\])])],40,=)])])],,[pemit(%#,[ansi(hr,No such @parents category)])]
&CMD_REM @parents=$@parents/remgroup *:@switch [u(is_wiz,%#)]=0,@pemit %#=[ansi(hr,You are not a wizard, sorry.)],1,{@switch [u(isgroups,[secure(%0)])]=1,{@nuke [u(me/groups,[secure(%0)])];@nuke [u(me/groups,[secure(%0)])];@pemit %#=[ansi(hr,Group [secure(%0)] cleared)]},@pemit %#=[ansi(hr,That is not a valid group)]}
&CMD_REM2 @parents=$@parents/rem */*:th [switch([u(is_wiz,%#)],0,[pemit(hr,You are not a wizard, sorry.)],1,[switch([u(isgroups,[secure(%0)])],1,[setq(1,[u(me/groups,[secure(%0)])])][switch([get(r(1)/PARENT_[secure(%1)])],,[pemit(%#,[ansi(hr,No such parent)])],[pemit(%#,[ansi(hr,[secure(%1)] cleared from group [secure(%0)])])][wipe([r(1)]/PARENT_[secure(%1)])])],[pemit(%#,[ansi(hr,That is not a valid group)])])])]
&DB_CAT @parents=#5712
&DISP_CATEGORY @parents=[space(1)][iter(lcon(me),[ansi(hr,[ljust(name(##),24)]\[[items([lattr(##/parent_*)], )]\])]%r)]
&DISP_LIST @parents=[ansi(hr,ljust(name(%0),20)[space(4)]\[[items([lattr(%0/parent_*)], )]\])]%r%r[space(1)][ansi(hy,[iter(lattr(%0/parent_*),[space(5)][ljust([capstr(lcstr([edit([edit(##,PARENT_,)],_,[space(1)])]))],40)][secure([get(%0/##)])]%r)])]
&GROUPS @parents=[first([iter(lcon(me),[switch([strmatch(name(##),*%0*)],1,##)])])]
&ISGROUPS @parents=[first([iter(lcon(me),[switch([strmatch(name(##),[secure(%0)])],1,1)])])]
&IS_WIZ @parents=or(hasflag(%0,Wizard),hasdevflags(%0,Wizard))