Skip to content

Commit

Permalink
异常处理失败时尝试重启游戏,可查看历史异常
Browse files Browse the repository at this point in the history
  • Loading branch information
UCPr251 committed Nov 16, 2024
1 parent 74f0311 commit 066541d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 20 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
- 针对 **旧都列车·前线****拿命验收** 关卡设计
- 基于 [**AutoHotKey v2**](https://www.autohotkey.com) 实现的 **零号业绩****零号空洞银行存款****丁尼** 自动刷取
> 业绩约2分钟一把,可获得20业绩+银行存款,2小时不到就能刷满一周900业绩上限并拿满周任务奖励
> 丁尼约30秒一把,可获得80丁尼,每小时可获取约1w丁尼
> 丁尼约30秒一把,可获得80丁尼,每小时可获取约1w丁尼
> 丁尼约30秒一把,可获得80丁尼,每小时可获取约7k丁尼
- 支持多比例 **全屏****窗口** 运行
- 简单轻量易用,对于不同 **分辨率、帧率、缩放、HDR、字体等** 具有良好的适应性

Expand All @@ -23,7 +22,6 @@
- 2. 默认编队首位必须为 **比利** ,其他随意
- 3. 请在副本内调整 **视角转动值** 以确保对齐NPC

## 下载方法
## 下载方法

> PS: 程序报毒系正常现象,担心的话可以跑源码或者自行编译,怕别用用别怕
Expand All @@ -43,7 +41,7 @@
- Alt+P :暂停/恢复刷取,快捷指令,也可通过控制面板修改
- Alt+C :打开/关闭[控制面板](./控制面板.jpg),相关信息:
> **休眠系数**:调整脚本在加载动画时的等待时长倍率
> <br>**异常重试次数**允许总的异常时重试的次数
> <br>**异常重试次数**允许异常后尝试重试/重启的总次数,发生异常后值减一,双击可查看历史异常
> <br>**颜色搜索允许RGB容差**:过大可能误点,过小可能匹配失败,按需调整
> <br>**视角转动值**:丁尼模式下进入副本后的视角转动值,首次运行时请调整该值以确保对齐NPC:转动幅度过大则需减小,反之则需增大
> <br>**使用炸弹**:修改走格子邦布插件快捷使用方式,请保持和游戏内一致:长按/点击
Expand Down
2 changes: 1 addition & 1 deletion utils/Panel.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Panel {
EG.OnEvent('Change', changeSleepCoefficient)
this.CP.AddUpDown('-2', setting.sleepCoefficient).OnEvent('Change', UpDownChange)
this.CP.AddText('X30', '异常重试次数:')
this.CP.AddText('X30', '异常重试次数:').OnEvent('DoubleClick', (*) => MsgBox(retry(), '历史异常', '0x40000'))
this.CP.AddEdit('X+10 w60 h25 Limit3 Number').OnEvent('Change', changeRetryTimes)
this.CP.AddUpDown('Range0-999', setting.retryTimes).OnEvent('Change', changeRetryTimes)
Expand Down
64 changes: 49 additions & 15 deletions 零号业绩.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @file 零号业绩.ahk
* @author UCPr
* @date 2024/11/16
* @version v2.0.0.2
* @version v2.1.0
* @link https://github.com/UCPr251/zzzAuto
* @warning 请勿用于任何商业用途,仅供学习交流使用
***********************************************************************/
Expand Down Expand Up @@ -42,7 +42,7 @@ SetMouseDelay(-1)
#Include getDenny.ahk
#Include enterHDD.ahk
global Version := "v2.0.0"
global Version := "v2.1.0"
global ZZZ := "ahk_exe ZenlessZoneZero.exe"
init()
Expand Down Expand Up @@ -170,29 +170,32 @@ main() {
}
/** 出现异常后重试 */
retry(reason) {
isYeJi := setting.mode = 'YeJi'
if (!setting.errHandler || ((isYeJi ? setting.statistics : setting.statisticsDenny).Length = 0)) {
throw Error(reason)
}
retry(reason?) {
static errReasons := []
errReasons.Push(reason)
getErrorMsg() {
errMsg := ""
static getErrorMsg() {
errMsg := "历史异常:"
loop (errReasons.Length) {
errMsg .= "`n异常" A_Index ":" errReasons[A_Index]
err := errReasons[A_Index]
errMsg .= "`n异常" A_Index ":[" err.time "] " err.reason
}
errReasons := []
return errMsg
}
if (!IsSet(reason) || !reason) {
return getErrorMsg()
}
isYeJi := setting.mode = 'YeJi'
if (!setting.errHandler || ((isYeJi ? setting.statistics : setting.statisticsDenny).Length = 0)) {
throw Error(reason)
}
errReasons.Push({ time: FormatTime(A_Now, "HH:mm:ss"), reason: reason })
setting.retryTimes--
if (setting.retryTimes < 0) {
Ctrl.stop()
errReasons := []
setting.retryTimes := setting.oriSetting.retryTimes
return MsgBox("【错误】异常重试次数过多,脚本结束" getErrorMsg(), "错误", "Iconx 0x40000")
return MsgBox("【错误】异常重试次数过多,脚本结束`n" getErrorMsg(), "错误", "Iconx 0x40000")
}
MsgBox("【错误】连续刷取过程中出现异常:`n" reason "`n`n将在6s后重试", "错误", "Iconx T6 0x40000")
MsgBox("【错误】连续刷取过程中出现异常:`n" reason "`n`n将在3s后重试", "错误", "Iconx T3 0x40000")
RandomSleep()
page := 0
; 卡在空洞走格子、交互、确认界面,子界面
Expand Down Expand Up @@ -269,7 +272,38 @@ retry(reason) {
}
return runAutoZZZ()
}
return MsgBox("【重试失败】未找到零号空洞关卡选择界面,脚本结束`n重试原因:" reason "`n异常次数:" errReasons.Length "`n历史异常:" getErrorMsg(), "错误", "Iconx 0x40000")
try {
GamePath := WinGetProcessPath(ZZZ)
if (GamePath) {
MsgBox("【重启】返回主界面失败,将在3s后重启游戏", "执行重启", "Icon! T3 0x40000")
WinClose(ZZZ)
Sleep(1000)
while (WinExist(ZZZ)) {
Sleep(251)
}
Sleep(1000)
Run(GamePath)
Sleep(8000)
while (!WinExist(ZZZ)) {
Sleep(251)
}
Sleep(1000)
c.reset()
loop (3) {
while (recogLocation(10) != 1) {
SimulateClick(c.width // 2, c.height // 2)
Sleep(1000)
}
Sleep(1000)
if (recogLocation(10) = 1) {
return runAutoZZZ()
}
}
}
} catch Error as e {
MsgBox("【重启失败】重启游戏失败,脚本结束`n重启失败原因" e.Message "`n重启原因:" reason "`n异常总次数:" errReasons.Length "`n" getErrorMsg(), "错误", "Iconx 0x40000")
errReasons := []
}
}
/** 运行刷取脚本 */
Expand Down

0 comments on commit 066541d

Please sign in to comment.