Useful for area NPCs, adoptables, or whatever. The help files included here are aimed at NPC candidates, but it should be pretty clear what to change and where to make it useful for anything else. You can add and remove 'SET' options as well.
UPDATED! I added Iprefs and Injury as set options for candidates, Iprefs being Impression Preferences and Injury a Yes/No option to say if the creator is OK with their NPC getting hurt on the sands. I also improved +npc/view to include creator information and added the ability to call the deletion history so staff and see who did what without having to set anything VISUAL.
Details
Command List:
- +npc/help
- +npc/help <topic> (add, set, wyska, view, del)
- +npc/add <name>
- +npc/set <name>/<attribute>=<text> (coded with Age, Sex, Position, From, Iprefs and Injury)
- +npc/wyska <name>=<text>
- +npc/view <name>
- +npc/del <name>
- +npc/history
+npc/add verifies that no NPC already exists with the chosen name; if one is found, an error message is generated explaining the problem.
The rest of the commands verify that there is a matching NPC loaded in the database before they execute. If the NPC doesn't exist, an error message is generated.
+npc/add and +npc/del both record successful use of these commands for staff auditing purposes, since I couldn't figure out how to lock the 'del' function to a group instead of an individual. The history of removals is accessed through '+npc/history'; each NPC file lists the creation date/time and who made the NPC.
The Code
Instructions:
Copy and paste the entire code into a word document (notepad works!), then use the 'Replace All' function (usually hot-keyed as Ctrl-H) to replace all instances of <DBREF> with the DBref# of the object you created to hold the code. Which means you need to make the object first, yes. :)
@Desc <DBREF>=%r[center(NPC CANDIDATE DATABASE,80,-)]%rThis is an easy-to-update list of NPC candidates currently at Xanadu Weyr. Feel free to add new candidates! Please use '+npc/help' for instructions on using this object.%r%r[center(CANDIDATE LIST,80,-)]%R[ljust(Name:,16)][ljust(Age:,35)][ljust(Gender:,8)][ljust(Position:,16)][ljust(From:,5)]%r[parse(lattr(<DBREF>/cand-*),u(##),,%r)]%r[repeat(-,80)]
&CMD_NPC_HELP <DBREF>=$+npc/help:@pemit %#=[u(<DBREF>/npc_help)]
&NPC_HELP <DBREF>=[center(NPC CANDIDATE DATABASE: HELP,80,-)]%r[ljust(Command:,40)][ljust(Help File:,40)]%r[ljust(+npc/add <NAME>,40)][ljust(See +npc/help add,40)]%r[ljust(+npc/set <NAME>/<ATTRIBUTE>=<FOO>,40)][ljust(See +npc/help set,40)]%r[ljust(+npc/wyska <NAME>=<FOO>,40)][ljust(See +npc/help wyska,40)]%r[ljust(+npc/view <NAME>,40)][ljust(See +npc/help view,40)]%r%r[ljust(+npc/del <NAME>,40)][ljust(See +npc/help del,40)]%r[ljust(+npc/history,40)][ljust(Displays deletion history,40)]%r%rCredits: Programmed by Moria at Xanadu Weyr on PernWorld MUSH.%r[repeat(-,80)]
&CMD_NPC_HELP_ADD <DBREF>=$+npc/help add:@pemit %#=[u(<DBREF>/npc_help_add)]
&NPC_HELP_ADD <DBREF>=[center(NPC CANDIDATE DATABASE: HELP - ADD,80,-)]%rSyntax:%r+npc/add <NAME>%r%rDefinitions:%rAdds an NPC candidate to the reference list under NAME. NAME must be a single word containing only letters and should be no more than 15 letters long. This will be the permenant name of the candidate in the NPC database, so please be careful when adding a candidate that you have the name spelled correctly!%r%rExample:%r'+npc/add Testy' would create a candidate listing for Testy.%r[repeat(-,80)]
&cmd_npc_add <DBREF>=$+npc/add *:@switch/first 1=sign(match(lattr(<DBREF>/cand-*),cand-%0)),@pemit %#=Candidate "%0" already exists.,{&added-%0 <DBREF>=%0 was added on [time()] by %N(%#).;&cand-%0 <DBREF>=\[ljust(capstr(%0),16)]\[ljust(\[age(u(<DBREF>/%0-AGE))],35)]\[ljust(capstr(\[u(<DBREF>/%0-SEX)]),8)]\[ljust(capstr(\[u(<DBREF>/%0-POSITION)]),16)]\[ljust(capstr(\[u(<DBREF>/%0-FROM)]),5)];@pemit %#=Candidate "%0" added successfully. Please take care of the SET and WYSKA commands for this candidate now!}
&CMD_NPC_HELP_SET <DBREF>=$+npc/help set:@pemit %#=[u(<DBREF>/npc_help_set)]
&NPC_HELP_SET <DBREF>=[center(NPC CANDIDATE DATABASE: HELP - SET,80,-)]%rSyntax:%r+npc/set <NAME>/<ATTRIBUTE>=<FOO>%r%rDefinitions:%rSets the selected ATTRIBUTE for NAME to FOO.%r%rValid attributes are:%r[ljust(AGE,20)][ljust(Candidate's Age in birthsecs**,60)]%r[ljust(SEX,20)][ljust(Candidate's Gender \(Male or Female\),60)]%r[ljust(POSITION,20)][ljust(Candidate's Job - 15 character maximum,60)]%r[ljust(FROM,20)][ljust(Candidate's Home - 3-letter Alias,60)]%r[ljust(IPREFS,20)][ljust(Impression Prefs - Stand Only or a list of colors,60)]%r[ljust(INJURY,20)][ljust(Yes or No to indicate if candidate may be hurt on the sands,60)]%r%rOther fields may be added upon request, but for now any other key data should be included in the WYSKA.%r%rExample:%r'+npc/set Testy/sex=Male' would set Testy's gender to Male.%r%rNOTE: Please set age using birthsecs, so the candidate will automatically age appropriately over time! Use '+time/age <# of Turns>' to get the number you need. :)%r[repeat(-,80)]
&cmd_npc_set <DBREF>=$+npc/set */*=*:@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. Please ADD the candidate first!},match(age sex position from iprefs injury,%1),{@pemit %#=%1 is not a valid SET category. Please review '+npc/help set' and try again.},{&%0-%1 <DBREF>=%2;@set <DBREF>/%0-%1=VISUAL;@pemit %#=Candidate %0's %1 has been set to: %2.}
&CMD_NPC_HELP_WYSKA <DBREF>=$+npc/help wyska:@pemit %#=[u(<DBREF>/npc_help_wyska)]
&NPC_HELP_WYSKA <DBREF>=[center(NPC CANDIDATE DATABASE: HELP - WYSKA,80,-)]%rSyntax:%r+npc/WYSKA <NAME>=<FOO>%r%rDefinitions:%rSets the What You Should Know About (WYSKA) for NAME. Be sure to include general description and personality info, as well as any relevant background details. If the NPC has a webpage, link it here. Be as short or verbose as you like.%r%rExample:%r'+npc/WYSKA Testy=Tall, slender, stuck-up, born and raised at Xanadu Weyr, searched for Avaeth and Dhonzayth's clutch, has been a candidate ever since, something of a troublemaker, works as a stablehand when there isn't a clutch on the sands.'%rThis would set Testy's WYSKA to:%rTall, slender, stuck-up, born and raised at Xanadu Weyr, searched for Avaeth and Dhonzayth's clutch, has been a candidate ever since, something of a troublemaker, works as a stablehand when there isn't a clutch on the sands.%r[repeat(-,80)]
&cmd_npc_wyska <DBREF>=$+npc/wyska *=*:@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. Please ADD the candidate first!},{&%0-WYSKA <DBREF>=%1;@set <DBREF>/%0-WYSKA=VISUAL;@pemit %#=Candidate %0's WYSKA has been set to:%r%1.}
&CMD_NPC_HELP_DEL <DBREF>=$+npc/help del:@pemit %#=[u(<DBREF>/npc_help_del)]
&NPC_HELP_DEL <DBREF>=[center(NPC CANDIDATE DATABASE: HELP - DEL,80,-)]%rSyntax:%r+npc/del <NAME>%r%rDefinitions:%rDeletes the candidate and all set attributes/WYSKA from the NPC Candidate Database. This is not undoable, so make sure you really want to delete the candidate before doing so! Malicious abuse of this command will have consequences!%r%rExample:%r'+npc/del Testy' will delete Testy and all his data from the database.%r[repeat(-,80)]
&cmd_npc_del <DBREF>=$+npc/del *:@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. You can't delete someone who isn't here!},{&del_history <DBREF>=[u(<DBREF>/del_history)]%r%N(%#) deleted %0 on [time()]%r[u(<DBREF>/added-%0)];&cand-%0 <DBREF>=;&%0-AGE <DBREF>=;&%0-SEX <DBREF>=;&%0-POSITION <DBREF>=;&%0-FROM <DBREF>=;&%0-WYSKA <DBREF>=;&ADDED-%0 <DBREF>=;@pemit %#=You have succesfully deleted %0 from the candidate database. This action has been logged.}
&cmd_npc_help_view <DBREF>=$+npc/help view:@pemit %#=[u(<DBREF>/npc_help_view)]
&NPC_HELP_VIEW <DBREF>=[center(NPC CANDIDATE DATABASE: HELP - VIEW,80,-)]%rSyntax:%r+npc/view <NAME>%r%rDefinitions:%rDisplays the selected candidate and all set attributes/WYSKA stored for the candidate in a nice, easy-to-read format, as well as listing creator information.%r%rExample:%r'+npc/view Testy' will display a lot of crazy stuff!%r[repeat(-,80)]
&cmd_npc_view <DBREF>=$+npc/view *:@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. You can't view someone who isn't here!},{@pemit %#=[center(NPC CANDIDATE DATABASE: VIEW - [capstr(%0)],80,-)]%r[ljust(Candidate Name: [capstr(%0)],40)][ljust(Gender: [capstr([u(<DBREF>/%0-SEX)])],40)]%r[ljust(Age: [age(u(<DBREF>/%0-AGE))],40)][ljust(Position: [capstr([u(<DBREF>/%0-POSITION)])],40)]%r[ljust(From: [capstr([u(<DBREF>/%0-FROM)])],40)]%r%rWhat You Should Know About [capstr(%0)] (WYSKA):%r[capstr([u(<DBREF>/%0-WYSKA)])]%r%rImpression Preferences: [capstr([u(<DBREF>/%0-IPREFS)])]%rInjury OK?: [Capstr([u(<DBREF>/%0-INJURY)])]%r%rCreated By:%r[capstr([u(<DBREF>/ADDED-%0)])]%r[repeat(-,80)]}
&CMD_NPC_HISTORY <DBREF>=$+npc/history:@pemit %#=[center(NPC CANDIDATE DATABASE: DELETION HISTORY,80,-)]%r[u(<DBREF>/del_history)]%r[repeat(-,80)]
To Make Changes
To add or remove a SET option, you may need to edit either three or five sections of the Database, depending on if you change the options used in the NPC list in the @desc.
To change a primary (@desc listed) SET option:
1) In @desc:
[ljust(Name:,16)][ljust(Age:,35)][ljust(Gender:,8)][ljust(Position:,16)][ljust(From:,5)]
Rename and re-align the headers for what information you want in the listing. You will need to make sure each header has at least one more spacing allocated to it than the maximum text entry allowed to keep the columns from running together.
2) In CMD_NPC_ADD:
&cand-%0 <DBREF>=\[ljust(capstr(%0),16)]\[ljust(\[age(u(<DBREF>/%0-AGE))],35)]\[ljust(capstr(\[u(<DBREF>/%0-SEX)]),8)]\[ljust(capstr(\[u(<DBREF>/%0-POSITION)]),16)]\[ljust(capstr(\[u(<DBREF>/%0-FROM)]),5)]
Syncronize the options here with your selected @desc options, and make sure the spacings match! Otherwise, you will have a right big mess on your hands.
3) In NPC_HELP_SET,
Valid attributes are:%r[ljust(AGE,20)][ljust(Candidate's Age in birthsecs**,60)]%r[ljust(SEX,20)][ljust(Candidate's Gender \(Male or Female\),60)]%r[ljust(POSITION,20)][ljust(Candidate's Job - 15 character maximum,60)]%r[ljust(FROM,20)][ljust(Candidate's Home - 3-letter Alias,60)]%r[ljust(IPREFS,20)][ljust(Impression Prefs - Stand Only or a list of colors,60)]%r[ljust(INJURY,20)][ljust(Yes or No to indicate if candidate may be hurt on the sands,60)]
Here, you need to update the help file description of each SET option that you changed. Make sure that any that aren't in @desc are still listed here so they are known and can be used. :) Attributes should always be a single word in length or they will not work as part of the command list.
4) In CMD_NPC_SET
@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. Please ADD the candidate first!},match(age sex position from iprefs injury,%1),{@pemit %#=%1 is not a valid SET category. Please review '+npc/help set' and try again.}
In the second match section, list all the attribute names you have entered in the SET help file. Again, attribute names must be one word long.
4) In CMD_NPC_VIEW
&cmd_npc_view <DBREF>=$+npc/view *:@switch/first 0=sign(match(lattr(<DBREF>/cand-*),cand-%0)),{@pemit %#=Candidate "%0" does not exist. You can't view someone who isn't here!},{@pemit %#=[center(NPC CANDIDATE DATABASE: VIEW - [capstr(%0)],80,-)]%r[ljust(Candidate Name: [capstr(%0)],40)][ljust(Gender: [capstr([u(<DBREF>/%0-SEX)])],40)]%r[ljust(Age: [age(u(<DBREF>/%0-AGE))],40)][ljust(Position: [capstr([u(<DBREF>/%0-POSITION)])],40)]%r[ljust(From: [capstr([u(<DBREF>/%0-FROM)])],40)]%r%rWhat You Should Know About [capstr(%0)] (WYSKA):%r[capstr([u(<DBREF>/%0-WYSKA)])]%r%rImpression Preferences: [capstr([u(<DBREF>/%0-IPREFS)])]%rInjury OK?: [Capstr([u(<DBREF>/%0-INJURY)])]%r%rCreated By:%r[capstr([u(<DBREF>/ADDED-%0)])]%r[repeat(-,80)]}
Adjust to list attributes in chosen order and location. Make sure you keep the spacing within the line length cutoff of your game, or your text will wrap to the next line and not look nearly as tidy.
For changes not involving @desc attributes, just do steps 3-5.
Credits
Please always include the following in the +npc/help file:
NPC Database designed by Moria@PernWorldMUSH and used with her permission.
Adjustments made for local use by (YourName).
Inspired by Natishen's Adoptables object, but written entirely from scratch by me! His object is way more tidy and colorful, but hey, this works for what I wanted it to do. :)