User Tools

Site Tools


dragengine:modules:dragonscript:behavior_interactionelement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dragengine:modules:dragonscript:behavior_interactionelement [2025/05/11 15:07] – created dragonlorddragengine:modules:dragonscript:behavior_interactionelement [2026/11/20 16:24] (current) – [interactionElement.check] dragonlord
Line 33: Line 33:
 ===== interactionElement.update ===== ===== interactionElement.update =====
  
-Update interaction element.+Update interaction element. Parameters are processed in this order: 
 +  * assign 
 +  * interact 
 +  * runEvent 
 +  * clear
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 |interact|string|Interact with stored element. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.| |interact|string|Interact with stored element. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.|
-|interact.parameter|string|Optional parameter to use with ''interaction''.|+|interact.parameters|string|Optional parameters to use with ''interaction''.|
 |assign|string|Assign stored interaction element to another ECBehaviorInteractionElement with identifier value| |assign|string|Assign stored interaction element to another ECBehaviorInteractionElement with identifier value|
-|clear|string|Clear stored interaction element|+|runEvent|string|Run named event on all [[behavior_statemachine|ECBehaviorStateMachine]] instances of the stored interaction element with the element of this behavior as event parameter. Action fails if no element is stored.| 
 +|clear|-|Clear stored interaction element|
  
 This is an example of using this action: This is an example of using this action:
Line 54: Line 59:
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 |set|''true'', ''false''|Interaction element is stored| |set|''true'', ''false''|Interaction element is stored|
 +|flags.set|string|Stored interaction element has [[behavior_flags|ECBehaviorFlags]] with named flag set. Fails if no element is stored.|
 +|flags.clear|string|Stored interaction element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared. Fails if no element is stored.|
 |interact.name|string|Name of interaction| |interact.name|string|Name of interaction|
 |interact.has|''true'', ''false''|Interaction element is stored and interaction with name ''interaction.name'' is present| |interact.has|''true'', ''false''|Interaction element is stored and interaction with name ''interaction.name'' is present|
 |interact.query|''true'', ''false''|Interact with stored element and test result. Condition is true if interaction element is stored, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).| |interact.query|''true'', ''false''|Interact with stored element and test result. Condition is true if interaction element is stored, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
-|interact.parameter|string|Optional parameter to use with ''interaction.query''.|+|interact.parameters|string|Optional parameters to use with ''interaction.query''.| 
 +|matches|<target>|<WRAP>Stored interaction element matches target: 
 +  * ''eventParameter'': State machine content event parameter 
 +</WRAP>| 
 +|matches.not|<target>|<WRAP>Stored interaction element does not match target: 
 +  * ''eventParameter'': State machine content event parameter 
 +</WRAP>|
 |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled|
  
Line 81: Line 94:
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
 |interactionElement.set|''true'', ''false''|Interaction element is stored| |interactionElement.set|''true'', ''false''|Interaction element is stored|
 +|interactionElement.flags.set|string|Stored interaction element has [[behavior_flags|ECBehaviorFlags]] with named flag set.|
 +|interactionElement.flags.clear|string|Stored interaction element has [[behavior_flags|ECBehaviorFlags]] with named flag cleared.|
 |interactionElement.interact.name|string|Name of interaction| |interactionElement.interact.name|string|Name of interaction|
 |interactionElement.interact.has|''true'', ''false''|Interaction element is stored and interaction with name ''interaction.name'' is present| |interactionElement.interact.has|''true'', ''false''|Interaction element is stored and interaction with name ''interaction.name'' is present|
 |interactionElement.interact.query|''true'', ''false''|Interact with stored element and test result. Condition is true if interaction element is stored, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).| |interactionElement.interact.query|''true'', ''false''|Interact with stored element and test result. Condition is true if interaction element is stored, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
-|interactionElement.interact.parameter|string|Optional parameter to use with ''interaction.query''|+|interactionElement.interact.parameters|string|Optional parameters to use with ''interaction.query''| 
 +|interactionElement.matches|<target>|<WRAP>Stored interaction element matches target: 
 +  * ''eventParameter'': State machine content event parameter 
 +</WRAP>| 
 +|interactionElement.matches.not|<target>|<WRAP>Stored interaction element does not match target: 
 +  * ''eventParameter'': State machine content event parameter 
 +</WRAP>|
  
 This is an example of using this condition: This is an example of using this condition:
Line 115: Line 136:
   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.
   * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.   * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
 +  * [[behavior_conversationactor|ECBehaviorConversationActor]]: Add actions and conditions for conversation actor to use.
  
  
Line 150: Line 172:
 <?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
 <elementClass name='MyClass' class='GenericBehaviorElement'> <elementClass name='MyClass' class='GenericBehaviorElement'>
-  <behavior type='ECBehaviorInteractionElement'/>+  <behavior type='ECBehaviorInteractionElement'> 
 +    <!-- optional: add behavior trees. default adds all behavior trees. --> 
 +    <list name='behaviorTrees'> 
 +      <string/> <!-- add behavior with empty identifier --> 
 +      <string>default</string> <!-- add behavior with 'default' identifier --> 
 +    </list> 
 +     
 +    <!-- optional: add state machines. default adds all state machines. --> 
 +    <list name='stateMachines'> 
 +      <string/> <!-- add behavior with empty identifier --> 
 +      <string>default</string> <!-- add behavior with 'default' identifier --> 
 +    </list> 
 +  </behavior>
      
   <!-- for adding multiple behaviors use unique identifiers -->   <!-- for adding multiple behaviors use unique identifiers -->
dragengine/modules/dragonscript/behavior_interactionelement.1746976037.txt.gz · Last modified: by dragonlord