KIND Behavior-Template

From TrainzOnline
Jump to: navigation, search

KIND Behavior-Template assets are best described as a saved group of Behavior assets and their configured properties. They're one of the small group of assets that's created and edited entirely 'in game', specifically in the Surveyor Rules interface on the Edit Session dialog. If you are not familiar with Session rules, it's recommended you read the KIND_Behavior and Session Rules Overview pages first.

Contents

KIND Hierarchy

Parent Classes

Child Classes

  • none.


Supported Tags

The KIND Region config.txt file supports the following tags (in addition to the tags inherited from the parent).

It is not recommended to attempt to create or edit behavior-template assets by hand, the in-game interface should always be used. For details on how to create and edit behavior-templates, see HowTo/Create a Behavior Template.

 template-description
 
 template-properties
 {
 }
 
 rule-properties
 {
 }


template-description

Type: string-table token
Compulsory: Yes
Default: none
Desc: Specifies the description of the asset to show in edit dialog for the template itself.

template-properties

Type: template-properties
Compulsory: Yes
Default: none
Desc: Lists the properties that can be edited for the template itself. The properties are typically bound to the properties of one or more child rules. This container should not be edited by hand.

rule-properties

Type: rule-properties
Compulsory: Yes
Default: none
Desc: Lists the properties of the child rules that make up the template. This container should not be edited by hand.

Example Config.txt

Sample config.txt file for a behavior-template asset:

 username               "End Session on Derailment"
 kind                   "behavior-template"
 kuid                   <kuid:401543:20020>
 trainz-build           3.4
 category-class         "YR"
 description            "Waits for a derailment to occur, then shows an failure dialog and ends the session when it's closed."
 
 string-table 
 {
   template-description                  "End Session on Derailment"
 }
 
 template-properties
 {
 }
 
 rule-properties
 {
   0
   {
     kuid                                <kuid:-25:1262>
     indent                              0
     
     rule-template-bindings
     {
     }
     
     data
     {
       configassethandler.configprefix   "derail-run-once"
       configassethandler.assetkuid      <kuid:-25:1262>
       genericboolhandler.boolvalue      1
       scenariobehavior.stateflags       1
       conditionalscenariobehavior.isflagged 0
       conditionalscenariobehavior.doeshavechildrulesrunning 0
     }
   }
   
   1
   {
     kuid                                <kuid:-25:1050>
     indent                              1
     
     rule-template-bindings
     {
     }
     
     data
     {
       scenariobehavior.stateflags       9
       modifyscorerule.modifiervariable  "derailed"
       modifyscorerule.modifieramount    1
       modifyscorerule.modifieraction    0
       modifyscorerule.minimum           100
       modifyscorerule.maximum           100
       modifyscorerule.hasminimum        0
       modifyscorerule.hasmaximum        0
       modifyscorerule.undoaction        0
     }
   }
   
   2
   {
     kuid                                <kuid:-25:1273>
     indent                              1
     
     rule-template-bindings
     {
     }
     
     data
     {
       scenariobehavior.stateflags       1
       pause                             0
       location                          1
       mode                              0
       html-page-name                    
       html-text-name                    
       session-icon-asset                <kuid2:523:19721244:2>
       session-string-fallback           "There has been a derailment.  This session will now be terminated."
       wave-name                         
       autoplay                          0
       browser-open                      0
       children-running                  0
     }
   }
   
   3
   {
     kuid                                <kuid:401543:1186>
     indent                              2
     
     rule-template-bindings
     {
     }
     
     data
     {
       scenariobehavior.stateflags       1
       conditionalscenariobehavior.isflagged 0
       conditionalscenariobehavior.doeshavechildrulesrunning 0
     }
   }
   
   4
   {
     kuid                                <kuid:-25:1267>
     indent                              3
     
     rule-template-bindings
     {
     }
     
     data
     {
       scenariobehavior.stateflags       9
       endscenariorule.fadetime          5
       wait-for-completion               1
     }
   }
 }
 
 thumbnails 
 {
   0
   {
     width                               64
     height                              64
     image                               "default-generic-icon.tga"
   }
   
   1
   {
     width                               240
     height                              180
     image                               "default-generic-thumbnail.jpg"
   }
 }

Downloads

Example Asset

The following download is a CDP of the example asset listed above. This behavior template will wait for a train derailment to occur, show a failure dialog, and the end the Session when that dialog is closed. Using the template, this common set of rules can be placed in any Session without the need to configure it, or remember exactly how it needs to be structured. This asset is also available from the Download Station as <kuid:401543:20020>. File:End Session on Derailment.cdp

Categories

Personal tools