zsppp/Arknights-Sora

关于v1.1.5的 maxtouch 问题 (也有可能是自己Python没安装对)

Closed this issue · 4 comments

Hi,
根据作者上次给出的python安装教程, 尽管我不清楚有没有正确安装所有的依赖包, 我通过python3.8运行后出现了如下问题:

战斗不会开始, 游戏内没有任何事情发生
雷电模拟器: 4.0.72

[23:15:01][DEBUG]<arknights.Func><line 65> Base init
[23:15:01][INFO]<arknights.Gui><line 23> 正在启动...
[23:15:01][INFO]<arknights.Func><line 98> 启动 airtest ,adb 连接...
[23:15:01][INFO]<arknights.Func><line 99> adb connect emulator-5554
[23:15:01][INFO]<arknights.Func><line 109> adb connect successed.
[23:15:02][INFO]<arknights.Func><line 116> render: [0, 0, 1280, 720]
[23:15:02][INFO]<arknights.Func><line 117> border: (0, 0)
[23:15:02][INFO]<arknights.Func><line 118> scale: 1.5
[23:15:02][INFO]<arknights.Func><line 119> region: 0, 720
[23:15:02][INFO]<arknights.Func><line 120> region: 0, 1280
[23:15:03][INFO]<arknights.Func><line 121> snapshot size: 2764800
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\android.py:224: DeprecationWarning: maxtouch is deprecated, use touch_proxy instead
warnings.warn("{old_name} is deprecated, use {new_name} instead".format(old_name=old_name, new_name=new_name),
C:\Program Files\Python38\lib\subprocess.py:946: ResourceWarning: subprocess 15620 is still running
_warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedWriter name=6>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedReader name=7>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedReader name=8>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:95: ResourceWarning: unclosed <socket.socket fd=1704, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 5781), raddr=('127.0.0.1', 18920)>
self.client = s
ResourceWarning: Enable tracemalloc to get the object allocation traceback
[23:15:04][INFO]<arknights.Gui><line 36> OK!
[23:15:08][INFO]<arknights.Func><line 286> ---------- arkFunc ------------------------
[23:15:08][INFO]<arknights.Func><line 287> Battle Total:5, Sanity Total:0
[23:15:08][INFO]<arknights.Func><line 289> -------------------------------------------

不知道是我python没有安装好还是什么其他原因?

谢谢

zsppp commented

Hi,
程序能跑起来有打印信息,说明依赖的库都有了;
这两句打印显示模拟器当前分辨率是1280x720,我自己试了一下确实不行

[23:15:02][INFO]<arknights.Func><line 119> region: 0, 720
[23:15:02][INFO]<arknights.Func><line 120> region: 0, 1280

问题的原因是坐标没针对不同分辨率做调整,可以先把模拟器调成1920x1080就能正常运行

代码不完善,忘了注明这个情况了

请问这个分别率的问题是使用Python运行时独有的吗?
因为我在运行您打包的v1.1.2的exe文件时, 1280x720是完全没有问题可以运行脚本的

zsppp commented

只是代码问题,刚刚提交修复了,可以试试(汗)
特地把代码切到v1.1.2 尝试了一下也是不行的,可能是更早的版本没问题(没继续用更旧的版本尝试了)

记得之前的坐标是写死的,然后在初始化时根据模拟器分辨率做了转换
后来某次提交,点击坐标修改成匹配图片的位置。但是这个匹配图片是先把当前模拟器截图转成1920x1080,然后再拿去跟image目录的图片匹配,得到的图片位置坐标是基于1920x1080,此时应该再把坐标转换回跟当前分辨率

抱歉! 原来能够用的版本是v1.0.7 (记错啦. 现在想起来确实v1.1.2的exe也不能运行)

理解了!
经尝试, v1.1.6能够在1280x720下正常运行脚本, (尽管还是有6个warning但应该是不妨碍脚本的运行)

只不过并不是每一次都会在成功清理完理智后进入好友收取线索. 我的解决方法是手动点入第一个好友基建, 然后再以0行动次数点击开始行动

[00:12:28][DEBUG]<arknights.Func><line 65> Base init
[00:12:28][INFO]<arknights.Gui><line 23> 正在启动...
[00:12:29][INFO]<arknights.Func><line 98> 启动 airtest ,adb 连接...
[00:12:29][INFO]<arknights.Func><line 99> adb connect emulator-5554
[00:12:29][INFO]<arknights.Func><line 109> adb connect successed.
[00:12:30][INFO]<arknights.Func><line 116> render: [0, 0, 1280, 720]
[00:12:30][INFO]<arknights.Func><line 117> border: (0, 0)
[00:12:30][INFO]<arknights.Func><line 118> scale: 1.5
[00:12:30][INFO]<arknights.Func><line 119> region: 0, 720
[00:12:30][INFO]<arknights.Func><line 120> region: 0, 1280
[00:12:31][INFO]<arknights.Func><line 121> snapshot size: 2764800
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\android.py:224: DeprecationWarning: maxtouch is deprecated, use touch_proxy instead
warnings.warn("{old_name} is deprecated, use {new_name} instead".format(old_name=old_name, new_name=new_name),
C:\Program Files\Python38\lib\subprocess.py:946: ResourceWarning: subprocess 5936 is still running
_warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedWriter name=6>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedReader name=7>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:64: ResourceWarning: unclosed file <_io.BufferedReader name=8>
self.server_proc = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\tommy\AppData\Roaming\Python\Python38\site-packages\airtest\core\android\touch_methods\maxtouch.py:95: ResourceWarning: unclosed <socket.socket fd=1372, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 19017), raddr=('127.0.0.1', 14231)>
self.client = s
ResourceWarning: Enable tracemalloc to get the object allocation traceback
[00:12:32][INFO]<arknights.Gui><line 36> OK!
[00:12:44][INFO]<arknights.Func><line 290> ---------- arkFunc ------------------------
[00:12:44][INFO]<arknights.Func><line 291> Battle Total:1, Sanity Total:0
[00:12:44][INFO]<arknights.Func><line 293> -------------------------------------------
[00:12:50][INFO]<arknights.Func><line 368> ---Battle Start--- 1/1
[00:13:05][INFO]<arknights.Func><line 334> Battle Continue...
[00:14:58][INFO]<arknights.Func><line 374> ---Battle Finished--- total= 1, cost time= 2 minutes, 13 seconds
[00:15:00][INFO]<arknights.Func><line 394> 领取任务奖励...
[00:15:07][INFO]<arknights.Func><line 391> 尚有任务未完成
[00:15:09][INFO]<arknights.Func><line 391> 尚有任务未完成
[00:15:09][INFO]<arknights.Func><line 400> 任务领取完毕...
[00:15:29][INFO]<arknights.Func><line 290> ---------- arkFunc ------------------------
[00:15:29][INFO]<arknights.Func><line 291> Battle Total:1, Sanity Total:0
[00:15:29][INFO]<arknights.Func><line 293> -------------------------------------------
[00:15:32][INFO]<arknights.Func><line 368> ---Battle Start--- 1/1
[00:15:42][INFO]<arknights.Func><line 334> Battle Continue...

感谢您的时间和帮助!