-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCORE 04 - Help System.txt
92 lines (56 loc) · 8.12 KB
/
CORE 04 - Help System.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@@ Core
@cmdquota me=99999
@skip isdbref(tag(setr(1,help_db)))={@assert/inline isdbref(tag(stor))=@pemit %#=ERROR: No storage object set!;@assert/inline isdbref(setr(0,create(Help Database,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE NO_COMMAND;@tag/add %q1=%q0;@tel %q0=#stor}
@skip isdbref(tag(setr(1,help)))={@assert/inline isdbref(globalroom())=@pemit %#=ERROR: No global room set!;@assert/inline isdbref(setr(0,create(Help System,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE !NO_COMMAND;@tag/add %q1=%q0;@tel %q0=[globalroom()]}
&CMD.HELP #help=$^(?s)(?\:\+)(help|shelp)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:=(.+?))?$:@attach %!/START=%1,%2,%3,%4
@set #help/CMD.HELP=regexp
&SWITCHES.0 #help=
&SWITCHES.5 #help=HELP|ADD|CATEGORY|RENAMECATEGORY|RENAME|DELETE|SUMMARY
&SWITCHES.6 #help=DELETECATEGORY
&INIT.HELP #help=th setq(!,HELP,root);th setq(!,+help,cmd);th setq(!,plushelp,txtfile)
&INIT.SHELP #help=@assert/inline gtebittype(%#,4)=@pemit %#=error();th setq(!,SHELP,root);th setq(!,+shelp,cmd);th setq(!,staffhelp,txtfile)
&START #help=@attach %!/INIT.%0;@if %q<txtfile>=th setq(!,setr(!,trim(setdiff(if(!strmatch(setr(!,textfile(%q<txtfile>,*,1,1,|),rawlegacy),Sorry*),%q<rawlegacy>),help,|,|,i),b,|),legacy),legacy);@attach #inc/GET_SWITCH=%1;@attach %!/SW.[strfirstof(%q<switch>,MAIN)]=trim(%2),trim(%3)
&SW.MAIN #help=@if strlen(%0)={@attach %!/INC.VIEW_FILE},{@attach %!/INC.VIEW_CATEGORIES};@pemit %#=footer(%q<cmd>/help for help)
&INC.VIEW_CATEGORIES #help=@pemit %#=header(mudname() %q<cmd> Categories);@dolist/inline/delimit | [u(FN.CATEGORIES,%q<root>)]={@pemit %#=subheader(%d0);@pemit %#=columns(u(FN.FILE_NAMES,%q<root>,%d0),26,3,,,1,,%b,,1,|,,1)};@if words(%q<legacy>,|)={@pemit %#=subheader(Legacy %q<cmd> Files);@pemit %#=columns(%q<legacy>,14,5,,,,,%b,,1,|,,1)}
&INC.FIND_FILE #help=@assert/inline words(setr(!,listunion(u(FN.FILE_NAMES,%q<root>),if(%2,%q<legacy>),|,|),files),|)=@pemit %#=There are no files!;@attach #inc/PARTIAL=%0,%q<files>,|,%1,file;th setq(!,0,islegacy);@if cand(%2,match(%q<legacy>,r(%1),|))={th setq(!,1,islegacy)},{th setq(!,get(#help_db/[u(FN.HASH,%q<root>,r(%1))]_CATEGORY),category)}
&INC.VIEW_FILE #help=@attach %!/INC.FIND_FILE=%0,file,1;@if %q<islegacy>={@dynhelp/parse %q<txtfile>/%q<file>=%#},{@pemit %#=header(mudname() %q<cmd>: %q<file>);th setq(!,get(#help_db/[u(FN.HASH,%q<root>,%q<file>)]_ENTRY),data);@pemit %#=if(hasattr(%q<data>),ulocal(%q<data>,%#),%q<data>)}
&SW.HELP #help=@pemit %#=header(Staff %q<cmd> Commands);@pemit %#=u(HLP_INTERNAL);@pemit %#=footer()
&HLP_INTERNAL #help=[ansi(hc,Administrator Commands)]%R%R[ansi(h,%q<cmd>/add <category>/<filename>=<#dbref/attribute>|<text>)]%R%TCreates or update a helpfile AND the respective category if it does not exist. The given attribute will be ulocal(<path>,%%#)'d for retrieval. If that fails, it's displayed as raw text.%R%R[ansi(h,%q<cmd>/category <filename>=<category>)]%R%TRe-Assign a helpfile to a different category.%R%R[ansi(h,%q<cmd>/renamecategory <category>=<new name>)]%R%TRe-assign all helpfiles of a given category to a new or existing one.%R%R[ansi(h,%q<cmd>/rename <filename>=<newname>)]%R%TRename a file.%R%R[ansi(h,%q<cmd>/deletecategory <category>)]%R%TDelete a category and all associated files.%R%R[ansi(h,%q<cmd>/delete <filename>)]%R%TDelete a helpfile.
&INC.ALERT #help=@pemit %#=%0;@attach #inc/MSG_ALERT=%0
&SW.ADD #help=@assert/inline strlen(setr(!,capnames(trim(before(%0,/))),category))=@pemit %#=Category field is empty.;@assert/inline setr(!,u(FN.VALID_CATEGORY,%q<category>),result)=@pemit %#=%q<result>;@assert/inline strlen(setr(!,trim(after(%0,/)),filename))=@pemit %#=Filename field is empty.;@assert/inline setr(!,u(FN.VALID_FILENAME,%q<filename>))=@pemit %#=%q<result>;@assert/inline strlen(%1)=@pemit %#=Entry field empty.;@attach/localize %!/ADD_FILE=%q<root>,%q<category>,%q<filename>,%1;@attach %!/INC.ALERT=The %q<root> %q<category> Helpfile '%q<filename>' has been created.
&SW.CATEGORY #help=@attach %!/INC.FIND_FILE=%0,file;th setq(!,%q<category>,oldcat);@assert/inline strlen(setr(!,capnames(%1),category))=@pemit %#=Category field is empty.;@assert/inline setr(!,u(FN.VALID_CATEGORY,%q<category>),result)=@pemit %#=%q<result>;@attach %!/SET_CATEGORY=%q<root>,%q<filename>,%q<category>;@attach %!/INC.ALERT=The %q<root> %q<oldcat> Helpfile '%q<filename>' has been recategorized to: %q<category>.
&SW.SUMMARY #help=@attach %!/INC.FIND_FILE=%0,file;@assert/inline strlen(%1)=@pemit %#=Summary field is empty.;@attach %!/SET_SUMMARY=%q<root>,%q<file>,%1;@attach %!/INC.ALERT=The %q<root> %q<category> Helpfile '%q<file>' summary was changed to: %1.
&INC.FIND_CATEGORY #help=@assert/inline words(setr(!,u(FN.CATEGORIES,%q<root>),categories),|)=@pemit %#=There are no categories!;@attach #inc/PARTIAL=%0,%q<categories>,|,%1,category;
&SW.RENAMECATEGORY #help=@attach %!/INC.FIND_CATEGORY=%0,category;
&SW.RENAME #help=@attach %!/INC.FIND_FILE=%0,file;@assert/inline strlen(setr(!,%1,filename))=@pemit %#=Filename field is empty.;@assert/inline setr(!,u(FN.VALID_FILENAME,%q<filename>))=@pemit %#=%q<result>;@attach %!/RENAME_FILE=%q<root>,%q<file>,%q<filename>;@attach %!/INC.ALERT=The %q<root> %q<category> Helpfile '%q<file>' was renamed to: %q<filename>
&SW.DELETECATEGORY #help=@attach %!/INC.FIND_CATEGORY=%0,category;@assert/inline strmatch(%q<category>,%1)=@pemit %#=[ansi(hr,WARNING:)] This will delete category '%q<category>' and all sub-files. Are you sure? Enter as [ansi(hr,%q<cmd>/deletecategory %q<category>=%q<category>)] to verify.;@attach %!/DELETE_CATEGORY=%q<root>,%q<category>;@attach %!/INC.ALERT=The %q<root> Helpfile Category '%q<category>' was [ansi(hr,completely deleted.)]
&SW.DELETE #help=@attach %!/INC.FIND_FILE=%0,file;@assert/inline strmatch(%q<file>,%1)=@pemit %#=[ansi(hr,WARNING:)] This will delete file '%q<file>'. Are you sure? Enter as [ansi(hr,%q<cmd>/delete %q<file>=%q<file>)] to verify.;@attach %!/DELETE_FILE=%q<root>,%q<file>;@attach %!/INC.ALERT=%q<root> %q<category> Helpfile '%q<file>' has been [ansi(hr,deleted.)]
&ADD_FILE #help=th setq(!,u(FN.HASH,%0,%2),hash);@set #help_db=%q<hash>_NAME:%2;@set #help_db=%q<hash>_CATEGORY:%1;@set #help_db=%q<hash>_ENTRY:%3
@@ %0 - root, %1 - category, %2 - filename, %3 - entry
&SET_SUMMARY #help=th setq(!,u(FN.HASH,%0,%1),hash);@set #help_db=%q<hash>_SUMMARY:%2
@@ %0 - root, %1 - filename, %2 - summary
&SET_CATEGORY #help=th setq(!,u(FN.HASH,%0,%1),hash);@set #help_db=%q<hash>_CATEGORY:%2
@@ %0 - root, %1 - filename, %2 - new category
&RENAME_CATEGORY #help=th setq(!,u(FN.CATEGORY_FILES,%0,%1),files);@dolist/inline/delimit | %q<files>={@attach %!/SET_CATEGORY=%0,%d0,%2}
@@ %0 - root, %1 - category, %2 - new category
&DELETE_FILE #help=@set #help_db=!SAFE;@wipe #help_db/[u(FN.HASH,%0,%1)]_*;@set #help_db=SAFE
@@ %0 - root, %1 - filename
&RENAME_FILE #help=th setq(!,u(FN.HASH,%0,%1),hash);th setq(!,u(FN.HASH,%0,%2),newhash);@dolist/inline lattr(#help_db/%q<hash>_*)={@mvattr #help_db=%d0,edit(%d0,%q<hash>,%q<newhash>)}
@@ %0 - root, %1 - filename, %2 - new filename
&FN.CATEGORIES #help=setunion(capnames(iter(lattr(#help_db/%0_*_CATEGORY),get(#help_db/%i0),%b,|)),,|,|,i)
@@ %0 - root
&FN.ALL_FILES #help=iter(lattr(#help_db/%0_*_NAME),elementsmux(%i0,2,_),%b,|)
@@ %0 - root
&FN.CATEGORY_FILES #help=iter(grep(#help_db,%0_*_CATEGORY,%1),elementsmux(%i0,2,_),%b,|)
@@ %0 - root, %1 - category
&FN.FILE_NAMES #help=sort(iter(if(strlen(%1),u(FN.CATEGORY_FILES,%0,%1),u(FN.ALL_FILES,%0)),get(#help_db/%0_%i0_NAME),|,|),i,|,|)
@@ %0 - root, %1 - optional category.
&BADCHARS #help=| ~ %R %T
&FN.VALID_FILENAME #help=ofparse(3,if(lte(strlen(%0),20),1,#-1 FILENAMES CANNOT BE MORE THAN 15 CHARACTERS),if(!contains_characters(%0,v(BADCHARS)),1,#-1 FILENAMES CANNOT CONTAIN BADCHARS \([v(BADCHARS)]\)))
&FN.VALID_CATEGORY #help=ofparse(3,if(lte(strlen(%0),30),1,#-1 CATEGORIES CANNOT BE MORE THAN 30 CHARACTERS),if(!contains_characters(%0,v(BADCHARS)),1,#-1 CATEGORIES CANNOT CONTAIN BADCHARS \([v(BADCHARS)]\)))
&FN.HASH #help=%0_[ucrc32(%1)]
@@ File schema
@@ &<root>_<ucrc32>_NAME #help_db=Filename1
@@ &<root>_<ucrc32>_ENTRY #help_db=#obj/attr or text
@@ &<root>_<ucrc32>_SUMMARY #help_db=<summary>
@@ &<root>_<ucrc32>_CATEGORY #help_db=<category>