[Crossfire-wiki] [Crossfire DokuWiki] page changed: dev:objects
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Fri Dec 1 05:43:16 CST 2006
A page in your DokuWiki was added or changed. Here are the details:
Date : 2006/12/01 05:43
User : ryo
Edit Summary: format
@@ -326,23 +326,24 @@
And then there is the NPC features made by Karl Holland (see attack_movement)
Note that scared creatures will become unscared at some point, so it
is typically not useful to set this in maps or in archetypes.
+
===== NPC's Speak out =====
The message structure in a monster may contain:
+ <code>
@match <key>|<key>[...]
[text]
[...]
+ </code>
- This identifies what the monster will say if talked to with a text that matches
- any keys. They keys are processed as primitive regular expressions, so some
- characters act as match operators or metacharacters. The asterisk, caret,
- square braces, and dollar characters are useful to some degree.
+ This identifies what the monster will say if talked to with a text that matches any keys. They keys are processed as primitive regular expressions, so some characters act as match operators or metacharacters. The asterisk, caret, square braces, and dollar characters are useful to some degree.
An example of usage:
+ <code>
@match hello|hi
Welcome, good friend!
@match bye
Goodbye!
@@ -353,24 +354,21 @@
@match ^no$
You're lucky!
@match *
What did you sssay?
+ </code>
- a. Wildcard Character
-
- A key containing only '*' will match anything, but it is not handled in the
- same way that regular expressions are normally handled.
+ ==== Wildcard Character ====
+ A key containing only '*' will match anything, but it is not handled in the same way that regular expressions are normally handled.
- If a message does not contain an '@match *', then the first key that contains
- an asterisk will be treated as though the key was '*'. In the example below,
- if the player says anything, the NPC will say 'Nice tune...' no matter what the
- player says, even if it does not end with 'bug'. It will not be possible for
- the NPC to say 'Bah, humbug to you!'.
+ If a message does not contain an '@match *', then the first key that contains an asterisk will be treated as though the key was '*'. In the example below, if the player says anything, the NPC will say 'Nice tune...' no matter what the player says, even if it does not end with 'bug'. It will not be possible for the NPC to say 'Bah, humbug to you!'.
+ <code>
@match hum*
Nice tune...
@match *bug
Bah, humbug to you!
+ </code>
Avoid using '*' except in the form '@match *'. If the above conversation were
amended to also contain a '@match *', neither the 'hum*' nor the '*bug' keys
would work.
@@ -382,37 +380,37 @@
player enters any word with 'yes' in it! If a conversation contains the word
'yesterday' or 'nobody', the player might type one of these words and the NPC
might think they said 'yes' or 'no'.
- b. Word Boundaries
+ ==== Word Boundaries ====
If you want to prevent a match string from matching partial words, use the '^'
and '$' metacharacters to bound the word. In the first example, the NPC only
responds when the player says 'no', and not when the player says any other
word that contains 'no'.
- c. Case Insensitivity
+ ==== Case Insensitivity ====
Keys need not contain case variations even though old maps often did. For
example, '@match hello' works just as well as the more verbose versions like
'@match Hello|hello' and '@match "[Hh]ello'. The matches are done after both
the match list and the player text are converted to lowercase.
- d. Multiple Choice
+ ==== Multiple Choice ====
The square braces may be used to construct special matches. For example, a
key of '[jy]ello' would match 'jello' or even 'yellow'.
- e. Quest support
+ ==== Quest support ====
As a special case, if the line just after match is 'quest xxx', then
the NPC will only display the text (without the quote line) if the player
is currently doing indicated quest. See also 'quests' document.
Obviously this feature can be expanded extensively, so expect it
to evolve till the next version.
- f. Other Considerations
+ ==== Other Considerations ====
You might not want to put messages into archetype creatures, this feature is
more for making special NPCs for maps. However, certain generic messages in
archetypes might add to the general game ambiance a bit (by default: dogs
IP-Address : 213.174.127.3
Old Revision: http://wiki.metalforge.net/doku.php/dev:objects?rev=1164973237
New Revision: http://wiki.metalforge.net/doku.php/dev:objects
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list