> For the complete documentation index, see [llms.txt](https://hhhhhy.gitbook.io/trmenu-v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hhhhhy.gitbook.io/trmenu-v3/menu/condition.md).

# 条件

## 引入

“条件表达式” 是可用在以下场景中使用的单个字符串

* 动作参数
* 反应（动作组）条件
* 子图标筛选条件

其执行结果应当返回布尔值（Boolean），即 `true` / `false`

目前，TrMenu 以支持 Kether , JavaScript , JEXL 三种类型的表达式作为条件编译使用

其中默认情况下统一调用 Kether \*(推荐)

## 使用

Kether 表达式直接使用，JavaScript 表达式需加以 `js:` 前缀且规范变量处理，JEXL 表达式需加以 `jexl:` 前缀且规范变量处理

例如创建一个当玩家有 `vip.user` 权限或余额大于等于 `1000` 时才成立的条件

* Kether: `any [ perm *vip.user money *1000 ]`
* JavaSctipt: `js: player.hasPermission("vip.user") || utils.hasMoney(player, 1000.0)`
* JEXL `jexl: player.hasPermission("vip.user") or utils.hasMoney(player, 1000.0)`

三种语法的格式可用通过 `SCRIPT` 章节进一步学习

## 进阶

{% content-ref url="/pages/Y6cDGN8OS8deCmLh9AWu" %}
[Kether](/trmenu-v3/script/kether.md)
{% endcontent-ref %}

{% content-ref url="/pages/G71XjduJE2F13zdAiT6y" %}
[JavaScript](/trmenu-v3/script/javascript.md)
{% endcontent-ref %}

{% content-ref url="<https://github.com/YsGqHY/TrMenu-Documentation/blob/zh_cn/script/jexl.md>" %}
<https://github.com/YsGqHY/TrMenu-Documentation/blob/zh_cn/script/jexl.md>
{% endcontent-ref %}

> 深入了解三种语法的结构和在 TrMenu 中的应用场景，制作更强大的菜单


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://hhhhhy.gitbook.io/trmenu-v3/menu/condition.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.
