Help DB Class #15

Parent #1Owner #10Flags fertileSource MurpgCore-0.4/MurpgCore-0.4.db

2 verbs · 15 properties · 6 children

Verbs

VerbSpecFlagsDefinerLines
find_topicsthis none thisrwxd#1514
add_topicthis none thisrwxd#1528

Properties

PropertyDefinerFlagsOwnerValue
index#15rw#10{}
description#1rw#10<clear>
aliases#1rw#10<clear>
home#1rw#10<clear>
short_desc#1rw#10<clear>
core#1rw#101
handedness#1rw#10<clear>
base_enc#1rw#10<clear>
base_weight#1rw#10<clear>
capacity#1rw#10<clear>
max_fit#1rw#10<clear>
pprep#1rw#10<clear>
gprep#1rw#10<clear>
generic_name#1rw#10<clear>
age#1rw#10<clear>

Ancestry

Ancestors (nearest first): #1 Root Class

Children: #28 Player Help Database, #29 Coder Help Database, #30 Architect Help Database, #31 Dungeon Master Help Database, #53 NPC Help Database, #54 Animate Help Database

Source

find_topics

Spec this none thisFlags rwxdOwner #10Definer #15

Referenced by

none

Source

1"#15:find_topics(STR) this none this";
2"takes one string argument, finds an exact matching topic keyword.";
3"if no exact match, then finds all partial matches.";
4"returns topic/article pairs.";
5{?topic = "help"} = args;
6matches = {};
7for each in (this.index)
8if (each[1] == topic)
9return {each};
10elseif (index(each[1], topic) == 1)
11matches = {@matches, each};
12endif
13endfor
14return matches;

add_topic

Spec this none thisFlags rwxdOwner #10Definer #15

Referenced by

none

Source

1"#15:add_topic this none this";
2"takes one or two args, first is topic keyword, second optionally an";
3"existing articlenum.  if no article specified, adds new topic and articlenum.";
4"if specified, creates a new topic/article pair in index.";
5"must preserve many to one topic/article relationship.";
6{topic, ?article = ""} = args;
7found = 0;
8for each in (this.index)
9if (each[1] == topic)
10return {0, ((("Topic keyword %W" + topic) + "%w already exists in %W") + this.name) + "%w."};
11endif
12endfor
13if (article != "")
14if (article in properties(this))
15this.index = {@this.index, {topic, article}};
16return {1, ((((("Topic keyword %W" + topic) + "%w added to %W") + this.name) + "%w for %Warticle #") + tostr(article)) + "%w."};
17else
18return {0, ((("Specified article number %W" + tostr(article)) + "%w does not exist in %W") + this.name) + "%w."};
19endif
20else
21article = $get_next_help_id();
22value = {};
23perms = "rw";
24owner = $dm;
25add_property(this, article, value, {owner, perms});
26this.index = {@this.index, {topic, article}};
27return {1, ((((((((("Topic keyword %W" + topic) + "%w added to %W") + this.name) + "%w for %Wnew article #") + article) + "%w.  Don't forget to  %Wedit ") + tostr(this)) + ".") + article) + "%w."};
28endif