Skip to content

关于MaaFramework和maa-node的答题器实现 #264

Closed Answered by moomiji
hanhuoer asked this question in Q&A
Discussion options

You must be logged in to vote

编程思路

  • pipeline:
{
    "MyTask": {
        "next": [
            "MyCustomRecTask"
        ]
    },
    "MyCustomRecTask": {
        "is_sub": true,
        "recognition": "OCR",
        "roi": [0, 300, 700, 300],
        "action": "Custom",
        "custom_action": "MyAct"
    }
}
  • python
...
    maa_inst.register_action("MyAct", my_act)
...
class MyAction(CustomAction):
    def run(self, context, task_name, custom_param, box, rec_detail) -> bool:
        rec_detail          # 识别结果应该在这
        # 进行匹配
        context.click(X, Y) # 点击按钮
        return True

纯 pipline 的思路是用二分法,把 ocr 挪到点击按钮的 action 里:

{
    "答题_点击正确按钮": {
        "is_sub": true,
        "recognition": "OCR",
        "roi": [0, 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hanhuoer
Comment options

@hanhuoer
Comment options

Answer selected by moomiji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants