wegame一键连发存在性能问题,所以写了个AHKv2脚本,需要搭配wegame剑盾20ms单技能连发。

; 适用于AHKv2的精灵骑士连发脚本
; 需要搭配wegame剑盾连发,建议将剑盾设置为20ms,使用时按住剑盾和最下方设置键

#SingleInstance Force
#Requires AutoHotkey v2.0
full_command_line := DllCall("GetCommandLine", "str")

; 获取管理员权限
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
  try
  {
    if A_IsCompiled
      Run '*RunAs "' A_ScriptFullPath '" /restart'
    else
      Run '*RunAs "' A_AhkPath '" /restart "' A_ScriptFullPath '"'
  }
  ExitApp
}
;MsgBox "A_IsAdmin: " A_IsAdmin "`nCommand line: " full_command_line

; 开启/关闭脚本 快捷键为右边Shift键
#SuspendExempt
RShift:: Suspend
#SuspendExempt False

; 返回游戏的keycode
GetSpecialKeycode(key) {
  base := "vkFDsc"
  sc := GetKeySC(key)
  keycode := Format("{1}{2:03X}", base, sc)
  return keycode
}

;上
MyUp := GetSpecialKeycode("e")
;下
MyDown := GetSpecialKeycode("d")
;左
MyLeft := GetSpecialKeycode("s")
;右
MyRight := GetSpecialKeycode("f")
;普攻
MyJ := GetSpecialKeycode("j")
;跳
MyK := GetSpecialKeycode("k")
;Z
MyL := GetSpecialKeycode("l")
;空格
MySpace := GetSpecialKeycode(" ")

; 处理技能组,将按键转换为keycode
ParseList(list) {
  newArray := []
  for k, v in list {
    if (v = MyUp || v = MyDown || v = MyLeft || MyRight) {
      newArray.Push(v)
    } else {
      newArray.Push(GetSpecialKeycode(v))
    }
  }
  return newArray
}

; 输入按键,默认是按下40ms+松开30ms
DNF(key, down := 40, up := 30) {
  SendInput "{" key " down}"
  Sleep down
  SendInput "{" key " up}"
  Sleep up
}

; 按住key时持续释放技能组
Press(key, arr) {
  index := 1
  while (GetKeyState(key, "P")) {
    value := arr[index]  
    if (value = MyUp || value = MyDown || value = MyRight) {
      DNF(value, 100)
    } else {
      DNF(value)
    }
    index := Mod(index, arr.Length) + 1
  }
}

; 一次性的技能组,不可暂停
Run(list) {
  for index, value in list {
    if (value = MyUp || value = MyDown || value = MyRight) {
      DNF(value, 100)
    } else {
      DNF(value)
    }
  }
}


;自定义快捷键

P:: {
  DNF(MyUp)
  DNF(MyDown)
  DNF(MyJ)
}

R:: {
  DNF(MyUp)
  DNF(MyUp)
  DNF(MySpace)
}

V:: {
  DNF(MyDown)
  DNF(MyDown)
  DNF(MySpace)
}

y:: {
  DNF(MyUp)
  DNF(MyUp)
  DNF(MyJ)
}

.:: {
  DNF(MyDown)
  DNF(MyDown)
  DNF(MyJ)
}

; h是盾挑,i是盾牌格挡,自行调整
; 跃没有加入技能组,需要的话可以添加到末尾
list := ParseList(["h", "i", "b", "g", "q", "o", "a", "h", "i", "u", MyDown, MyUp])

; 按住M键持续释放list技能组
M:: {
  Press("M", list)
}

魔力sama
1 声望0 粉丝

引用和评论

0 条评论