{
    "componentChunkName": "component---src-templates-doc-page-js",
    "path": "/docs/en/common/bot_structure/sc/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Gatsby-doc-engine"}},"markdownRemark":{"id":"69c17b76-850d-5162-84dd-68d01279b9a0","excerpt":"Script files?> Script files are the main files that define the bot operation logic. They have the  extension.  or  is the main file of the chat bot script from…","html":"<h1>Script files</h1>\n<hr>\n<p class='warn'>Script files are the main files that define the bot operation logic. They have the <code class=\"language-text\">.sc</code> extension.</p>\n<p><code class=\"language-text\">main.sc</code> or <code class=\"language-text\">entryPoint.sc</code> is the main file of the chat bot script from which the script starts to load. The file must be located in the <code class=\"language-text\">src</code> folder that may also contain files with additional scripts, <code class=\"language-text\">.csv</code> dictionaries and <code class=\"language-text\">.js</code> scripts.</p>\n<p>The script file includes: subject, state list, patterns, loaded files and responses. Other scripts and JS files can be loaded at the start of the script via the <code class=\"language-text\">require</code> tag.</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">require:</span> scenarios/*.sc\n<span class=\"token keyword\">require:</span> scripts/functions.js</code></pre></div>\n<p>A chat bot script is written in the <a href=\"/1.10.3/docs/en/JAICP_DSL/about_dsl\">JAICP DSL</a> language. JAICP DSL (Domain Specific Language) is the language used to define chat bot operation logic. It provides a user friendly format you can use to describe a finite state automation as the basis for your chat bot.</p>\n</br>\n<h4>File structure</h4>\n<p>A chat bot script is defined in a text file with a tree structure. This means some elements are nested in others. These elements are states of the system it can switch to in the course of a conversation. E.g. a greeting or a number processing <a href=\"/1.10.3/docs/en/JAICP_DSL/tags/declarative_tags/state\">state</a>.</p>\n<p>Generic states include more specific states. For example, a loan application processing state can include a loan type question state.</p>\n<p class='warn'>The nested level depends on the indent, like in the <code class=\"language-text\">python</code> and <code class=\"language-text\">yaml</code> language.</p>\n<p>The greater is the indent (and the further to the right the element is), the higher is its nested level, the more parent states it has, and the longer is its name.</p>\n<p>Let’s look at a sample script snippet:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">theme:</span> /BankTheme\n\n<span class=\"token keyword\">state:</span> Loan\n        \t<span class=\"token storageType\">q!:</span> * loan* *\n        \t<span class=\"token variableParameter\">a:</span> How can I help you?\n\n        \t<span class=\"token keyword\">state:</span> TakeLoan\n            \t\t<span class=\"token storageType\">q:</span> * ~get a loan* *\n            \t\t<span class=\"token variableParameter\">a:</span> What kind of a loan would you like?\n\n            \t\t<span class=\"token keyword\">state:</span> LoanTypes\n                \t\t<span class=\"token storageType\">q:</span> * (car*|~mortgage|person*) *\n                \t\t<span class=\"token variableParameter\">go!:</span> /FillTheLoanForm</code></pre></div>\n</br>\n<p>State path depending on the nested level:</p>\n<table>\n<thead>\n<tr>\n<th>State</th>\n<th>Full path</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Loan</td>\n<td><code class=\"language-text\">/BankTheme/Loan</code></td>\n</tr>\n<tr>\n<td>TakeLoan</td>\n<td><code class=\"language-text\">/BankTheme/Loan/TakeLoan</code></td>\n</tr>\n<tr>\n<td>LoanTypes</td>\n<td><code class=\"language-text\">/BankTheme/Loan/TakeLoan/LoanTypes</code></td>\n</tr>\n</tbody>\n</table>\n</br>\n<h4>Script file example</h4>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">patterns:</span>\n    $hello = (greetings|hi|hello|aloha|good (day|evening))\n\n<span class=\"token keyword\">theme:</span> /\n\n    <span class=\"token keyword\">state:</span> Hello\n        <span class=\"token storageType\">q!:</span> $hello *\n        <span class=\"token variableParameter\">a:</span> Hello!\n        <span class=\"token variableParameter\">go!:</span> /Can I Help You?\n\n    <span class=\"token keyword\">state:</span> Can I Help You?\n        <span class=\"token variableParameter\">a:</span> Can I help you?\n\n        <span class=\"token keyword\">state:</span> Yes\n            <span class=\"token storageType\">q!:</span> * { (*can you|*can you) * help me } *\n            <span class=\"token storageType\">q:</span> * [I think] (yes|*can you|*can you|I hope|it would be) *\n            <span class=\"token variableParameter\">a:</span> What would you like?\n\n        <span class=\"token keyword\">state:</span> No\n            <span class=\"token storageType\">q:</span> * [yes] [already] (nothing|not needed|not necessary) [thank you] *\n            <span class=\"token variableParameter\">a:</span> Good. I will be glad to help you next time!</code></pre></div>","frontmatter":{"title":"","description":null},"headings":[{"value":"Script files"}]}},"pageContext":{"slug":"/docs/en/common/bot_structure/sc/","previous":{"fields":{"slug":"/docs/en/common/bot_structure/sys_modules/"},"frontmatter":{"title":"","description":null}},"next":{"fields":{"slug":"/docs/en/common/bot_structure/modules/"},"frontmatter":{"title":"","description":null}}}},
    "staticQueryHashes": ["1209419333"]}