NoName Team 電腦資訊討論區

 找回密碼
 我要註冊
搜索
查看: 5412|回復: 2

[問題] 問各AUTOIT的問題不知道可不可以

[複製鏈接]
發表於 2012-6-12 02:17:46 | 顯示全部樓層 |閱讀模式
小弟目前在玩暗黑破壞神3
想用AUTOIT寫個自動跑固定路線  搜尋路線上是否有寶箱  屍體  有的話點選地上寶箱或屍體

但是不知道如何 搜尋比對圖檔  有搜尋到寶箱或屍體  就執行點選  這段程式不知道該如何寫?

以下是外國人寫的自動踢罐子

裡面有一個  $red = PixelSearch(46, 244, 227, 278, 0x290400, 0)
像這個PixelSearch函式 用法  不知道該去哪看教學
還有該如何抓座標和顏色

我使用Au3Record.exe錄製 我遊戲過程中  滑鼠移動和點選
但是套用進程式 在遊戲中卻會亂跑 亂移動

我想問的是:有沒有中文教學網站可以查到他內建各種函式的用法




; Shitty Wizard Royal Crypts AutoIT Bot by lolwut
; Updated to repair itself when it gets damage.
; Like it? Send me BitCoin @ 1PoYbp44vcvZ9XeT3gMsDtEHtoWZ2GWoYq
; DISCLAIMER: Yes, it'll die. Good thing repair bills are still low.
; DISCLAIMER: It WILL miss the door from time-to-time and derp out and probably die. Sorry.
; OK, disclaimers aside, here's what needs to be done for it to work.
; 1. Diablo 3 must be run in windowed dragged to the smallest size possible. Use the corners of the window to drag. This should put it in 800x600.
; 2. Your in-game hotkeys must have MiddleMouse bound to the Move action.
; 3. You must be running as a Level 60 Wizard.
; 4. Ability 1 must be Wave of Force.
; 5. Ability 3 must be Ice Armor with Frozen Storm.
; 6. You must have the Royal Crypts checkpoint on the character. This means, when you hit resume game from the character screen you are automatically in Royal Crypts. You should be able to figure out how to do this. Start the Act I Quest that starts with Sword or something, and the subquest to descend into the catecombs or cathedral or whatever. Run all the way down to the Royal Crypts, you should get a checkpoint.
; 7. Leave the game on the character select screen. Start the AutoIt Script. Press spacebar to pause it, press END to stop the script from running. It should give you debug messages in a little tooltip in the top-left of your screen.
; Pretty sure that's everything. Good luck!

Opt('MouseCoordMode', 0)
Opt('PixelCoordMode', 0) ; WE USE WINDOW RELATIVITY SO WE CAN USE BUILT-IN SCREENSHOTS FOR DEV
HotKeySet('{END}', 'Quit')
HotKeySet('{SPACE}', 'Pause')
Global $Paused

;bot starts paused. press space to start.
Pause()

WinActivate('暗黑破壞神III')
While 1
   If WinActive('暗黑破壞神III') Then
      ;===START CHAR RESUME LOOP===
      While 1
         $red = PixelSearch(46, 244, 227, 278, 0x290400, 0)
         If Not @error Then
            ToolTip('Found Resume Button', 0, 0)
            Click(140,266) ;click resume button
            ExitLoop
         Else
            ToolTip('Did Not Find Resume Button', 0, 0)
            Sleep(200)
         EndIf
      WEnd
      ;===END CHAR RESUME LOOP===
      ;===START ARE WE IN CRYPTS LOOP===
      While 1
         $red = PixelSearch(190, 50, 210, 70, 0x132824, 0) ;Uses Left Entrance's Pillar Pixels
         If Not @error Then
            ToolTip('I''M IN CRYPTS', 0, 0)
            ExitLoop
         Else
            ToolTip('I''m not in Crypts Yet', 0, 0)
            Sleep(200)
         EndIf
      WEnd
      ToolTip('Doing Wave', 0, 0)
      DoWave()
      ToolTip('Doing Step1', 0, 0)
      IceMove(718,510)
      Sleep(700)
      ToolTip('Doing Step2', 0, 0)
      IceMove(788,458)
      Sleep(900)
      ToolTip('Doing Step3', 0, 0)
      IceMove(742,96)
      ause()
      Sleep(1700)
      ToolTip('Doing Step4', 0, 0)
      MouseMove(585,178)
      Sleep(300)
      ToolTip('Doing Doorcheck', 0, 0)
      ;check if there's a door. if there is, MouseClick
      $blue = PixelSearch(490, 100, 650, 220, 0x5877A3, 0) ;Checking for Blue Door
      If Not @error Then
         ToolTip('Found Door! Sending Click.', 0, 0)
         MouseClick("left")
         Sleep(900)
         ToolTip('Doing DoorStep',0,0)
         IceMove(600,148) ;move immediately to the tile to the right of the first jutting jar
      Else
         ToolTip('Did Not Find Door! Doing NonDoorStep',0,0)
         IceMove(600,148)
      EndIf
      Sleep(800)
      ToolTip('Doing Step5', 0, 0)
      IceMove(766,177)   
      Sleep(1300)
      ToolTip('Doing Step6', 0, 0)
      IceMove(426,88)
      Sleep(1000)
      ToolTip('Doing Step7', 0, 0)
      IceMove(235,249)
      Sleep(250)
      ToolTip('Doing Step8', 0, 0)
      IceMove(649,106)
      Sleep(1250)
      ToolTip('Doing Step9', 0, 0)
      IceMove(126,204)
      Sleep(800)
      ToolTip('Doing Step10', 0, 0)
      IceMove(152,182)
      Sleep(800)
      ToolTip('Doing Step11', 0, 0)
      IceMove(632,295)
      Sleep(400)
      ToolTip('Doing Step12', 0, 0)
      IceMove(757,523)
      Sleep(800)
      ToolTip('Doing Step13', 0, 0)
      IceMove(689,373)   
      Sleep(600)
      ToolTip('Doing Step14', 0, 0)
      IceMove(631,335)
      Sleep(300)
      ToolTip('Doing Step15', 0, 0)
      IceMove(453,148)
      Sleep(600)
      ToolTip('Doing Step16', 0, 0)      
      IceClick(743,556)
      Sleep(800)
      ToolTip('Doing Step17', 0, 0)
      IceMove(749,514)
      Sleep(800)
      ToolTip('Doing Step18', 0, 0)
      IceMove(305,511)
      Sleep(500)
      ToolTip('Doing Step19', 0, 0)
      IceMove(336,539)
      Sleep(400)
      ToolTip('Doing Step20', 0, 0)
      IceMove(462,502)
      Sleep(500)
      ToolTip('Doing Step21', 0, 0)      
      IceMove(584,557)
      Sleep(600)
      ToolTip('Doing Step22', 0, 0)     
      IceMove(769,366)
      Sleep(800)
      ToolTip('Doing Step23', 0, 0)     
      IceMove(739,620)
      Sleep(950)
      ToolTip('Doing Step24', 0, 0)   
      IceMove(16,101)
      Sleep(1700)
      ToolTip('Doing Step25', 0, 0)         
      IceMove(128,77)
      Sleep(1200)
      ToolTip('Doing Step26', 0, 0)         
      IceMove(50,289)
      Sleep(900)
      ToolTip('Doing Step27', 0, 0)         
      IceMove(360,530)      
      Sleep(700)
      ToolTip('Doing Last Wiggle', 0, 0)        
      Move(492,304)
      Sleep(300)
      ToolTip('Doing TP SubRoutine', 0, 0)
      Send("t")
      Sleep(8000)
      $blue = PixelSearch(380, 180, 430, 230, 0x182559, 30) ;Checking if TP was successful
      If Not @error Then
         ToolTip("TP WAS SUCCESSFUL!",0,0)
         $yellow = PixelSearch(562, 42, 593, 84, 0xFFEF00, 0) ;Checking if we need to repair
         If Not @error Then
            ToolTip("FOUND REPAIR", 0, 0)
            MouseClick('middle', 723, 62, 1, 1)
            Sleep(4000)
            MouseMove(485,131)
            Sleep(600)
            MouseClick("left")
            Sleep(1500)
            $gold = PixelSearch(640,50,690,90,0xCBC860,20) ;Checking if we made it to the vendor
            If Not @error Then
               Click(293,300) ;click repair tab
               Sleep(700)
               Click(159,360) ;click repair
               Sleep(300)
               Click(292,40) ;esc vendor window
            EndIf
         Else
            ToolTip("DID NOT FIND REPAIR", 0, 0)
         EndIf
      Else
         ToolTip("I did not TP successfully?",0,0)
      EndIf
      Send("{ESC}")
      Sleep(300)
      Click(407,352)
   EndIf
WEnd

Func Pause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
      ;ToolTip('Paused...', 0, 0)
   WEnd
   ;ToolTip("")
EndFunc   ;==>ause

Func Click($x, $y)
   MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
   Sleep(Random(250, 700))
EndFunc   ;==>;Click

Func Move($x, $y)
   MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
   Sleep(Random(250, 700))
EndFunc   ;==>Move

Func IceMove($x, $y)
   Send("1")
   Sleep(Random(100,200))
   Move($x, $y)
   Send("1")
EndFunc

Func IceClick($x, $y)
   Send("1")
   Sleep(Random(100,200))
   Click($x, $y)
   Send("1")
EndFunc

Func DoWave()
   Send("4")
   Sleep(Random(100,200))
EndFunc

Func Quit()
   Exit
EndFunc   ;==>Quit

發表於 2012-6-12 20:15:01 | 顯示全部樓層
一般遊戲都會有保護軟體(像神盾NP),他會檔Send()這類由軟體發出的模擬鍵盤的動作,所以你沒先解決神盾是沒用的。
 樓主| 發表於 2012-6-12 22:15:15 | 顯示全部樓層
D3 並沒檔按鍵精靈和AUTOIT
您需要登錄後才可以回帖 登錄 | 我要註冊

本版積分規則

小黑屋|手機版|NoName Team 電腦資訊討論區 |網站地圖

GMT+8, 2025-11-22 13:30 , Processed in 0.642893 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表