跳转到正文
iPlugin

Kether

在文字、条件和运行逻辑中使用 Xerr Kether 语句

Kether 可以用于三类场景:

  1. 在 Layout 文字中返回动态内容。
  2. 作为元素、HUD、Stack 等显示条件。
  3. 调用 Popup、Screen 和 Compass。

Xerr 使用 xerr 和 quest_engine 语句命名空间。

与玩家有关的显示操作需要玩家执行上下文,不能直接输入普通聊天或控制台。item-data 则使用 Tooltip 的物品上下文。管理效果可先使用命令。命令中的可选玩家参数与 Kether 语法不同,不要混用。

动态文字

value: "&f玩家: {{ player name }}"
value: "&f坐标: {{ player block x }}, {{ player block y }}, {{ player block z }}"

同一段文字中的多个 {{ ... }} 会按书写顺序执行。

读取显示系统传入的变量:

value: "&f{{ get message }}"

显示条件

condition: |
  perm xerr.notice

条件应返回布尔值。条件放在哪一层,就隐藏哪一层:

  • Layout Element: 只隐藏该元素。
  • HUD Layout 绑定: 隐藏整个 Layout。
  • Stack Item: 隐藏 Item 并触发重排。
  • Stack Row: 隐藏整行。

显示并保存实例:

set notice to popup show "notice" with [
  title "任务完成"
  message "获得钻石 ×3"
]

更新变量,不重新播放入场,也不自动续时:

popup update &notice with [
  message "获得钻石 ×5"
]

恢复完整停留时间:

popup renew &notice

等待显示或结束:

popup wait &notice visible
popup wait &notice end

停止:

popup stop &notice
popup stop &notice force

清理:

popup clear popup "notice"
popup clear group "notifications"
popup clear all
popup clear all force

查询:

popup list
popup list group "notifications"
popup exists &notice
popup state &notice

popup state 返回 queued、preparing、entering、visible、exiting、ended 或 missing。

with [...] 没有固定参数数量,按“变量名 + 表达式”成对填写;变量名不能重复。

Screen

持续显示:

set movie to screen show "movie"
screen stop &movie

播放 Scene 并传入变量:

set scene to screen play "layout_background_demo" with [
  title "区域解锁"
  message "你已抵达新的区域"
]

等待上面的 Scene 结束:

screen wait &scene end

layout_background_demo 没有 covered Marker。等待该时间点请播放确实定义 Marker 的默认 Scene:

set transition to screen play "yellow_transition"
screen wait &transition marker "covered"
screen wait &transition end

其它语句:

screen hide "movie"
screen exists "movie"
screen list
screen clear

screen wait <实例> end 返回 finished、stopped、cleared、offline 或 reload。

Compass

添加固定坐标:

compass set "navigation" "home" at "world" 120 64 -300 marker "home" label "家" priority 100

跟随玩家或实体:

compass follow "navigation" "leader" player "Steve" marker "teammate" priority 50
compass follow "navigation" "boss" entity &boss_entity marker "quest"

通过脚本动态返回位置:

compass script "navigation" "quest" "get quest_location" marker "quest" refresh 20

管理目标:

compass list "navigation"
compass remove "navigation" "home"
compass clear "navigation"
compass hide "navigation"
compass show "navigation"

可选项包括 marker、label、priority 和 refresh。脚本参数会按原顺序求值。

异步行为

Popup、Screen 和 Compass 的等待操作返回 Future,不阻塞服务器主线程。不要在 HUD 内容脚本中执行同步网络请求或数据库查询;这类数据应由外部插件提前缓存,或通过 API 的异步 Provider 提供。

Tooltip 物品数据

item-data get attack
item-data has attack
item-data get nbt.WeaponData.attack
item-data get 'pdc["weapons:attack"]'

在 Tooltip 布局的文字、条件或列表来源中使用,读取本次物品快照,不追踪玩家之后切换到的手持物品。attack 可以是模板中的数据别名;缺失值返回空,0 和 false 仍算存在。

condition: "item-data has attack"
value: "&f攻击 +{{ item-data get attack }}"

这些语句要求物品上下文,不能作为普通玩家 HUD 的通用读取语句。数据映射见物品提示,扩展方式见数据接入。