Files
netease-modsdk-wiki/docs/mcguide/27-网络游戏/课程7:开发技巧/第3节:控制台调试.md
2025-03-18 14:46:12 +08:00

63 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
front:
hard: 进阶
time: 20分钟
---
# 控制台调试
### 应用场景
控制台调试集成了三项功能脚本测试、原版指令输入、POST指令输入。可在开发阶段使用。
- 脚本测试便于加载mod的时候额外执行脚本获取关注的变量或返回值。
- 原生指令:可在指定的服务器类型,执行原生指令。
- POST指令POST指令是Apollo网络服的自定义指令固定在控制服Master执行。
### 控制台调试入口
右键点击正在运行的网络服,选择“控制台调试”。
![](./images/cmd1.png)
### 脚本测试
在脚本测试分页,选定要执行脚本的服务器类型,然后再输入文本框中输入测试脚本,点击“发送”按钮,执行结果在右侧输出区域显示。
*举例如下在控制服输入控制服APIGetGameTypeByServerId()该API的作用是获取指定ID服务器的类型。*
![](./images/cmd6.png)
### 原生指令
在原生指令分页,选定要执行脚本的服务器类型,然后再输入文本框中输入测试脚本,点击“发送”按钮,执行结果在右侧输出区域显示。
*举例如下在大厅服输入原生的tp指令*
![](./images/cmd4.png)
### POST指令
在POST指令分页选定要执行脚本的服务器类型然后再输入文本框中输入测试脚本点击“发送”按钮执行结果在右侧输出区域显示。
鉴于POST指令过于复杂提供了预设指令的功能。点击“选择指令”按钮可预览预设指令。
![](./images/cmd9.png)
其中插件中的自定义指令可通过在modRequest.json中指定。以官方的喇叭公告插件为例modRequest.json位于neteaseShout目录之下。文件格式如下
![](./images/cmd7.png)
![](./images/cmd11.png)
![](./images/cmd12.png)