Rule: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
Line 16: Line 16:
{{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.}}
{{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 <code>scripts/talker/npc_alyx.txt</code>.
Here is an example from <code>scripts/talker/npc_alyx.txt</code>.
<pre>rule AlyxTalkPlayerPushed
<pre>rule AlyxTalkPlayerPushed
{
{

Latest revision as of 08:57, 21 February 2025

Stub

This article or section is a stub. You can help by expanding it.

A 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.pngNote: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 an example from scripts/talker/npc_alyx.txt.

rule AlyxTalkPlayerPushed
{
	criteria		IsAlyx  ConceptTalkPlayerPushed SeenByPlayer NoRecentCombat
	response		AlyxTalkPlayerPushed
}