Multiplayer Interactive-Fiction Game-Design Blog



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

HelpSearch


Searches through the help articles for a match against the keywords.

Searches through the help articles for a match against the keywords.



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.

Keywords

List of keywords to search for, separated by space.

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 list is a list of articles that match. Each article is a sub-list with the article's name, a short description of the article, and an integer score. The list is sorted so that the best scores are first.




HelpSearchMML


Searches through the help articles for a match against the keywords, returning MML resource text.

Searches through the help articles for a match against the keywords, returning MML resource text. The resource text can then be sent to the client.



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.

Keywords

List of keywords to search for, separated by space.

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 anything to search for, or a resource string of the form "...".

// get the list

var vList = HelpSearch (Actor, Keywords, Books);

if (!IsList(vList))

return NULL; // error

if (!vList.ListNumber())

return NULL; // nothing found

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

var vRet = "";


// loop over all the found

var i;


var vItem;

vRet += "


" +

ToStringMML (sHelpSearch) +

"

    ";

    // sort the articles alphabetically


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

    vItem = vList[i];

    vRet += "


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

    "\">" +

    ToStringMML (vItem[0]) +

    " - (" +

    floor (vItem[2] / 1000) +

    "%) " +

    ToStringMML (vItem[1]) +

    "

  2. ";


    } // i
    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;

NLPNounCase


Parses a noun-case string based upon the case settings.

This parses a noun-case string based upon the case settings...

A noun-case string is a string containing the name of an object. The string also has extra tags to identify how the name changes depending upon the "case" of the noun. For example: A noun case string for a "person" object would be "(sing?person:people)"; the "sing" followed by a '?' means that if the requested case is singular then return the first option, "person". If the requested case is not singular (plural) then return "people". This is a simple example using English. Many languges are highly inflected, and can get more complicated.

In the noun-case string, a test follows the form, "(X?Y:Z)", where X is the noun-case tested (see below), Y is the string that's used if the test passes, and Z is used if the test fails. The Z string is not necessary; the noun-case string could just be "(X?Y)", in which case if the X case does not pass, then no string will used.

Tests can be placed inside one another. Therefore, "(X?(A?B:C):Z)" is possible. Tests can also be placed in sequece and include sub-strings that are always used: "M(X?Y:Z)N(A?B:C)O".

The noun case passed in is a number that is an or-ed combination of the gNC_XXX_YYY global variables. (Do not change thse variables, since they're supposed to be constant values.) To completely describe the noun form, use one of each XXX type, except for the _Mask ending. This would mean: gNC_Art_YYY, gNC_Count_YYY, gNC_Anim_YYY, gNC_Fam_YYY, gNC_Verbose_YYY, gNC_Gender_YYY, gNC_Caps_YYY, gNC_Person_YYY, gNC_Quantity_YYY, and gNC_Case_YYY. If you don't specify a case from the given XXX category then a default will be used.

gNC_Art_YYY lets you control if there's an article in front of the noun. gNC_Art_None is for no article, gNC_Art_Definite uses "the" (in English). gNC_Art_Indefinite uses "a" or "an" (in English).

gNC_Count_YYY controls the count aspect of the noun. gNC_Count_Single creates a singular form, gNC_Count_Few is for a plural form with two to three objects, and gNC_Count_Many is for plural objects with four or more objects. (Few and Many are necessary since some languages have two forms of plural.)

gNC_Anim_YYY specifies if the noun is animate or inanimate: gNC_Anim_Animate or gNC_Anim_Inanimate. English does not use these.

gNC_Fam_YYY controls the familiar and formal forms: gNC_Fam_Familiar and gNC_Fam_Formal. Many languages have familiar and formal pronouns. English does not.

gNC_Verbose_YYY specifies if the name is the long or short form: gNC_Verbose_Short or gNC_Verbose_Long. Some objects will have a long form "John Alva Edison" or a short form "John", depending upon how they're used in speech.

gNC_Gender_YYY can be gNC_Gender_Male, gNC_Gender_Female, or gNC_Gender_Neuter.

gNC_Caps_YYY causes the first letter of the noun to be capitalized. It can be gNC_Caps_Upper or gNC_Caps_Lower.

gNC_Person_YYY defines 1st (I, we), 2nd (you, you-plural), or 3rd person (he, they). It can be gNC_Person_First, gNC_Person_Second, or gNC_Person_Third.

gNC_Quantity_YYY indicates whether a quantity number should be shown in front of the noun. gNC_Quantity_NoQuantity (default) doesn't show a quantity, while gNC_Quantity_Quantity will show a quantity. (Note: NLPNounCase() does NOT handle the display of quantities.)

gNC_Case_YYY controls the linguistic "noun case". English has three cases: gNC_Case_Objective (such as "me", "him", or "her"), gNC_Case_Subjective (such as "I", "he", or "she"), and gNC_Case_Possessive (such as "My", "his", or "her"). Other languages have more cases. A full list can be seen by looking for global variables beginning with "gNC_Case_".

When a noun-case string includes the name of the case to check, it can be reduced to the first 2-4 characters of the case. There's no need to type the whole word. Example: "(Obj?me:I)" will test to see if the noun is gNC_Case_Objective. If it is then "me" will be othed, otherwise "I". Enough letters need to be used from the start of the name so that it can be identified from another case. If you're not sure, use the first 4 characters.

Parameter Name

Description

NounCaseString

String that includes tests based upon the case.

NounCase

Case of the noun. One or more gNC_XXX_YYY or-ed together. For example: (gNC_Gender_Male | gNC_Count_Singular | gNC_Case_Objective)

AppendNounCase

(Optional) If TRUE (or not specified), this appends the noun-case information to the string in the form of "{X}", where X is the NounCase value that is used for noun-verb agreement. Appending this information now makes the call into NLPVerbForm() or NLPStringFormat() easier.

Return value description

The string that results from the tests in the NounCaseString and the NounCase settings.



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