From 70e3c9968aea07f549f380f2873f36f2e7452279 Mon Sep 17 00:00:00 2001 From: snowy Date: Fri, 31 May 2024 23:15:40 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=B7=BB=E5=8A=A0=E5=AF=B9lyfunct?= =?UTF-8?q?ion=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/usage/lyapi.md | 2 +- docs/usage/lyfunc.md | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/usage/lyfunc.md diff --git a/docs/usage/lyapi.md b/docs/usage/lyapi.md index 5be5159a..8fedd484 100644 --- a/docs/usage/lyapi.md +++ b/docs/usage/lyapi.md @@ -1,7 +1,7 @@ --- title: 轻雪API icon: code -order: 4 +order: 5 category: 使用指南 tag: - 配置 diff --git a/docs/usage/lyfunc.md b/docs/usage/lyfunc.md new file mode 100644 index 00000000..732f69f4 --- /dev/null +++ b/docs/usage/lyfunc.md @@ -0,0 +1,48 @@ +--- +title: 轻雪函数 +icon: code +order: 4 +category: 使用指南 +tag: + - 配置 +--- + +## **轻雪函数** + +轻雪函数 Liteyuki Function 是轻雪的一个功能,它允许你在轻雪中运行一些自定义的由数据驱动的命令,类似于Minecraft的mcfunction + +### **函数文件** + +函数文件放在资源包的`functions`目录下,文件名以`.mcfunction` `.lyfunction` `.lyf`结尾,例如`test.mcfunction`,文件内容为一系列的命令,每行一个命令,支持单行注释`#`,例如: + +```shell +cmd echo hello +``` + +### **命令文档** + +```shell +var [var2=value2] ... # 定义变量 +cmd # 在设备上执行命令 +api [var=value...] # 调用Bot API +function # 调用函数,可递归 +sleep