Multiplayer Interactive-Fiction Game-Design Blog



Download 8.87 Mb.
Page148/151
Date02.02.2017
Size8.87 Mb.
#15199
1   ...   143   144   145   146   147   148   149   150   151

HelpContents


Returns the directory of articles at the given level of contents.

Returns the directory of articles at the given level of contents.

Articles are organized into directories, just like the file system. Each article is placed somewhere in the directory structure, such as "Major category/minor category/sub category". (Note the FORWARD slash.)

Calling HelpContents() with "" will return all articles at the root of the directory structure, and a list of all sub-directories.

Calling with "Major Category" will return all articles and sub-directories under "Major Category"; this will include "Minor Category".

Parameter Name

Description

Actor

The actor looking in help. Some actors, either because of skills or access priviledges, won't be able to see some help topics.

Directory

Directory to enumerate. This can be "" to enumerate the root, or a series of names separated by a forward slash ('/').

Books

Controls what books of help will be searched.

If this is NULL, then only help articles in the default book, "", will be searched. (NULL will usually be passed in.)

If it's a string then only that book will be searched.

If it's a list of strings, then only those books whose string appears in the list will be kept.



Return value description

NULL if there's an error, or a list if it succedes.

The first element of the list is a list of all the articles in the directory. Each article is a list of its own, with the first element being the article name, and the second being a short description of the article.

The second element of the main list is a list of sub-directories, each sub-directory being a string.



HelpContentsMML


Returns the directory of articles at the given level of contents, as a resource string.

Returns the directory of articles at the given level of contents, as a resource string. Unlike HelpContents(), you can pass this string to the client to have it display the help.



Parameter Name

Description

Actor

The actor looking in help. Some actors, either because of skills or access priviledges, won't be able to see some help topics.

Directory

Directory to enumerate. This can be "" to enumerate the root, or a series of names separated by a forward slash ('/').

Books

Controls what books of help will be searched.

If this is NULL, then only help articles in the default book, "", will be searched. (NULL will usually be passed in.)

If it's a string then only that book will be searched.

If it's a list of strings, then only those books whose string appears in the list will be kept.



Return value description

NULL if couldnt find the contents, or a resource string of the form "...".

// get the list

var vList = HelpContents (Actor, Directory, Books);

if (!IsList(vList))

return NULL; // error

var vArticles = vList[0];

var vDir = vList[1];

// create a nice ... resource string for this

var vRet = "";


// loop over all the articles

var i;


var vItem;

if (vArticles.ListNumber()) {

vRet += "
" +

ToStringMML (Directory.StringLength() ? sHelpContentArticlesWith.StringFormat(Directory) : sHelpContentArticles) +

"

    ";
    // sort the articles alphabetically

    vArticles.ListSort (SortSubListString);

    for (i = 0; i < vArticles.ListNumber(); i++) {

    vItem = vArticles[i];

    vRet += "


  • ToStringMML (ToString(sHelpArticle) + " \"" + ToStringMML(vItem[0]) + "\"") +

    "\">" +

    ToStringMML (vItem[0]) +

    " - " +

    ToStringMML (vItem[1]) +

    "

  • ";


    } // i

    vRet += "


";

} // if articles


// loop over all the directories

var vSuperDir;

if (vDir.ListNumber()) {

vRet += "


" +

ToStringMML (Directory.StringLength() ? sHelpContentDirectoriesWith.StringFormat(Directory) : sHelpContentDirectories) +

"

    ";

    vSuperDir = "" + Directory; // to make it into a new string

    if (vSuperDir.StringLength())

    vSuperDir += "/";


    // sort all the directories

    vDir.ListSort();

    for (i = 0; i < vDir.ListNumber(); i++) {

    vItem = vDir[i];

    vRet += "


  • ToStringMML (ToString(sHelpContents) + " \"" + ToStringMML(vSuperDir + vItem) + "\"") +

    "\">" +

    ToStringMML (vItem) +

    "

  • ";

    } // i

    vRet += "


";

} // if vDir


// potentially show "up" option

var vFind;

if (Directory.StringLength()) {

vFind = -1;

while (TRUE) {

i = Directory.StringSearch ("/", vFind+1);

if (i >= 0)

vFind = i;

else

break;


}

if (vFind >= 0)

vFind = " \"" + ToStringMML(Directory.StringSubString (0, vFind)) + "\"";

else


vFind = ""; // if going up to top
vRet += "

ToStringMML (ToString(sHelpContents) + vFind) +

"\">" +

ToStringMML (sHelpContentsUp) +

"
";

}
// add in a search

vRet +=

"


";
// add in back

var vBack;

if (Actor && IsList(Actor.pHelpHistory) && (Actor.pHelpHistory.ListNumber() >= 2)) {

vBack = "


ToStringMML (sHelpBackCommand) +

"\">" +

ToStringMML (sHelpBackShow) +

"
";

vRet += vBack;

}
vRet += "";
return vRet;


Download 8.87 Mb.

Share with your friends:
1   ...   143   144   145   146   147   148   149   150   151




The database is protected by copyright ©ininet.org 2024
send message

    Main page