Rule: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 4: | Line 4: | ||
Rule consists of one or more criteria and a response. The final score for a rule is the sum of all of the scores of its criteria. | Rule consists of one or more criteria and a response. The final score for a rule is the sum of all of the scores of its criteria. | ||
<pre> | <pre>rule <rulename> | ||
rule <rulename> | |||
{ | { | ||
criteria name1 [name2 name3 etc.] | criteria name1 [name2 name3 etc.] | ||
Line 11: | Line 10: | ||
[matchonce] ; optional parameter | [matchonce] ; optional parameter | ||
[ <matchkey > <matchvalue> weight nnn required ] | [ <matchkey > <matchvalue> weight nnn required ] | ||
} | }</pre> | ||
</pre> | |||
*matchonce (off by default): means that the rule is deactivated after the first time it is matched | *matchonce (off by default): means that the rule is deactivated after the first time it is matched | ||
Line 19: | Line 17: | ||
Here is a example from <code>scripts/talker/npc_alyx.txt</code>. | Here is a example from <code>scripts/talker/npc_alyx.txt</code>. | ||
<pre> | <pre>rule AlyxTalkPlayerPushed | ||
rule AlyxTalkPlayerPushed | |||
{ | { | ||
criteria IsAlyx ConceptTalkPlayerPushed SeenByPlayer NoRecentCombat | criteria IsAlyx ConceptTalkPlayerPushed SeenByPlayer NoRecentCombat | ||
response AlyxTalkPlayerPushed | response AlyxTalkPlayerPushed | ||
} | }</pre> | ||
</pre> |
Revision as of 21:07, 7 August 2005
Rule consists of one or more criteria and a response. The final score for a rule is the sum of all of the scores of its criteria.
rule <rulename> { criteria name1 [name2 name3 etc.] response responsegroupname [responsegroupname2 etc.] [matchonce] ; optional parameter [ <matchkey > <matchvalue> weight nnn required ] }
- matchonce (off by default): means that the rule is deactivated after the first time it is matched
Note: additional "unnamed" criteria can be specified inline in the rule using the same syntax as for defining a criterion, except for the criterion keyword and the criterion name keys.
Here is a example from scripts/talker/npc_alyx.txt
.
rule AlyxTalkPlayerPushed { criteria IsAlyx ConceptTalkPlayerPushed SeenByPlayer NoRecentCombat response AlyxTalkPlayerPushed }