按键精灵吧 关注:499,802贴子:1,016,781
  • 3回复贴,共1

求教大神,這兩種寫法的優缺點?意義所在?

只看楼主收藏回复

Dim 延时 = 200
Dim 相似度 = 0.8
Do
If CmpColorEx("144|680|128BD5,187|682|5CC7FF,169|755|01689F,150|825|00629B,187|828|5CC7FF",相似度) = 1 Then
TracePrint "找到战斗图标"
Tap 170, 750
Delay 延时
Else
TracePrint "没找到战斗图标"
End If
If CmpColorEx("550|33|FBEAED,550|40|F8EBED,510|17|85AEB6",相似度) = 1 Then
TracePrint "找到手动"
Tap 540, 40
Delay 延时
Else
TracePrint "没找到手动"
End If
If CmpColorEx("45|393|139360,84|396|74EAB7,64|451|039358,44|505|159762,84|509|74EAB7",相似度) = 1 Then
TracePrint "找到返回"
Tap 60, 450
Delay 延时
Else
TracePrint "没找到返回"
End If
Loop


1楼2019-01-15 17:03回复
    Dim 延时 = 200
    Dim 相似度 = 0.8
    Function 巅峰对决
    Delay 延时
    Do
    If CmpColorEx("144|680|128BD5,187|682|5CC7FF,169|755|01689F,150|825|00629B,187|828|5CC7FF",相似度) = 1 Then
    TracePrint "找到战斗图标"
    Tap 170, 750
    Delay 延时
    Else
    TracePrint "没找到战斗图标"
    Delay 延时
    Call 点击自动()
    Exit Do
    End If
    Loop
    End Function
    Function 点击自动
    Delay 延时
    Do
    If CmpColorEx("550|33|FBEAED,550|40|F8EBED,510|17|85AEB6",相似度) = 1 Then
    TracePrint "找到手动"
    Tap 540, 40
    Delay 延时
    Else
    TracePrint "没找到手动"
    Delay 延时
    Call 点击返回()
    Exit Do
    End If
    Loop
    End Function
    Function 点击返回
    Delay 延时
    Do
    If CmpColorEx("45|393|139360,84|396|74EAB7,64|451|039358,44|505|159762,84|509|74EAB7",相似度) = 1 Then
    TracePrint "找到返回"
    Tap 60, 450
    Delay 延时
    Else
    TracePrint "没找到返回"
    Exit Do
    End If
    Loop
    End Function
    Do
    Call 巅峰对决()
    Loop


    2楼2019-01-15 17:04
    回复
      第一種簡單粗暴一直無腦找圖點擊,第二種判斷點擊貌似延遲還更大一點,更加拖時間?
      新手學習,照著網上的源代碼寫的。


      3楼2019-01-15 17:07
      回复
        第1种方法只找一次,碰到卡一下或者网络延迟刷不出来,那么脚本就死了.
        第2种方法看似循环,其实并没有循环,Else之后直接跳到其他函数中(运行中的子程序没结束直接跳出会在内存中遗留),运行久了就会越来越卡,最后导致崩溃.
        Dim 延时 = 200
        Dim 相似度 = 0.8
        Do
        //巅峰对决
        Do
        Delay 延时
        If CmpColorEx("144|680|128BD5,187|682|5CC7FF,169|755|01689F,150|825|00629B,187|828|5CC7FF",相似度) = 1 Then
        TracePrint "找到战斗图标"
        Tap 170, 750
        Delay 延时
        Exit Do
        Else
        TracePrint "没找到战斗图标"
        End If
        Loop
        //点击自动
        Do
        Delay 延时
        If CmpColorEx("550|33|FBEAED,550|40|F8EBED,510|17|85AEB6",相似度) = 1 Then
        TracePrint "找到手动"
        Tap 540, 40
        Delay 延时
        Exit Do
        Else
        TracePrint "没找到手动"
        End If
        Loop
        //点击返回
        Do
        Delay 延时
        If CmpColorEx("45|393|139360,84|396|74EAB7,64|451|039358,44|505|159762,84|509|74EAB7",相似度) = 1 Then
        TracePrint "找到返回"
        Tap 60, 450
        Delay 延时
        Exit Do
        Else
        TracePrint "没找到返回"
        End If
        Loop
        Delay 延时
        Loop


        IP属地:浙江4楼2019-01-15 19:14
        回复