# 莱卡场景

### 创建场景请求 <a href="#c7d9ecae-19cf-4c75-8e02-70822c306e5d" id="c7d9ecae-19cf-4c75-8e02-70822c306e5d"></a>

莱卡为 Web3 开发人员提供了一个强大的工具包。 这些强大的工具之一是能够为您的智能合约场景创建节点图！ 您可以连接任意数量的调用和条件，直接在工作区中创建 dapp 流，以使用您的集合测试和开发多调用事件。 在这里，我们将带您通过一个小示例来了解如何使用此功能。 做好准备。 创建您需要的所有请求并粘贴您要与之交互的合约的地址。

想要了解更多关于创建请求的问题，请参阅 [创建新请求](/docs/docs-cn/ji-chu/chuang-jian-xin-qing-qiu.md).

<figure><img src="/files/KkvK7WPdi2VUTCY5Zgj6" alt=""><figcaption><p>Laika工作区，包含收藏集中的创建请求</p></figcaption></figure>

一起看看吧！选中左侧仪表盘&#x7684;**\[Scenario Request (beta)]**&#x20;

<figure><img src="/files/dymL9weYCaLKoCuF0P7b" alt=""><figcaption></figcaption></figure>

选中 **\[ New ]** 来新建场景。

<figure><img src="/files/dymL9weYCaLKoCuF0P7b" alt=""><figcaption></figcaption></figure>

为场景命名然后点击 **\[ Create ]**

<figure><img src="/files/qAr5JpwwecHgPAHPpzIM" alt=""><figcaption></figcaption></figure>

对于场景请求节点图，您可以使用 3 种类型的节点。&#x20;

1. 请求节点：用于根据您定义的参数传递请求&#x20;
2. 条件节点：用于设置条件（即 if 函数）&#x20;
3. 连接器节点：用于将场景的流从 2 个流合并为 1 个流

创建节点有以下两种方式：

* 从工具箱（在场景仪表盘的最下方）中拖拽你想要使用的节点

<figure><img src="/files/E99TWiYvMcF8AnjhVc1m" alt=""><figcaption></figcaption></figure>

* 在场景仪表盘的任意处右击鼠标并选择你想创建的节点。

<figure><img src="/files/aoEGKd6ywxuFyyfb3WPs" alt=""><figcaption></figcaption></figure>

### **使用请求节点** <a href="#id-27d6840a-c560-4516-a64c-797dc4080e30" id="id-27d6840a-c560-4516-a64c-797dc4080e30"></a>

在创建请求节点后，对应的方块会在用户界面中弹出。

<figure><img src="/files/nWFw3KqjVVPgs6ndJGIL" alt=""><figcaption></figcaption></figure>

通&#x8FC7;**\[ Select a method ] 选择已有的请求。**

![](/files/50w1YGmBzlNF5qpHePNZ)

对于**写/读方法请求**，通过选&#x62E9;**\[ Edit Parameters** ]来调整参数，如果要检查当前参数的状态，请将鼠标悬停在视觉图标上。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FL7QypaDb7rzeWuQoL6Fc%2Fimage3.png?alt=media&#x26;token=d3b54b66-9c7c-409b-9794-93f60ccb821f" alt=""><figcaption></figcaption></figure>

对于读请求，您可以通过单击 **\[Assign return to Context]** 声明一个变量来存储请求的响应。 同样地，如果您想检查当前上下文变量的状态，请将鼠标悬停在视觉图标上。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FcNrNgSpOPB436yC8SMMv%2Fimage.png?alt=media&#x26;token=d0cd4ec3-003e-4593-90fa-83820b412dc0" alt=""><figcaption></figcaption></figure>

### **使用条件节点**

创建条件节点后，对应的方块会弹出。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FDJOF6vD7ol1lXFjBibfS%2Fimage.png?alt=media&#x26;token=ed17c7b0-3354-4814-8bde-153f131a70cf" alt=""><figcaption></figcaption></figure>

在左侧框和右侧框中声明值，然后选择条件。 可以通过 3 种方式在左侧框和右侧框中声明值：

1. &#x20;{{变量名}} ：来自莱卡环境中设置的值
2. Context.context\_name : 上下文中的值（在创建请求节点时声明，参阅请求节点部分）
3. 普通值：一个常数值

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FhIVVzjYKeKWpfyIAexky%2Fimage.png?alt=media&#x26;token=27e281ca-52e0-47d9-b69c-4939e516ebfa" alt=""><figcaption></figcaption></figure>

接下来，要连接条件节点的流程，如果结果为真，请将条件节点右上角的点连接到要运行的节点。 相反，如果结果为假，则将条件节点右下角的点连接到要运行的节点。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2Fakuc9Klqr2BfvVniWQoi%2Fimage.png?alt=media&#x26;token=b1bde30e-80c0-4987-9b1e-6589fcac4438" alt=""><figcaption></figcaption></figure>

### **使用连接节点**

创建连接节点后，对应的方块会弹出。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2F4McgigtmVwjbw1Jrf544%2Fimage.png?alt=media&#x26;token=74b4e427-ff7a-4b52-8497-a82578c9e104" alt=""><figcaption></figcaption></figure>

连接下方图片中显示的端点，将两条控制流合并为一条。

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FD6XM3t4C6paKW3WbC5Qg%2Fimage.png?alt=media&#x26;token=c1ec5ce0-118d-4af9-b7b1-98a365b50583" alt=""><figcaption></figcaption></figure>

**需要更多的帮助？来看看使用莱卡场景的功能的视频吧！**

<figure><img src="https://1664627178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlODSmBGoBlX8YKKqUIHt%2Fuploads%2FVMqOTtVKML5nBeeHsBYn%2Fimage.png?alt=media&#x26;token=c3205b50-8582-4d28-87bb-0d3b6e5d3ca0" alt=""><figcaption></figcaption></figure>

{% embed url="<https://drive.google.com/file/d/12m9QcE6gFEJJPq51GBW_mGB43NnKH9qf/view>" %}
使用莱卡场景请求案例
{% endembed %}


---

# 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.getlaika.app/docs/docs-cn/ji-chu/lai-ka-chang-jing.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.
