This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
dragengine:modules:dragonscript:behavior_interactprompt [2024/03/14 16:55] – dragonlord | dragengine: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 | + | Element class properties have the prefix |
===== 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.image" | + | * Full name: '' |
- | * Type image path | + | * Type: string |
- | * Default Value //null// | + | * File Pattern: '' |
+ | * Default Value: '' | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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.video" | + | * Full name: '' |
- | * Type video path | + | * Type: string |
- | * Default Value //null// | + | * File Pattern: '' |
+ | * Default Value: '' | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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) | + | 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) |
- | * Full name: "interactPrompt.style" | + | * Full name: '' |
- | * Type string | + | * Type: string |
- | * Default Value //empty string// | + | * Default Value: empty string |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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"// | + | Short text indicating to the player what kind of interaction will take place. This is typically a single word or two like '' |
- | * Full name: "interactPrompt.verb" | + | * Full name: '' |
- | * Type unicode string | + | * Type: unicode string |
- | * Default Value //empty string// | + | * Default Value: empty string |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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.description" | + | * Full name: '' |
- | * Type unicode string | + | * Type: unicode string |
- | * Default Value //empty string// | + | * Default Value: empty string |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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 '' |
- | * Full name: "interactPrompt.command" | + | * Full name: '' |
- | * Type string | + | * Type: string |
- | * Default Value //empty string// | + | * Default Value: empty string |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
===== 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 '' |
- | * Full name: "interactPrompt.bones" | + | * Full name: '' |
- | * Type string list | + | * Type: string list |
- | * Default Value //empty list// | + | * Default Value: empty list |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
< | < | ||
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.enabled" | + | * Full name: '' |
- | * Type boolean | + | * Type: boolean |
- | * Default Value //true// | + | * Default Value: '' |
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
- | |||
====== 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 ====== | ||
# | # | ||
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== 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 | ||
</ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | | ||
+ | <!-- for adding multiple behaviors use unique identifiers --> | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Live Examples ====== | ||
+ | |||
+ | * [[https:// | ||
+ |