1. 程式人生 > >魔獸世界-按鍵精靈指令碼(1)-自動小寵物戰鬥

魔獸世界-按鍵精靈指令碼(1)-自動小寵物戰鬥

這個指令碼主要是為了練低階寶寶

// 4,3 --> 換出寶寶
changePet 3
wait_round 
// 4,1 --> 換出滿級貓
changePet 1
wait_round 
// MsgBox "ok"
//ExitScript
Rem _fighting
ai
wait_round 
If isEnd <> true Then 
    Goto _fighting
End If
MsgBox "結束"
Sub ai
    c= GetPixelColor (1022,86)
    TracePrint c
    IfColor 1022, 86, "000000", 2 Then
        KeyPress 51, 1
    Else 
        KeyPress 49, 1
    End If	
End Sub
Sub changePet(n)
    Dim xarr
    xarr=Array(480, 690, 900)
    y = 590
    //    TracePrint xarr(n - 1)
    KeyPress 52, 1
    Delay 200
    MoveTo xarr(n - 1), y
    Delay 500
    LeftClick 1
    Delay 500
End Sub
Sub wait_round
    Rem _wait
    flag = isWaiting()
    If flag = true Then 
        Delay 400
        Goto _wait
    End If
    Delay 400
End Sub
Function getS(x, y)
    c=GetPixelColor ( x,y)
    Plugin.Color.ColorToHSL c, h, s, l
    getS=s
End Function
Function isWaiting
    s1 = getS(415, 686)
    s2 = getS(480, 686)
    s3 = getS(540, 686)
    //    TracePrint cstr(s1)+"|"+cstr(s2)+"|"+cstr(s3)
    If s1 = 0 and s2 = 0 and s3 = 0 Then 
        isWaiting = True
    Else 
        isWaiting= False
    End If
End Function
Function isEnd
    IfColor 674, 52, "00D1FF", 1 Then
        isEnd = True
    Else 
        isEnd = False
    End If
End Function

簡單說明如下:

前提:
專殺"小動物",因為"野獸"剋制他們
格子分配:
1 滿級"野獸",貓科
2 滿級"野獸",貓科
3 等待升級的"寶寶"


步驟:
1 "4"鍵,"3"鍵,換出"寶寶"
2 "4"鍵,"1"鍵,換出滿級"野獸"
3 根據對手的血條,如果對手的血條過低,則使用"吞噬",否則使用"突襲"

寫得比較粗略,有興趣的朋友發我QQ郵件,dinopresent#qq.com

接下來,我再來完善其自動尋怪的功能,否則還是蠻費人工的