# How the script is chosen

Before reading, we recommend that you read the [article about scripts. ](https://app.gitbook.com/o/-M0DMiuC0q5onO-ID_le/s/uRfd5lEYYH6D50QjzeAX/~/changes/996w3IhouLXkvHdJdNpB/beginning-of-work/more-about-scripts)

When an event occurs, to which you set a reaction in one of the scenarios, the bot starts checking the scenarios to find the best one.&#x20;

For example, you have created several scripts and in each of them you have set a "user input" event with the expectation of a particular message.&#x20;

When the subscriber writes one of these messages to the bot, or another script trigger condition is triggered, the bot will start executing the corresponding chain.&#x20;

Note that within a script, you can specify multiple chains at once. To do this, it is enough to create several start events inside the script:

![](/files/qiJy9c3Lx5TWkmtBgEJp)

The screenshot shows 3 events, from which there are different chains. But all these events are combined into one scenario. In fact, a script is a set of events and bot logic united by one subject area. For example, you can make a "delivery questions" script and add several chains there that will answer the questions "what cities do you deliver to", "how long does it take for delivery", "how much does delivery cost", and so on.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smartbotpro.io/scripts/basics/how-the-script-is-chosen.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
