SetListenPattern

From NWN Lexicon
Jump to: navigation, search



SetListenPattern(object, string, int)

Sets an object to listen to a particular pattern.

void SetListenPattern(
    object oObject,
    string sPattern,
    int nNumber = 0
);

Parameters

oObject

The object that will listen for certain things.

sPattern

The patterns of speech to listen for. See Remarks section for details.

nNumber

The index of this particular pattern. (Default: 0)


Description

Sets what oObject to listen for sPattern.

Note: You must call SetListening to actually set the object to listen.



Remarks

You can call this function several times to listen to different things.

Bioware uses this to help with the AI, sending commands through shouts and having its faction members respond appropriately.

From Noel (Bioware):
** will match zero or more characters
*w one or more whitespace
*n one or more numeric
*p one or more punctuation
*a one or more alphabetic
| is or
( and ) can be used for blocks

- setting a creature to listen for "**" will match any string
- telling him to listen for "**funk**" will match any string that contains the word "funk".
- "**(bash|open|unlock)**(chest|door)**" will match strings like "open the door please" or "he just bashed that chest!"


Version

1.26

See Also

functions: 

SetListening

events: 

OnConversation Event



 author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Max Aller