#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. CoordMode, pixel, Client CoordMode, mouse, Client ;https://autohotkey.com/docs/Functions.htm#Global ;========= SETTING ========= ;NOTE: change as needed (Looks like you have instant_heal and quick_heal with the same keypresses) global Player := {} , Spells := {"resurrection_spell": "!0","instant_heal": "!1","slower_heal": "!2","quick_heal": "!1"} Player.Krennkey := {} Player.Kostuskey := {} Player.Iliakey := {} Player.Dreyelkey := {} Player.Danicuskey := {} Player.Krennkey.charbut := "^+!F1" Player.Kostuskey.charbut := "^+!F2" Player.Iliakey.charbut := "^+!F3" Player.Dreyelkey.charbut := "^+!F4" Player.Danicuskey.charbut := "^+!F5" ;~ resurrection_spell (0hp) Player.Krennkey.resurrection_spell := [1177, 542, 1178, 543] Player.Kostuskey.resurrection_spell := [1034, 542, 1035, 543] Player.Iliakey.resurrection_spell := [892, 542, 893, 543] Player.Dreyelkey.resurrection_spell := [748, 542, 749, 543] Player.Danicuskey.resurrection_spell := [606, 542, 607, 543] ;~ instant_heal (25hp) Player.Krennkey.instant_heal := [1208, 542, 1209, 543] Player.Kostuskey.instant_heal := [1065, 542, 1066, 543] Player.Iliakey.instant_heal := [923, 542, 924, 543] Player.Dreyelkey.instant_heal := [779, 542, 780, 543] Player.Danicuskey.instant_heal := [637, 542, 638, 543] ;~ slower_heal (50hp) Player.Krennkey.slower_heal := [1242, 542, 1243, 543] Player.Kostuskey.slower_heal := [1099, 542, 1100, 543] Player.Iliakey.slower_heal := [957, 542, 958, 543] Player.Dreyelkey.slower_heal := [813, 542, 814, 543] Player.Danicuskey.slower_heal := [671, 542, 672, 543] ;~ quick_heal (75hp) Player.Krennkey.quick_heal := [1275, 542, 1276, 543] Player.Kostuskey.quick_heal := [1133, 542, 1134, 543] Player.Iliakey.quick_heal := [990, 542, 991, 543] Player.Dreyelkey.quick_heal := [846, 542, 847, 543] Player.Danicuskey.quick_heal := [704, 542, 705, 543] $e::CheckHp() $1::CheckObjects() ; testing only ; Function Reference ; https://autohotkey.com/docs/Functions.htm CheckHp() { static HP_col := "0xF58CBA" for spellname, Healbut in Spells { for name in Player { PixelSearch,,, Player[name][spellname].1, Player[name][spellname].2, Player[name][spellname].3, Player[name][spellname].4, HP_col, 5, RGB if (ErrorLevel) Heal(Player[name].charbut,Healbut) } } } Heal(charbut,HealBut) ; Char Button = F1/F2/F3/F4/F5 HealBut=Heal button 0/1/2/3/4 etc { Send, {%charbut% Down} ; send Char Keybutton Down , in your case F1/F2/F3/F4 Sleep, 75 ; Delay 75 ms Send, {%charbut% Up} ; send Char Keybutton Up Sleep, 100 KeyWait, e, D ; wait for "e" button to be pressed again Sleep, 100 ; delay 100ms to avoid "e" press button too long Send, %healbut% ; send Heal button, in your case 0/1/2/3/4 } CheckObjects() { ; testing only for spellname, Healbut in Spells { for name in Player { MsgBox % "name= " . name . "`n" . "charbut= " . Player[name].charbut . "`n" . "spellname= " . spellname . "`n" . "healbut= " . healbut . "`n" . "X1= " . Player[name][spellname].1 . "`n" . "Y1= " . Player[name][spellname].2 . "`n" . "X2= " . Player[name][spellname].3 . "`n" . "X2= " . Player[name][spellname].4 } } }
这啥啊