坐下 
  
GetActiveWindowXY(WinX0, WinY0) 
 print("休息") 
 if not CheckColor(WinX0+202, WinY0+645, Color(224, 41, 84), 10) then//人物血量剩餘多少以下休息 
  Wait(100) 
  KeyPress("F") 
  Wait(300) 
  KeyDown("x") 
  Wait(1000) 
  KeyUp("x") 
  do  //循環 
   Wait(500) 
  loop until CheckColor(WinX0+242, WinY0+647, Color(136, 25, 49), 10)//直到血量到達 
 end if 
 
反擊 
  
if CheckColor(WinX0+530, WinY0+33, Color(220, 59, 99), 10) then //這裡是防止坐下的時候有怪在打 
     
    //以下為嚮導添加的代碼 
    KeyPress("1") 
    Wait(300)      
    KeyPress("1") 
    Wait(300)   
     
    do 
     keyPress("1",1000)   //打怪 
    loop while CheckColor(WinX0+447, WinY0+31, Color(21, 22, 27), 10)   //直到怪物框框上的點沒有出現 
   end if   
 
兩者如何結合? 
還是這反擊公式就是錯誤的? 
 
用了一下子發現,有加跟沒加一樣(反擊)= =!! 
 
如果套用了之後,我整個腳本變成... 
 
 
腳本 
  
#[HOTKEY][EXT]HOME 
function main 
 SetInputMode(3) //驅動模式,很多遊戲會阻擋SP的部份功能,可以套用此函數 
 while true    //循環開始 
  State() //子函數狀態 
 wend        //返回while開始循環 
end function 
function State 
 //取窗口原點坐標 
 GetActiveWindowXY(WinX0, WinY0) 
 print("休息") 
 if not CheckColor(WinX0+202, WinY0+645, Color(224, 41, 84), 10) then//人物血量剩餘多少以下休息 
  Wait(100) 
  KeyPress("F") 
  Wait(300) 
  KeyDown("x") 
  Wait(1000) 
  KeyUp("x") 
  do  //循環 
   Wait(500) 
  loop until CheckColor(WinX0+242, WinY0+647, Color(136, 25, 49), 10)//直到血量到達 
 end if 
 GetActiveWindowXY(WinX0, WinY0) 
 if not CheckColor(WinX0+21, WinY0+8, Color(255, 251, 147), 10) then //當左上第一個技能消失後按5(抓顏色) 
  Print("輔助") 
  KeyDown("F1") 
  Wait(500) 
  KeyUp("F1")  
  KeyDown("5") 
  Wait(1000) 
  KeyUp("5") 
 end if 
 GetActiveWindowXY(WinX0, WinY0) 
 if not CheckColor(WinX0+41, WinY0+16, Color(253, 254, 254), 10) then //當左上第二個技能消失後按6(抓顏色) 
  Print("輔助") 
  KeyDown("F1") 
  Wait(500) 
  KeyUp("F1")  
  KeyDown("6") 
  Wait(1000) 
  KeyUp("6") 
 end if 
  
 GetActiveWindowXY(WinX0, WinY0) 
 if not CheckColor(WinX0+565, WinY0+31, Color(190, 50, 84), 10) then//怪物血量沒滿 
  do   
   KeyDown("Tab") 
   Wait(100) 
   KeyUp("Tab") 
   Wait(500) 
  loop until CheckColor(WinX0+586, WinY0+33, Color(113, 31, 50), 10)//怪物滿血的位置 
 end if 
  
 GetActiveWindowXY(WinX0, WinY0) 
 if not  CheckColor(WinX0+505, WinY0+11, Color(255, 255, 255), 10) then//NPC名字顏色(白) 
  do   
   Print("Npc") 
   KeyDown("Tab") 
   Wait(100) 
   KeyUp("Tab") 
   Wait(500) 
  loop until CheckColor(WinX0+586, WinY0+33, Color(113, 31, 50), 10)//怪物滿血的位置 
 else //找到的話… 
  do //執行攻擊(按鍵 1、2、3) 
  Print("攻擊") 
  for ForCount = 1 to 1 
   KeyDown("1") 
   Wait(3500) 
   KeyUp("1") 
   KeyDown("2") 
   Wait(1000) 
   KeyUp("2") 
   Wait(500) 
   KeyDown("3") 
   Wait(1000) 
   KeyUp("3") 
   Wait(1500) 
    
   if CheckColor(WinX0+530, WinY0+33, Color(220, 59, 99), 10) then //這裡是防止坐下的時候有怪在打 
     
    //以下為嚮導添加的代碼 
    KeyPress("1") 
    Wait(300)      
    KeyPress("1") 
    Wait(300)   
     
    do 
     keyPress("1",1000)   //打怪 
    loop while CheckColor(WinX0+447, WinY0+31, Color(21, 22, 27), 10)   //直到怪物框框上的點沒有出現 
   end if   
   GetActiveWindowXY(WinX0, WinY0) 
   if not CheckColor(WinX0+170, WinY0+645, Color(221, 40, 82), 10) then //血剩多少以下喝水 
    Print("補血") 
    KeyPress("4") 
    wait(300) 
   end if 
   GetActiveWindowXY(WinX0, WinY0) 
   if CheckColor(WinX0+522, WinY0+139, Color(250, 210, 0), 10) then //碰障礙物無法攻擊的字體顏色 
    Print("無法攻擊")  
    KeyDown("2") 
    Wait(3000) 
    KeyUp("2") 
    Wait(3000) 
    KeyDown("Tab") 
    Wait(100) 
    KeyUp("Tab")  
    Wait(500)  
   end if 
  next 
 loop while CheckColor(WinX0+450, WinY0+32, Color(118, 31, 52), 10) //怪物血量到達0如果還有血會跳回去 
 Print("死亡") 
 KeyDown("2") 
 Wait(1000) 
 KeyUp("2") 
 Wait(100) 
 KeyPress("ESC") 
 Wait(500) 
 KeyPress("F") 
 Wait(500) 
end if 
end function  
 
有大大可以幫看錯誤嗎? |