Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorStashable
Behavior element behavior adding support for elements to be placed in ECBehaviorInventory.
This behavior can be used only once on an element.
Element class properties have the prefix stashable.
.
Set image to display in inventory screens.
stashable.image
*.webp
, *.png
, *.jpg
(all image modules)<string name='stashable.image'>inventory.webp</string>
Set video to display in inventory screens.
stashable.video
*.webm
(all video modules)<string name='stashable.video'>inventory.webm</string>
Set name to display in inventory screens.
stashable.name
<string name='stashable.name'>Cool Tool</string>
Set description to display in inventory screens.
stashable.description
<string name='stashable.description'>A cool tool every adventurer needs.</string>
Stashable has been added to inventory.
Stashable has been remove from inventory.
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does not required element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which contains a resources.
class MyElement extends BehaviorElementClass public var ECBehaviorStashable stashable func new() stashable = ECBehaviorStashable.new(this) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorStashable'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>Cool Tool</string> </behavior> </elementClass>