Skip to content

Commit

Permalink
chore: 更多的重命名
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Jan 9, 2025
1 parent d1eb9f1 commit c8fe954
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 161 deletions.
6 changes: 3 additions & 3 deletions docs/en_us/1.1-QuickStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ Launch the CLI through the API while registering some custom tasks. This method
{
"Recognize and Click Confirm Icon": {
"next": [
"My Custom Task"
"My Custom Node"
]
},
"My Custom Task": {
"My Custom Node": {
"recognition": "Custom",
"custom_recognition": "MyReco",
"action": "Custom",
Expand Down Expand Up @@ -171,7 +171,7 @@ There are currently two ways: [MaaDebugger](https://github.com/MaaXYZ/MaaDebugge
- `logging`: Save the log and generate `debug/maa.log`. Default true.
- `recording`: Save recording function, which will save all screenshots and operation data during operation. You can use `DbgController` for reproducible debugging. Default false.
- `save_draw`: Saves the image recognition visualization results. All image recognition visualization results drawings during the run will be saved. Default false.
- `show_hit_draw`: Displays the task hit pop-up window. Each time the recognition is successful, a pop-up window will display the recognition result. Default false.
- `show_hit_draw`: Displays the node hit pop-up window. Each time the recognition is successful, a pop-up window will display the recognition result. Default false.
- `stdout_level`: The console displays the log level. The default is 2 (Error), which can be set to 0 to turn off all console logs, or to 7 to turn on all console logs.

- If you integrate it yourself, you can enable debugging options through the `Toolkit.init_option` / `MaaToolkitConfigInitOption` interface. The generated json file is the same as above.
Expand Down
88 changes: 44 additions & 44 deletions docs/en_us/3.1-PipelineProtocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

```jsonc
{
"TaskA": {
"NodeA": {
"next: [
"TaskB",
"TaskC"
"NodeB",
"NodeC"
]
// properties ...
},
"TaskB": {
"NodeB": {
// properties ...
},
// other task ...
// other node ...
}
```
When we execute a task (passing the task name to the MaaTaskerPostTask interface), it will recognize the tasks in the "next" list one by one (based on the recognition settings for each task). Once a match is found, it will exit the recognition of the "next" list and proceed to execute the matched task. It's similar to traversing and comparing, and as soon as a match is found, it will break and execute the found task.
When we execute a node (passing the entry name to the MaaTaskerPostTask interface), it will recognize the nodes in the "next" list one by one (based on the recognition settings for each node). Once a match is found, it will exit the recognition of the "next" list and proceed to execute the matched node. It's similar to traversing and comparing, and as soon as a match is found, it will break and execute the found node.
## Example
Expand Down Expand Up @@ -53,11 +53,11 @@ For example, let's say we have a game where different fruits, such as apples, or
}
```
Let's assume there are no apples on the screen, but there are oranges and bananas. In the above JSON, if we execute "StartFruit" (i.e., pass "StartFruit" to the MaaTaskerPostTask interface), it will first recognize "Apple." Since there are no apples on the screen, it will continue to recognize "Orange." If it recognizes an orange, it will start executing the "Orange" task, and it won't attempt to recognize "Banana." After executing "Orange" according to its action, it will continue to recognize "Orange's" "next" tasks.
Let's assume there are no apples on the screen, but there are oranges and bananas. In the above JSON, if we execute "StartFruit" (i.e., pass "StartFruit" to the MaaTaskerPostTask interface), it will first recognize "Apple." Since there are no apples on the screen, it will continue to recognize "Orange." If it recognizes an orange, it will start executing the "Orange" node, and it won't attempt to recognize "Banana." After executing "Orange" according to its action, it will continue to recognize "Orange's" "next" nodes.
Within "Orange's" "next," if it recognizes "Cat," it won't continue to recognize "Dog." It will execute the "Cat" action and continue to recognize "Cat's" "next" after the action is completed. If neither "Cat" nor "Dog" is recognized, it will continue to attempt recognition for these two tasks until a timeout occurs.
Within "Orange's" "next," if it recognizes "Cat," it won't continue to recognize "Dog." It will execute the "Cat" action and continue to recognize "Cat's" "next" after the action is completed. If neither "Cat" nor "Dog" is recognized, it will continue to attempt recognition for these two nodes until a timeout occurs.
This loop continues until the "next" of a task is empty, which signifies that the task is complete.
This loop continues until the "next" of a node is empty, which signifies that the task is complete.
## Property Fields
Expand All @@ -74,65 +74,65 @@ This loop continues until the "next" of a task is empty, which signifies that th
See [Action Types](#action-types) for details.
- `next`: *string* | *list<string, >*
List of tasks to execute next. Optional, default is empty.
It recognizes each task in sequence and executes the first one it recognizes.
List of nodes to execute next. Optional, default is empty.
It recognizes each node in sequence and executes the first one it recognizes.
- `interrupt` : *string* | *list<string, >*
The list of candidate tasks when all tasks in `next` are not recognized, and similar interrupt operations will be performed. Optional, empty by default.
If all tasks in `next` are not recognized, each task in the interrupt list will be recognized in order, and the first recognized one will be executed. After all subsequent tasks are executed, jump back to this task to try to recognize it again.
The list of candidate nodes when all nodes in `next` are not recognized, and similar interrupt operations will be performed. Optional, empty by default.
If all nodes in `next` are not recognized, each node in the interrupt list will be recognized in order, and the first recognized one will be executed. After all subsequent nodes are executed, jump back to this node to try to recognize it again.
For example: A: { next: [B, C], interrupt: [D, E] }
When B and C are not recognized and D is recognized, D and D.next will be fully executed. But when the pipeline of D is fully executed. It will return to task A again and continue to try to recognize B, C, D, E.
This field is mostly used for exception handling. For example, D is to recognize the "network disconnection prompt box". After clicking confirm and waiting for the network connection to succeed, continue the previous task flow.
When B and C are not recognized and D is recognized, D and D.next will be fully executed. But when the pipeline of D is fully executed. It will return to node A again and continue to try to recognize B, C, D, E.
This field is mostly used for exception handling. For example, D is to recognize the "network disconnection prompt box". After clicking confirm and waiting for the network connection to succeed, continue the previous node flow.
- `is_sub`: *bool*
**(Deprecated in version 2.x, but retains compatibility. `interrupt` is recommended instead.)**
Whether it is a subtask. Optional, default is false.
If it's a subtask, after completing this task (and subsequent tasks such as "next"), it will return to re-recognize the "next" list of this task.
For example: A.next = [B, Sub_C, D], where Sub_C.is_sub = true. If Sub_C is matched, after fully executing Sub_C and subsequent tasks, it will return to re-recognize [B, Sub_C, D] and execute the matching items and subsequent tasks.
Whether it is a sub-node. Optional, default is false.
If it's a sub-node, after completing this node (and subsequent nodes such as "next"), it will return to re-recognize the "next" list of this node.
For example: A.next = [B, Sub_C, D], where Sub_C.is_sub = true. If Sub_C is matched, after fully executing Sub_C and subsequent nodes, it will return to re-recognize [B, Sub_C, D] and execute the matching items and subsequent nodes.

- `rate_limit`: *uint*
Identification rate limit, in milliseconds. Optional, default 1000.
Each round of identification "next" + "interrupt" consumes at least `rate_limit` milliseconds, and sleep will wait if the time is less than that.

- `timeout`: *uint*
Timeout for recognizing "next" + "interrupt" tasks, in milliseconds. Optional, Default is 20,000 milliseconds (20 seconds).
Timeout for recognizing "next" + "interrupt" nodes, in milliseconds. Optional, Default is 20,000 milliseconds (20 seconds).
The detailed logic is `while(!timeout) { foreach(next + interrupt); sleep_until(rate_limit); }`

- `on_error` : *string* | *list<string, >*
When recognition timeout or the action fails to execute, the tasks in this list will be executed next. Optional, empty by default.
When recognition timeout or the action fails to execute, the nodes in this list will be executed next. Optional, empty by default.

- `timeout_next`: *string* | *list<string, >*
**(Deprecated in version 2.x, but retains compatibility. `on_error` is recommended instead.)**
List of tasks to execute after a timeout. Optional, default is empty.
List of nodes to execute after a timeout. Optional, default is empty.

- `inverse`: *bool*
Reverse the recognition result: recognized as not recognized, and not recognized as recognized. Optional, default is false.
Please note that tasks recognized through this setting will have their own clicking actions disabled (because nothing was actually recognized). If there is a need, you can set the `target` separately.
Please note that nodes recognized through this setting will have their own clicking actions disabled (because nothing was actually recognized). If there is a need, you can set the `target` separately.

- `enabled`: *bool*
Whether to enable this task. Optional, default is true.
If set to false, this task will be skipped when it appears in the "next" lists of other tasks, meaning it won't be recognized or executed.
Whether to enable this node. Optional, default is true.
If set to false, this node will be skipped when it appears in the "next" lists of other nodes, meaning it won't be recognized or executed.
- `pre_delay`: *uint*
Delay in milliseconds between recognizing a task and executing the action. Optional, default is 200 milliseconds.
It is recommended to add intermediate tasks whenever possible and use less delay to maintain both speed and stability.
Delay in milliseconds between recognizing a node and executing the action. Optional, default is 200 milliseconds.
It is recommended to add intermediate nodes whenever possible and use less delay to maintain both speed and stability.
- `post_delay`: *uint*
Delay in milliseconds between executing the action and recognizing the "next" tasks. Optional, default is 200 milliseconds.
It is recommended to add intermediate tasks whenever possible and use less delay to maintain both speed and stability.
Delay in milliseconds between executing the action and recognizing the "next" nodes. Optional, default is 200 milliseconds.
It is recommended to add intermediate nodes whenever possible and use less delay to maintain both speed and stability.
- `pre_wait_freezes`: *uint* | *object*
Time in milliseconds to wait for the screen to stop changing between recognizing a task and executing the action. Optional, default is 0 (no waiting).
Time in milliseconds to wait for the screen to stop changing between recognizing a node and executing the action. Optional, default is 0 (no waiting).
It will exit the action only when the screen has not had significant changes for "pre_wait_freezes" milliseconds in a row.
If it's an object, more parameters can be set, see [Waiting for the Screen to Stabilize](#waiting-for-the-screen-to-stabilize) for details. The specific order is `pre_wait_freezes` - `pre_delay` - `action` - `post_wait_freezes` - `post_delay`.

- `post_wait_freezes`: *uint* | *object*
Time in milliseconds to wait for the screen to stop changing between executing the action and recognizing the "next" tasks. Optional, default is 0 (no waiting).
Time in milliseconds to wait for the screen to stop changing between executing the action and recognizing the "next" nodes. Optional, default is 0 (no waiting).
Other logic is the same as `pre_wait_freezes`.

- `focus`: *bool*
Whether to focus on the task, resulting in additional callback messages. Optional, default is false (no messages).
See [Task Notifications](#task-notifications) for details.
Whether to focus on the node, resulting in additional callback messages. Optional, default is false (no messages).
See [Node Notifications](#node-notifications) for details.

## Default Properties

Expand All @@ -154,7 +154,7 @@ This algorithm property requires additional fields:
- `roi`: *array<int, 4>* | *string*
Recognition area coordinates. Optional, default [0, 0, 0, 0], i.e. full screen.
- *array<int, 4>*: Recognition area coordinates, [x, y, w, h], if you want full screen, you can set it to [0, 0, 0, 0].
- *string*: Fill in the task name, and identify within the target range identified by a previously executed task.
- *string*: Fill in the node name, and identify within the target range identified by a previously executed node.

- `roi_offset`: *array<int, 4>*
Move additionally based on `roi` as the range, and add the four values ​​separately. Optional, default [0, 0, 0, 0].
Expand Down Expand Up @@ -434,8 +434,8 @@ Additional properties for this action:

- `target`: *true* | *string* | *array<int, 4>*
The position to click. Optional, default is true.
- *true*: Clicks the target just recognized in this task (i.e., clicks itself).
- *string*: Enter the task name to click a target recognized by a previously executed task.
- *true*: Clicks the target just recognized in this node (i.e., clicks itself).
- *string*: Enter the node name to click a target recognized by a previously executed node.
- *array<int, 4>*: Clicks a random point within a fixed coordinate area [x, y, w, h]. To click the entire screen, set it to [0, 0, 0, 0].

- `target_offset`: *array<int, 4>*
Expand Down Expand Up @@ -574,13 +574,13 @@ This action attribute requires additional fields:
- `{LIBRARY_DIR}`: The path of the folder where the MaaFW library is located.

- `detach`: *bool*
Detach the child process, that is, do not wait for the child process to complete, and directly continue with the subsequent tasks. Optional, default false.
Detach the child process, that is, do not wait for the child process to complete, and directly continue with the subsequent nodes. Optional, default false.

Example:

```jsonc
{
"TaskA": {
"NodeA": {
"action": "Command",
"exec": "Python",
"args": [
Expand All @@ -591,7 +591,7 @@ Example:
"{BOX}"
]
},
"TaskB": {
"NodeB": {
"action": "Command",
"exec": "{RESOURCE_DIR}/my_exec/my_exec.exe"
}
Expand All @@ -601,10 +601,10 @@ Example:
The actual command is:

```bash
# TaskA
Python C:/MaaXXX/resource/my_script/test.py Haha C:/temp/123.png TaskA [0,0,0,0]
# NodeA
Python C:/MaaXXX/resource/my_script/test.py Haha C:/temp/123.png NodeA [0,0,0,0]
# TaskB
# NodeB
C:/MaaXXX/resource/my_exec/my_exec.exe
```

Expand Down Expand Up @@ -634,10 +634,10 @@ The field value can be a uint or an object. For example:

```jsonc
{
"TaskA": {
"NodeA": {
"pre_wait_freezes": 500
},
"TaskB": {
"NodeB": {
"pre_wait_freezes": {
// more properties ...
}
Expand Down Expand Up @@ -669,6 +669,6 @@ If the value is an object, you can set additional fields:
- `timeout`: *uint*
Timeout for recognizing, in milliseconds. Optional, default is 20,000 milliseconds (20 seconds).

## Task Notifications
## Node Notifications

See [Callback Protocol](2.2-CallbackProtocol.md) (not written yet).
2 changes: 1 addition & 1 deletion docs/zh_cn/1.1-快速开始.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ my_resource
- `logging`: 保存日志,会生成 `debug/maa.log`。默认 true 。
- `recording`: 保存录像功能,会保存运行期间所有的截图及操作数据,可使用 `DbgController` 进行复现调试。默认 false 。
- `save_draw`: 保存图像识别可视化结果,会保存运行期间所有图像识别可视化结果绘制图。默认 false 。
- `show_hit_draw`: 显示任务命中弹窗,每次识别成功会弹窗显示识别结果。默认 false 。
- `show_hit_draw`: 显示节点命中弹窗,每次识别成功会弹窗显示识别结果。默认 false 。
- `stdout_level`: 控制台显示日志等级。默认 2(Error),可设为 0 关闭全部控制台日志,或设为 7 打开全部控制台日志。

- 若自行集成,可通过 `Toolkit.init_option` / `MaaToolkitConfigInitOption` 接口开启调试选项。生成的 json 文件同上。
Expand Down
Loading

0 comments on commit c8fe954

Please sign in to comment.