Multiplayer Interactive-Fiction Game-Design Blog



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

NLPParse


This parses a NLP sentence and produces hypothesis.

NLPParse() accepts a natural language sentence, such as a command or something the user says to a NPC.

It then uses a series of NLPRuleSet rules (see the documentation) that were added through NLPRuleSetAdd() calls. Rules disabled with NLPRuleSetEnableSet() are ignored. The language used is determined by the current language. (See LanguageSet()).

The sentence is analyzed using the NLP rules, producing a list of hypothesis for what was said (potentially 100's - 1000's). The hypothesis are simplified versions of original sentence. For example: "Could you tell me who Mike is?" and "Who is Michael?" could both be simplified down to "`WHOIS Mike". (Other hypothesis will also be generated.)

The returned hypothesis can be passed to a more specific parser, such as one for interpreting commands or interpreting speech to a NPC.

Parameter Name

Description

Parser

The name of the parser to use. Use NLPParserEnum() to obtain a list of parsers.

TemporaryRules

These are temporary rules that will be used along with the rules in the parser's rule sets. The format is a MML string with "...", defining the meaning of the rules. For more information onthe format see NLPRuleSet.

You can use the temporary rules for word/phrase meanings that change every time the parser is called, such as pronouncs. After all, the meaning of "it" changes depending upon the last few sentences.

If you don't wish to use any temporary rules then pass in NULL.


Sentence

This is the sentence that's to be parsed.

Return value description

This returns a list of hypothesis.

Each hypothesis is a list. The first element in the list is the probability (or score) of the hypothesis, from 0..1. The next elements are a series of hypothesized sentences. Most hypothesis will only contain one sentence, but some may be more than one.

Each sentence is a list of words, such as "who", "is", "mike". If any word began with a '|' character and was followed by an object ID, the original string will automatically be converted to an object ID. If any strings begins with a '`' then it is automatically lower cased.



NLPParserClone


Duplicates a NLP parser.

Use this to clone a NLP parser.

You may wish to clone a NLP parser when a new NPC appears on the scene. A parser common to all NPCs could be set up, and then if a NPC uses a slightly different set of rules, clone the common parser and modify it to fit the NPC.

Parameter Name

Description

Orig

The name of the parser to clone. Use NLPParserEnum() to obtain a list of parsers.

CloneTo

Clone the parser to this.

Return value description

TRUE if the parser was found and cloned. FALSE if the parser could not be found.


NLPParserEnum


Enumerates the NLP parsers.

This enumerates what NLP parsers are running in the VM. You will probably have one parser for dealing with commands from the user, and one or more for parsing NLP conversations with NPCs.



Parameter Name

Description

Return value description

Returns a list containing all the parsers' names.


NLPParserRemove


Removes a NLP parser.

This deletes a NLP parser when it is no longer being used.



Parameter Name

Description

Parser

The name of the parser to remove. Use NLPParserEnum() to obtain a list of parsers.

Return value description

TRUE if the parser was found and removed. FALSE if the parser could not be bound.


NLPPronoun


Returns a pronoun string.

Uses the NounCase parameter to determine what pronoun string to return, such as "I" vs. "me".



Parameter Name

Description

NounCase

One or more flags or-ed together. The flags are from the gNC_XXX_YYY constants. For more information see NLPNounCase().

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

Pronoun string.


NLPRuleSetAdd


Adds a new rule set to a given parser.

Call this to add a rule set to a given parser. The rule set starts out enabled.

NOTE: Added rule sets are NOT saved when the VM is saved to disk. Therefore, any objects or code that rely on a rule set MUST reload it when the VM is reloaded from disk.

Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

If the parser does not already exist then it will be added to the list.



RuleSet

The name of the rule set to add. If the rule set already exists then the existing one is overwritten.

Rules

These are the rules to add. If they are a resource they must be of the type, "NLPRuleSet". If they are a string, they must be MML with "...". (Search in the documentation for more information on NLPRuleSet.)

If the Rules parameter is a resource or it's a string token, NLPRuleSetAdd() will see if the resource or string token supports multiple languages. If it does then all of the supported languages will be added at once. The proper language will be selected when NLPParse() is called.

Otherwise, the rule set will only work for one language, as specified by the current language. (See LanguageSet())


Return value description

TRUE if the rule set is added, FALSE if there's an error.


NLPRuleSetEnableAll


Enables or disables all rule sets in a parser.

Enables or disables all rule sets in a parser.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

Enable

If TRUE then enable all rule sets in the parser. If FALSE then disable all rule sets.

Return value description

TRUE if the rule sets are enabled, FALSE if it's disabled. If the parser cannot be found it returns NULL.


NLPRuleSetEnableGet


Returns TRUE if the rule set is enabled.

This tests to see if a rule set is enabled, returning TRUE or FALSE.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

RuleSet

The name of the rule set to test. Use NLPRuleSetEnum() to obtain a list of rule sets in a parser.

Return value description

TRUE if the rule set is enabled, FALSE if it's disabled. If the rule set cannot be found it returns NULL.


NLPRuleSetEnableSet


Enables or disables a rule set in a parser.

This enables or disables a rule set in a parser. Disabling a rule set causes it not to be used when NLPParse() is called.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

RuleSet

The name of the rule set to set. Use NLPRuleSetEnum() to obtain a list of rule sets in a parser.

Enable

Pass in TRUE to enable, FALSE to disable.

Return value description

TRUE if success, FALSE if the rule set could not be found.


NLPRuleSetEnum


Enumerates the rule sets in a given parser.

This returns a list of all the rule sets in a given parser.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

Enabled

If TRUE then enumerate only enabled rule sets. If FALSE then enumerate only disabled rule sets. If NULL then enumerate all rule sets, enabled or disabled.

Return value description

A list containing string-based names of all the rule sets in the parser. If the parser could not be found the function will return FALSE.


NLPRuleSetExists


Returns TRUE if the rule set exists.

Returns TRUE if the rule set exists.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

RuleSet

The name of the rule set to test. Use NLPRuleSetEnum() to obtain a list of rule sets in a parser.

Language

Langauge ID (from LanguageGet()) to look for. If this is NULL then any language is acceptable.

Return value description

TRUE if the rule set exists. FALSE if it does not.


NLPRuleSetRemove


Removes a rule set from a given parser.

This removes a rule set from a given parser.



Parameter Name

Description

Parser

The name of the parser to look in. Use NLPParserEnum() to obtain a list of parsers.

RuleSet

The name of the rule set to remove. Use NLPRuleSetEnum() to obtain a list of rule sets in a parser.

Return value description

TRUE if the rule set was removed. FALSE if it could not be found.


NLPStringFormat


Replaces %1, %2 in a string, and calls NLPVerbForm().

This useful function replaces occurances of "%1", "%2", etc. in a string with new substrings. (See the StringFormat() method), and then calls NLPVerbForm() to convert noun-case tags (enclosed in left and right braces) and verb-form tags (enclosed in parenthesis).

The NLPStringFormat() function allows for easy insertion of object names into a string. Example: NLPStringFormat ("%1 (am/are/is/are) in good shape.", object.NLPName (actor, gNC_Case_Subjective)) will result in %1 being replaced with the object name, and the correct verb form being chosen.

You might wish to use NLPStringFormat2(), which has the same functionality but allows objects to reword the String to meet specific conditions.



Parameter Name

Description

String

String with %1, %2, etc. in it.

If this is a list, a random element will be selected from the list for speaking.

If this is an object, the object is returned. The passthrough happens to enable SpeakScript() to take cConvStory (potentially associated with cKnowledge) and cConvTree objects.


Param1

If %1 is found, it is replaced by Param1.

Param2

If %2 is found it is replaced by Param2.

Return value description

New string that includes the replacements.

// select from list

while (IsList(String))

String = Random(String);
if (IsObject(String))

return String;


var sReplace = String.StringFormat (arguments[1], arguments[2],

arguments[3], arguments[4], arguments[5], arguments[6], arguments[7],

arguments[8], arguments[9], arguments[10]);

return NLPVerbForm (sReplace);


NLPStringFormat2


Replaces %1, %2 in a string, and calls NLPVerbForm().

This function is like NLPStringFormat(), except that:

- It takes slightly different parameters, allowing you to pass in sub-lists with objects instead of using NLPName() all the time.

- For each object mentioned, as well as the room that the Actor is in, StringReword() is called to see if the string should be customized for a specific case. For example: You might want to change the response of, "You pick up the jewel." to "With greedy eyes, you carefully pick up the jewel."

This useful function replaces occurances of "%1", "%2", etc. in a string with new substrings or names of objects.

Parameter Name

Description

Actor

Player character that this string will be displayed to.

String

String with %1, %2, etc. in it.

If this is a list, a random element will be selected from the list for speaking.



Replace1

This replaces %1 in the string. If it's a string, the replacement is direct. If it's a list, the first parameter is the object name to display, the second is the gNC_XXX_YYY parameters. The list normally has only two items, but if there's a 3rd and 4th item, the 3rd is the possessor of the object (1st item), and the 4th is the gNC_XXX_YYY parameters for the possessor.

Replace2

Like Replace1.

Replace3

Like Replace1.

Replace4

Like Replace1.

Replace5

Like Replace1.

Return value description

The new string.

var vReplace = [Replace1, Replace2, Replace3, Replace4, Replace5];

var vNum = vReplace.ListNumber();

var i, vList, vRet;
// actor

if (vRet = Actor.StringReword (Actor, String, Replace1, Replace2, Replace3, Replace4, Replace5))

String = vRet;
// room

var vRoom = ActorToRoom (Actor, TRUE);

if (vRoom && (vRet = vRoom.StringReword (Actor, String, Replace1, Replace2, Replace3, Replace4, Replace5)))

String = vRet;

// call the objects

for (i = 0; i < vNum; i++) {

// only care if its a list

if (!IsList(vList = vReplace[i]))

continue;

// get the string

if (IsObject(vList[2])) {

if (vRet = vList[0].StringReword (Actor, String, Replace1, Replace2, Replace3, Replace4, Replace5))

String = vRet;

if (vRet = vList[2].StringReword (Actor, String, Replace1, Replace2, Replace3, Replace4, Replace5))

String = vRet;

}

else



if (vRet = vList[0].StringReword (Actor, String, Replace1, Replace2, Replace3, Replace4, Replace5))

String = vRet;

} // i
// change the sub-lists to strings

for (i = 0; i < vNum; i++) {

// only care if its a list

if (!IsList(vList = vReplace[i]))

continue;

// get the string

if (IsObject(vList[2]))

vReplace[i] = vList[0].NLPNamePossessed (Actor, 0, vList[2], vList[3]);

else

vReplace[i] = vList[0].NLPName (Actor, vList[1]);



} // i
return NLPStringFormat (String, vReplace[0], vReplace[1], vReplace[2], vReplace[3], vReplace[4]);

NLPVerbForm


Conjugates verbs in a sentence.

This conjugates verbs in a sentence. NLPVerbForm() is useful for dealing with verb forms when "filling in the blank" for a strink "%1 (am/are/is) in good health.", since the verb could be conjugated to "I am in good health.", "You are in good health.", "He is in good health.", or "They are in good health."

The function accepts a string containing a sentence with special tags indicating what class each noun is, along with the verbs of each form. It uses to noun tags to determine what forms the verb should take.

Each noun (that could affect a to-be-conjugated verb) must have a tag next to it. The tag is a number surrounded by curly braces, { and }. The number is the values of gNC_XXX_YYY or-ed together. See NLPNounCase() for a description of the flags. Example: "{345321}"

Each verb (that can be conjugated) must be in parenthesis with the alternative forms of the verb separated by slashes. The forms are language dependent. In English, the forms are 1st-person singular, 2nd-person singular and all plurals, and 3rd-person singular. Example: "(am/are/is)" or "(walk/walk/walks)").

The function returns a string with the noun case numbers removed, and the verbs conjugated.

In order to do the processing, this function calls into NLPVerbFormCallback(). NLPVerbFormCallback() already supports Enlgish. If you wish to use Circumreality for another language you many need to modify this function.

Parameter Name

Description

String

The string with noun and verb tags.

Return value description

A string the verbs conjugated, and noun and verb tags removed.


NLPVerbFromCallback


Callback from NLPVerbForm()

NLPVerbFormQuery() is called by NLPVerbForm() to determine how to conjugate a verb. NLPVerbFormCallback() already supports English. If you are porting Circumreality to another language (such as Swedish) then you may need to modify this function.

NLPVerbFormCallback() is passed a list of all the nouns and verbs in the sentece. The nouns are represented by their noun-case value (See NLPNounCase() for a description). The verbs are initially filled in with 0.

Example: If "He{34532} (am/are/is/are) in good shape." where passed into NLPVerbForm(), NLPVerbFormQuery() would be passed the following list: [34532, 0].

NLPVerbFormCallback() needs to find all the 0-values, indicating verbs, and look at the neighboring noun cases to determine what form should be used. It then fills in a NEGATIVE number for the verb form.

Verb forms are language independing. In English, however, the following forms are used:

-1 : 1st person singular

-2 : 2nd person singular, and plural

-3 : 3rd person singular

Parameter Name

Description

FormList

This originally contains a list of noun-case values and 0's where the verb form must be filled in. NLPVerbFormCallback() should change all the 0's to negative values indicating their verb form.

Return value description

None


PerformanceCPU


Returns the amount of CPU used by the process.

Returns the amount of CPU used by the process.

To use this, you'll need to occasionally poll the CPU and subtract values over a given time segment.

Parameter Name

Description

Return value description

List with [Time since creation, Time in process, Main thread's time since creation, Main thread's time in process].

Time since creation - The number of seconds since the creation of the process.

Time in process - The total time spend in the process since the process was created, divided by the number of processors in the system. In seconds.

Main thread's time since creation - Number of seconds the main thread has existed.

Main therad's time in process - Number of seconds the main thread has run, NOT divided by the number of processors.

Note: The main thread's time information is returned since it's the thread that uses the most CPU. If you are using a multicore or SMP machine, the main thread will be the gating factor for the maximum number of users on the system. Once this reaches around 100% utilization you won't be able to get any more users on, even if you have spare capacity in the other processors.




PerformanceCPUObject


Keeps track of how much CPU an object uses.

This keeps track of how much CPU an object uses. More specifically, it monitors CPU usage on the main thread, assuming that the main thread is the bottleneck for perfomance.

You can use this to keep track of how much CPU (approximately) an individual player is using by passing the player's character in as the object.

This starts monitoring the current object. It assumes that the CPU from here on out is being used by the current object, UNTIL PerformanceCPUObject() is called again, or the callback (or timer) finishes.



Parameter Name

Description

Object

Object to be monitored, usually the player's character. If this is NULL, the monitoring of the current object stops.

Return value description

None


PerformanceCPUObjectQuery


Returns the percentage of CPU used by the object.

Used in conjuction with PerformanceCPUObject(), this returns the percentage of CPU being used by the given object. The timerframe is over the last 60 seconds (approximately).



Parameter Name

Description

Object

Object to query, usually the player's character.

Return value description

Percentage (0.0 .. 1.0) of CPU (for the main thread only) that has been used by this object. Of course, the number will only be accurate if PerformanceCPUObject() was called with the object.


PerformanceDisk


Returns the amount of free space on the database disk.

Returns the amount of free space on the database disk.



Parameter Name

Description

Return value description

Returns the free space in gigabytes on the database disk.


PerfomanceGUI


Returns the number of GUI objects allocated to the process.

Returns the number of GUI objects allocated to the process. This can be used to detect slow memory leaks.



Parameter Name

Description

Return value description

Returns the number of GUI objects.


PerformanceHandles


Returns the number of handles used on the server.

Returns the number of handles used on the server. This can be used to detect slow memory leaks.



Parameter Name

Description

Return value description

Returns the number of handles.


PerformanceMemory


Returns the amount of memory allocated by the server.

Returns the amount of memory allocated by the server.



Parameter Name

Description

MemoryType

Type of memory information that want...

0 - The amount of memory specifically allocated by the server code.

1 - The amount of memory allocated by the memory manager (which is more than the amount allocated by the server code.)

2 - Current working set.

3 - Amount of memory used by the process, in total. This includes pooled and non-pooled.


Return value description

See MemoryType. Values are in megabytes.


PerformanceNetwork


Returns the amount of data sent/received from the server over the Internet.

Returns the amount of data sent/received from the server over the Internet.



Parameter Name

Description

Return value description

List with [Megabytes sent, Megabytes received].

Note: Megabyte = 1,000,000 bytes exactly.




PerformanceThreads


Returns the number of threads used on the server.

Returns the number of threads used on the server. This can be used to detect slow memory leaks.



Parameter Name

Description

Return value description

Returns the number of threads.


RenderCacheLimits


Limits how much memory and disk space is allocated to the render cache.

The server accepts rendered images and text-to-speech recordings from the players' computers and caches them away. These are then sent out to other players, saving them processing.

Use this function to set the limits of how large the cache will be allowed to get.

Parameter Name

Description

DataMaximum

Maximum amount of data that will be cached, in megabytes.

DataMinimumHardDrive

If there isn't much hard drive left, the cache will shrink itself. This is the minimum amount of hard drive (in megabytes) will be kept available. If the free hard drive is less than this, the cache will be deleted until that much is free.

DataGreedy

When the server first starts up with a new MIF file, it will erase the existing cache.

In order to fill the cache quickly, if the cache size is less than DataGreedy (in megabytes) then all rendered images and text-to-speech are accepted from players. Normally, data is only occasionally accepted.



DataMaxEntriesOn32

Maximum number of entries that will be allowed on a 32-bit server (around 10000). This number has to be somewhat small so that the memory for the index doesn't use up all the limited 2 gigabyte limit.

DataMaxEntriesOn64

Maximum number of entries that will be allowed on a 64-bit server (around 1000000).

Return value description

None


SavedGameEnum


Enumerates all the saved games.

Enumerates all the saved games.



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

Return value description

Returns a list of saved games. Each saved game is a list with the first element being the game name, followed by the creation time, modification time, and last access time.


SavedGameFilesDelete


Deletes a save-game file, and all of its sub-files.

Deletes a save-game file, and all of its sub-files.



Parameter Name

Description

FileName

Saved-game file to delete.

Return value description

TRUE if the file was deleted. FALSE if it doesn't exist.


SavedGameFilesEnum


Enumerates all the saved-game files.

Enumerates all the saved-game files.



Parameter Name

Description

Return value description

Returns a list of strings, one for each saved-game filename.


SavedGameFilesName


Returns the name of a saved-game file given its index.

Returns the name of a saved-game file given its index.



Parameter Name

Description

Index

Index, from 0 .. SavedGamesFilesNum()-1.

Return value description

Returns a string with the name, or NULL if it can't be found.


SavedGameFilesNum


Returns the number of save-game files.

Returns the number of save-game files.



Parameter Name

Description

Return value description

Returns the number of saved-game files.


SavedGameInfo


Returns date/time stamp information about a sub-file.

Returns date/time stamp information about a sub-file.



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

SubFileName

Name of the sub-file.

Return value description

Returns a list with [creation time, modification time, last access time].

If the sub-file doens't exist then this returns FALSE.




SavedGameLoad


Loads in a saved game.

Loads in a saved "game" that was saved by SaveGameSave().



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

SubFileName

Name of the game to load.

RemapObjects

If an object is loaded and it doesn't currently exist then it keeps its old ID.

However, if an object already exists then: If RemapObjects is TRUE then a new ID will be given to the object (and returned; see below). If FALSE then the current object will be replaced with the saved object.

Furthermore, if RemapObjects == FALSE and the game was saved with SavelAll == TRUE then any deleted objects will also be deleted when the game is loaded.


Return value description

If RemapObjects == TRUE then this will return a list of all the objects remapped when they were loaded. Each remapping is a list with the first element being the original object (when it was saved), and the second element being the new object (now that it's loaded).

Otherwise, this returns TRUE on success, or FALSE on failure.




SavedgameName


Given an index into a saved-game file, this returns the sub-file name.

Given an index into a saved-game file, this returns the sub-file name.



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

Index

Index, from 0 .. SavedGameNum()-1.

Return value description

Returns the sub-file's name, or NULL if the index exceeds the number of sub-files.


SavedGameNum


Returns the number of saved game sub-files in a saved-game file.

Returns the number of saved game sub-files in a saved-game file.



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

Return value description

Returns the number of sub-files.


SavedGameRemove


Deletes a saved game.

Deletes a saved game.



Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

SubFileName

Name of the game to delete.

Return value description

TRUE if the game was deleted. FALSE if the game name wasn't found.


SavedGameSave


Saves a game.

This saves a "game". It does so by saving a set of objects. NOTE: It does NOT save any global variables, so no game information that changes should be placed in a global variable at save time.

You can also use it to save a collection of objects, used for instancing.

Parameter Name

Description

FileName

"File name" for the saved game. This must be short (less than 64 characters) and not contain any illegal windows file-name characters, such as \.

SubFileName

Name of the game to save. If a game already exists it will be overwritten.

SaveAll

If TRUE, save all objects except those in the list. It will also note which objects have been deleted and save that information so when the data is reloaded it will delete objects that had been deleted.

If FALSE then save only those objects in the list.

NOTE: You shouldn't save any of the connection objects because when you reload the game the current connection information will be overwritten. The same goes for other objects that depend on run-time.


SaveChildren

If TRUE, automatically expand the list to include children (recursively) of the objects in the list.

ObjectList

List of objects to exclude or include. This can be an empty list if SaveAll == TRUE.

Return value description

TRUE if the game was deleted. FALSE if the game name wasn't found.


ShardParam


Returns a parameter indicating what shard this is.

This returns a parameter indicating what shard this is. It returns the string specified in the TitleInfo resource for the running shard. If the server is running on the hose (no Internet support) then it returns "offline".



Parameter Name

Description

Return value description

String with the shard's parameter.


ShardParamIsOffline


Returns TRUE if this world is runing offline.

Returns TRUE if this world is runing offline.

It calls ShardPram() and returns TRUE if the value is "offline".

NOTE: After this is called once, you can use gShardPramIsOffline for speed. Given all the objects that call this during initialization, you can be absolutely sure that AFTER initialization, gShardParamIsOffline is vlaid.



Parameter Name

Description

Return value description

TRUE if running offline. FALSE if online (and multiple users)


ShutDownImmediately


Causes the (near) immediate shutdown of the server.

This causes the (near) immediate shutdown of the server. This DOES NOT check in any objects that need checking in.

You may wish to call another ShutDownXXX() function that will give players some warning about how long they have before the shutdown occurs, and which will check in necessary objects.

Parameter Name

Description

Restart

If TRUE then the server will restart as soon as it has shut down. Use the automatic restart as a way to clean up memory.

Return value description

None


SortString


Internal sort callback that sorts by a string, case insensative.

Internal sort callback that sorts by a string, case insensative.



Parameter Name

Description

ItemA

First item to compare.

ItemB

Second item to compare.

Return value description

0 if the items are the same, positive if ItemA appears after itemB, and negative if vice versa.

// since the contents are strings, just compare the strings

return ItemA.StringCompare (ItemB, FALSE);


SortSubListString


Internal sort callback that sorts by first element (a string) in the sublist.

Internal sort callback that sorts by first element (a string) in the sublist.



Parameter Name

Description

ItemA

First item to compare.

ItemB

Second item to compare.

Return value description

0 if the items are the same, positive if ItemA appears after itemB, and negative if vice versa.

// since the contents are lists, just compare the first element of the

// list using a string compare.

return ItemA[0].StringCompare (ItemB[0], FALSE);

SortSubListValue


Internal sort callback that sorts by first element (a value) in the sublist.

Internal sort callback that sorts by first element (a value) in the sublist.



Parameter Name

Description

ItemA

First item to compare.

ItemB

Second item to compare.

Return value description

0 if the items are the same, positive if ItemA appears after itemB, and negative if vice versa.

// since the contents are lists, just compare the first element of the

// list using a string compare.

var v1 = ItemA[0];

var v2 = ItemB[0];


if (v1 < v2)

return -1;

else if (v1 > v2)

return 1;

else

return 0; // same


SortSubListValue2


Internal sort callback that sorts by second element (a value) in the sublist.

Internal sort callback that sorts by second element (a value) in the sublist.



Parameter Name

Description

ItemA

First item to compare.

ItemB

Second item to compare.

Return value description

0 if the items are the same, positive if ItemA appears after itemB, and negative if vice versa.

// since the contents are lists, just compare the first element of the

// list using a string compare.

var v1 = ItemA[1];

var v2 = ItemB[1];


if (v1 < v2)

return -1;

else if (v1 > v2)

return 1;

else

return 0; // same


TextLog


Logs a line of text.

This writes a line of text to the log. (You can also write text using TextLogNoAuto() and Trace()).

This uses the actor, room, and user set in TextLogAutoSet().

If the text log is disabled (TextLogEnableSet()), then this won't do anything.



Parameter Name

Description

Text

Text string to log.

Object

(Optional) If the log involves an object, such as oLantern, pass the object in here.

Return value description

TRUE if success. FALSE if an error occurs.


TextLogAutoGet


Returns a value set by TextLogAutoSet().

Returns a value set by TextLogAutoSet().



Parameter Name

Description

Parameter

This is either "actor" (for the player's character), "room" (for the current room), or "user" (for the user object).

Return value description

TRUE if success. FALSE if an error occurs.


TextLogAutoSet


Sets one of the automatic objects for TextLog().

In order to save work for the author, whenever the user sends a command, TextLogAutoSet() is called to remember the current PC (actor), user, and room the character is in. Then, any calls to TextLog() will automatically log the actor, user, and room.



Parameter Name

Description

Parameter

This is either "actor" (for the player's character), "room" (for the current room), or "user" (for the user object).

Object

Pass in an object, or NULL to clear the setting.

Return value description

TRUE if success.


TextLogDelete


Deletes a log file.

Deletes a log file.



Parameter Name

Description

LogID

This is an identifier string for the log, from TextLogEnum().

Return value description

TRUE if the file was deleted. FALSE if it wasn't. A log file won't be deleted if it's read-only, or if it's still in use.


TextLogEnableGet


Returns TRUE if text logging is enabled.

Returns TRUE if text logging is enabled.



Parameter Name

Description

Return value description

Returns TRUE if text logging is enabled.


TextLogEnableSet


Enables or disables text logging.

If you wish to disable text logging completely, such as for an offline game, then call TextLogEnableSet(FALSE).



Parameter Name

Description

Enable

TRUE to enable, FALSE to disable.

Return value description

None


TextLogEnum


Enumerates all the log files that still exist.

Enumerates all the log files that still exist.

The server's MIFL code will probably automatically delete old log files.

Parameter Name

Description

Return value description

Returns a list of log files. Each log file is a sub-list with [LogID, Date]. LogID is a string that identifies the log file, and which can be passed into a few LogTextXXX() functions. Date is the time/date (as per TimeGet()) that the log file covers.


TextLogNoAuto


Logs a line of text.

This writes a line of text to the log. (You can also write text using TextLog() and Trace()).

If the text log is disabled (TextLogEnableSet()), then this won't do anything.

Parameter Name

Description

Text

Text string to log.

Actor

Character object performing the action.

Object

(Optional) If the log involves an object, such as oLantern, pass the object in here.

Room

Room object the action takes place in.

User

User object (if specific to a user) where the object takes place.

Return value description

TRUE if success. FALSE if an error occurs.


TextLogNumLines


Returns the number of lines in a text log.

Returns the number of lines in a text log.

NOTE: This function is somewhat slow so don't call it too often. Try to cache the number.

Parameter Name

Description

LogID

This is an identifier string for the log, from TextLogEnum().

Return value description

The number of lines in the log, or FALSE if there's an error.


TextLogPriorityAdjust


Adjusts the gTextLogSystem and gTextLogUser globals.

Adjusts the gTextLogSystem and gTextLogUser globals. Both of these globals are used to determine which priority events get logged.

TextLogPriorityAdjust() should be called whenever a message is processed from a user, as well as at the end of the processing. It modifies gTextLogSystem and gTextLogUser globals based on gTextLogSystemAlert, as well as the connection's pUserLogAlert.

This also calls TextLogAutoSet() for the "user", "actor", and "room".



Parameter Name

Description

Connection

Connection object, with pUserLogAlert set based on the connection's user.

Return value description

None


TextLogRead


Reads a line from a log file.

Reads a line from a log file. You can find out the number of lines by calling TextLogNumLines().



Parameter Name

Description

LogID

This is an identifier string for the log, from TextLogEnum().

Line

Line number, from 0 to TextLogNumLines().

Return value description

If successful, this returns a list with [Time, String, Actor, Object, Room, User]. Time is the time (as per TimeGet()) when the event occurred. String, Actor, Object, Room, and User are the parameters passed into TextLog(), TextLogNoAuto(), or Trace().


TextLogSearch


Searches through the logs for specific events.

This searches through all the logs (from TextLogEnum()), for events involving a specific search string, actor, object, room, or user.

The search is asyncrhonous, so the results are passed into a callback.

The callback will be passed a list of search results. Each result is a sub-list with [LogID, LineNumber]. LogID is the log file identifier, like from TextLogEnum(). LineNumber is the line number that matches the criteria for the search (such as the string, actor, etc.)



Parameter Name

Description

StartTime

Starting time to search (from TimeGet()). Log entries before this will be ignored.

StopTime

Finishing time (from TimeGet()). Log entries after this will be ignored.

String

Sub-string to search for, case INsensative. This can be NULL, in which case all strings will be accepted.

Actor

Actor (character) that must be mentieond in the log. If this is NULL then all actors are allowed.

Object

Object that must be mentioned in the log line. This can be NULL.

Room

Room that must be mentioned in the log line. This can be NULL.

User

User that must be mentioned in the log line. This can be NULL.

Callback

Either a function or method (with object) that's called. This should accept two parameters. The first is the search results (see main description). The second is Parameter.

Parameter

Parameter to pass into the callback.

Return value description

TRUE if the search was started. FALSE if it failed.


VoiceChatAllowWaves


Call this to allow voice chat wave-bases to be used by various users.

Players can disguise their voices with voice chat. The disguises can include basing their disguised voice off a looped voice recording instead of their normal voice. This allows their voice to sound like a growl, or like a musical instrument, etc.

As a security precaution, the server only allows pre-approved wave files to be used. In order for a wave file to be pre-approved, you must pass a resource into VoiceChatAllowWaves(). This will remember all the wave files from the resource.

Parameter Name

Description

AllowFiles

This is a ... resource. See the main function description.

Return value description

If successful, this returns a list with [Time, String, Actor, True on success.



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