User Tools

Site Tools


dragengine:modules:dragonscript:behavior_interactprompt

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
dragengine:modules:dragonscript:behavior_interactprompt [2024/03/14 16:55] dragonlorddragengine:modules:dragonscript:behavior_interactprompt [2025/03/12 20:36] (current) dragonlord
Line 37: Line 37:
 ====== Element Class Properties ====== ====== Element Class Properties ======
  
-Element class properties have the prefix **interactPrompt.** or **interactPrompt(id).** if id is not empty.+Element class properties have the prefix ''interactPrompt.'' or ''interactPrompt(id).'' if id is not empty.
  
 ===== image ===== ===== image =====
 Path to image to use as icon displayed for the prompt. Path to image to use as icon displayed for the prompt.
-  * Full name: "interactPrompt.imageor "interactPrompt(id).image" +  * Full name: ''interactPrompt.image'' or ''interactPrompt(id).image'' 
-  * Type image path +  * Type: string 
-  * Default Value //null//+  * File Pattern: ''*.webp'', ''*.png'', ''*.jpg'' (all image modules) 
 +  * Default Value: ''null''
   * Example (*.deeclass) <code xml><string name='interactPrompt.image'>useItem.png</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.image'>useItem.png</string></code>
  
 ===== video ===== ===== video =====
 Path to video to use as icon displayed for the prompt. If both image and video are used the prompt widget decides which one (or both) to use. The default widget supports both with the video layered on top of the image. This can be used to show a static image with a smaller video inside. Path to video to use as icon displayed for the prompt. If both image and video are used the prompt widget decides which one (or both) to use. The default widget supports both with the video layered on top of the image. This can be used to show a static image with a smaller video inside.
-  * Full name: "interactPrompt.videoor "interactPrompt(id).video" +  * Full name: ''interactPrompt.video'' or ''interactPrompt(id).video'' 
-  * Type video path +  * Type: string 
-  * Default Value //null//+  * File Pattern: ''*.webm'' (all video modules) 
 +  * Default Value: ''null''
   * Example (*.deeclass) <code xml><string name='interactPrompt.video'>useItem.ogv</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.video'>useItem.ogv</string></code>
  
 ===== style ===== ===== style =====
-Optional style identifier. The prompt widget decides how to use this identifier. The default widget appends this identifier to the designer selector. Hence in your GUI theme you can use then designers named (for example) //"Label.InteractPromptEntry.{style}"// to modify the text color for different prompt styles. If the style is empty string the unmodified designer selector is used (in this example //"Label.InteractPromptEntry"//). +Optional style identifier. The prompt widget decides how to use this identifier. The default widget appends this identifier to the designer selector. Hence in your GUI theme you can use then designers named (for example) ''Label.InteractPromptEntry.{style}'' to modify the text color for different prompt styles. If the style is empty string the unmodified designer selector is used (in this example ''Label.InteractPromptEntry''). 
-  * Full name: "interactPrompt.styleor "interactPrompt(id).style" +  * Full name: ''interactPrompt.style'' or ''interactPrompt(id).style'' 
-  * Type string +  * Typestring 
-  * Default Value //empty string//+  * Default Valueempty string
   * Example (*.deeclass) <code xml><string name='interactPrompt.style'>blueColored</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.style'>blueColored</string></code>
  
 ===== verb ===== ===== verb =====
-Short text indicating to the player what kind of interaction will take place. This is typically a single word or two like //"Use"////"Pick Up"// or //"Interact"//+Short text indicating to the player what kind of interaction will take place. This is typically a single word or two like ''Use''''Pick Up'' or ''Interact''
-  * Full name: "interactPrompt.verbor "interactPrompt(id).verb" +  * Full name: ''interactPrompt.verb'' or ''interactPrompt(id).verb'' 
-  * Type unicode string +  * Typeunicode string 
-  * Default Value //empty string//+  * Default Valueempty string
   * Example (*.deeclass) <code xml><string name='interactPrompt.verb'>Interact</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.verb'>Interact</string></code>
  
 ===== description ===== ===== description =====
 Optional description text indicating in detail to the player what kind of interaction will take place. This is a typically an entire sentence which can be displayed near the prompt or at the top/bottom edge of the screen. For certain game scenarios this can be useful. Most of the time you do not to use this property. The default prompt widget does display the description underneath the verb. Optional description text indicating in detail to the player what kind of interaction will take place. This is a typically an entire sentence which can be displayed near the prompt or at the top/bottom edge of the screen. For certain game scenarios this can be useful. Most of the time you do not to use this property. The default prompt widget does display the description underneath the verb.
-  * Full name: "interactPrompt.descriptionor "interactPrompt(id).description" +  * Full name: ''interactPrompt.description'' or ''interactPrompt(id).description'' 
-  * Type unicode string +  * Typeunicode string 
-  * Default Value //empty string//+  * Default Valueempty string
   * Example (*.deeclass) <code xml><string name='interactPrompt.description'>Open the door</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.description'>Open the door</string></code>
  
 ===== command ===== ===== command =====
-Name of the input command required to be used by the player to activate the interaction. If matching an input command name defined by the game the default prompt widget will look up the bindings assigned by the player and shows them below the verb. If the name is //empty string// no bindings will be shown by the default prompt widget. +Name of the input command required to be used by the player to activate the interaction. If matching an input command name defined by the game the default prompt widget will look up the bindings assigned by the player and shows them below the verb. If the name is ''empty string'' no bindings will be shown by the default prompt widget. 
-  * Full name: "interactPrompt.commandor "interactPrompt(id).command" +  * Full name: ''interactPrompt.command'' or ''interactPrompt(id).command'' 
-  * Type string +  * Typestring 
-  * Default Value //empty string//+  * Default Valueempty string
   * Example (*.deeclass) <code xml><string name='interactPrompt.command'>primaryAction</string></code>   * Example (*.deeclass) <code xml><string name='interactPrompt.command'>primaryAction</string></code>
  
 ===== bones ===== ===== bones =====
-List of bones to restrict the interact prompt to. This is typically used with [[behavior_lookat|ECBehaviorLookAt]] and similar behaviors using collision tests to figure out what the player wants to interact with. These collision tests also return the name of the hit bone or //null// if this information can not be found. Using the bones property an element can have multiple interact prompts each only showing up if the player looks or clicks at the right spot. +List of bones to restrict the interact prompt to. This is typically used with [[behavior_lookat|ECBehaviorLookAt]] and similar behaviors using collision tests to figure out what the player wants to interact with. These collision tests also return the name of the hit bone or ''null'' if this information can not be found. Using the bones property an element can have multiple interact prompts each only showing up if the player looks or clicks at the right spot. 
-  * Full name: "interactPrompt.bonesor "interactPrompt(id).bones" +  * Full name: ''interactPrompt.bones'' or ''interactPrompt(id).bones'' 
-  * Type string list +  * Typestring list 
-  * Default Value //empty list//+  * Default Valueempty list
   * Example (*.deeclass) <code xml><list name='interactPrompt.bones'>   * Example (*.deeclass) <code xml><list name='interactPrompt.bones'>
   <string>bigBadButton</string>   <string>bigBadButton</string>
Line 92: Line 94:
 ===== enabled ===== ===== enabled =====
 Determines if the interact prompt is enabled. The enabled state can be changed during runtime. This allows to create interact prompts which the player has to first activate somehow. Determines if the interact prompt is enabled. The enabled state can be changed during runtime. This allows to create interact prompts which the player has to first activate somehow.
-  * Full name: "interactPrompt.enabledor "interactPrompt(id).enabled" +  * Full name: ''interactPrompt.enabled'' or ''interactPrompt(id).enabled'' 
-  * Type boolean +  * Typeboolean 
-  * Default Value //true//+  * Default Value: ''true''
   * Example (*.deeclass) <code xml><boolean name='interactPrompt.enabled'>true</boolean></code>   * Example (*.deeclass) <code xml><boolean name='interactPrompt.enabled'>true</boolean></code>
- 
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
 +
 This behavior does not required other behaviors to be present. This behavior does not required other behaviors to be present.
  
 ====== Optional Behaviors ====== ====== Optional Behaviors ======
 +
 This behavior does not support optional behaviors. This behavior does not support optional behaviors.
  
 ====== Persistency ====== ====== Persistency ======
-This behavior does not use persistency.+ 
 +This behavior does not required element class to be persistable (setPersistable).
  
 ====== API Documentation ====== ====== API Documentation ======
 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorInteractPrompt.html,ECBehaviorInteractPrompt~@#. #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorInteractPrompt.html,ECBehaviorInteractPrompt~@#.
  
-Since DragonScript Module Version **1.1**+Since DragonScript Module Version ''1.1''
  
 ====== Use Cases ====== ====== Use Cases ======
 +
   * Show how player can interact with objects in the game world he is looking at. Requires the object to use ECBehaviorInteractPrompt while the actor (player) requires to use [[behavior_lookat|ECBehaviorLookAt]] and [[behavior_playerlookatinteractprompt|ECBehaviorPlayerLookAtInteractPrompt]].   * Show how player can interact with objects in the game world he is looking at. Requires the object to use ECBehaviorInteractPrompt while the actor (player) requires to use [[behavior_lookat|ECBehaviorLookAt]] and [[behavior_playerlookatinteractprompt|ECBehaviorPlayerLookAtInteractPrompt]].
  
Line 159: Line 164:
 end end
 </code> </code>
 +
 +====== Behavior Factory ======
 +
 +Using element class supporting adding behaviors the behavior can be added like this:
 +<code xml>
 +<?xml version='1.0' encoding='UTF-8'?>
 +<elementClass name='MyClass' class='GenericBehaviorElement'>
 +  <behavior type='ECBehaviorInteractPrompt'>
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <string name='.verb'>Interact</string>
 +  </behavior>
 +  
 +  <!-- for adding multiple behaviors use unique identifiers -->
 +  <behavior type='ECBehaviorInteractPrompt' id='second'/>
 +</elementClass>
 +</code>
 +
 +====== Live Examples ======
 +
 +  * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]
 +
dragengine/modules/dragonscript/behavior_interactprompt.txt · Last modified: 2025/03/12 20:36 by dragonlord