Step 4 - Custom

This page provides details about writing your custom behaviors for articles and actions of your VR product.

This step allows you to write your customer behavior outcomes for articles and their action-responses. The articles and their respective action-responses are made available to design your Virtual Reality Scene behaviors. Following are the allowed code-constraints to write your behaviors (customized business rules).

Behaviors can be written using conditional statements. We have created customized conditional constructs which are easy for non-coding practitioners like Requirement Analysts to author behaviors at their convenience.

Following are the allowed Syntax conditional constructs

If

This is used as if type behavior conditional expression. Following is the conditional construct. The text in italics is for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: If#< behavior condition >#:< behavior outcome here >!

Elf

This is used as Else-if type behavior conditional expression. Following is the conditional construct. The text in italics is for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: EIf#< behavior condition >#:

< behavior outcome here >

<behavior outcome here >!

Switch

This is a typical Switch case type behavior conditional expression. Following is the conditional construct. The text in italics is for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: Switch#< behavior condition >#:

case#< behavior outcome here >#:<behavior outcome here >

case#< behavior outcome here >#:<behavior outcome here >

case#< behavior outcome here >#:<behavior outcome here >

default:<behavior outcome here >!

For

This is a typical for loop type behavior conditional expression. Following is the conditional construct. The text in italics is for for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: For#< behavior initialization>/< behavior range>/< behavior iteration>#:

<behavior outcome here >!

While

This is a typical while loop type behavior conditional expression. Following is the conditional construct. The text in italics is for for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: While#< behavior initialization>#:

<behavior outcome here >!

Do-While

This is a typical Do-While loop type behavior conditional expression. Following is the conditional construct. The text in italics is for for expression behavior condition and behavior outcome if the condition succeeds.

Syntax: Do#< behavior outcome>#:

While<behavior condition >!

Here is the backend template of custom.json file

{
	"behavior":[
	{
		"bid":"",
		"bname":"",
		"bdescription":"",
		"articlesused":"",
		"logic":""
	}
	],
	
	"borderasync": "",
	"bordersync": ""
}

Here is the finalized template of custom.json before getting published into the database

If we observe the behavior rules are converted into BASE-64 encoding as we cannot save a code-snippet inside a JSON file. We provide a provision to decode the BASE-64 behavior rule for pracitioners to review the behavior logic.

{
	"behavior":[
	{
		"bid":"pinfall",
		"bname":"behavior for pin fall",
		"bdescription":"",
		"articlesused":"",
		"logic":"aWYoIHtfZ2FtZWJhbGwgJGhpdHMgX2FueXBpbn0gT1Ige19hbnlwaW4gJGhpdHMgX2FueXBpbn0pCnRoZW4gJGZhbGwoX2FueXBpbik="
	},
	{
		"bid":"scoreupdate",
		"bname":"rule for scoring",
		"bdescription":"",
		"articlesused":"",
		"logic":"aWYgKCRyb2xsID0gdHJ1ZSkKcG9pbnQgPSAjY291bnQoJGZhbGwoX2FueXBpbikpICogaW5kX3BvaW50CmVsc2UgCnBvaW50ID0gbnVsbAo="
	},
	{
		"bid":"strikescore",
		"bname":"rule for scoring",
		"bdescription":"",
		"articlesused":"",
		"logic":"aWYgKHskcm9sbCA9IHRydWV9IEFORCB7I2NvdW50KCRmYWxsKF9hbnlwaW4pPTEwfSkKdGhlbiBwb2ludCA9IHN0cmlrZV9wb2ludAplbHNlCnBvaW50ID0gbnVsbA=="
	}
	]
}

Managing State

{
    "state": [
        {
          "id": "",
          "name":"",
          "initial": "",
          "transition":[
            {
              "event":"", 
              "target":""
            },
			{
              "event":"", 
              "target":""
            }
          ]
          "final":""
        },
        {
          "id": "",
          "name":"",
          "initial": "",
          "transition":[
            {
              "event":"", 
              "target":""
            },
			{
              "event":"", 
              "target":""
            }
          ]
          "final":""
        }
    ]
}

Last updated