nopeAnon / Automated-HoloCure-Fishing

Automated Holocure Fishing Bot
GNU General Public License v3.0
67 stars 33 forks source link

Doesnt work in 2nd screen #21

Open MINEJHAZZ opened 1 year ago

MINEJHAZZ commented 1 year ago

I have a dual monitor setup and this doesn't work when I put my game on my 2nd monitor

Thehail commented 1 year ago

I have three monitors and it works even without the multiple monitors option enabled. Make sure you installed everything properly.

nopeAnon commented 1 year ago

can you try this https://github.com/nopeAnon/Automated-HoloCure-Fishing/issues/13#issue-1859478637

MINEJHAZZ commented 1 year ago

can you try this #13 (comment)

I installed it just like the instructions indicated in the README file.

  1. opening the prepare.bat
  2. launch_python.bat
  3. holocure_fishing.py But upon reaching the 3rd step, the terminal for "holocure_fishing.py" suddenly closes

Upon manually drag and dropping the holocure_fishing.py in my terminal to see the error it gives out, it sends this out Screenshot 2023-08-22 231912

I then started from scratch and manually installed everything via the ff.

  1. Downloading the repository again => extract it somewhere
  2. Open the terminal in the extracted directory and run "pip install -r requirements.txt"

After this the script worked, but only if my game was on my main monitor, when I put it on a different screen, the script was not able to see my game window

also @Thehail you said "multiple monitors option" Where can I possibly see the option and how do I enable it if it's available?

Edit: This occurred to me on commit d2f8fa70fe77f1887694692f6fb5c788d4fdba54

nopeAnon commented 1 year ago

yeah you should update a lot has changed and I noticed that the bat files were bugged so Its fixed in the latest update

MINEJHAZZ commented 1 year ago

sad news, upon downloading the new update, it became worse and now everything doesn't work anymore XD

nopeAnon commented 1 year ago

how... Can you explain it more in detail? What do you mean by doesn't work anymore? Can you give me the error message if there is one?

MINEJHAZZ commented 1 year ago

how... Can you explain it more in detail? What do you mean by doesn't work anymore? Can you give me the error message if there is one?

Unfortunately, it did not give me any error codes... After running the "holocure_fishing.py" this gets displayed image

After opening the game and trying to fish, nothing happens

nopeAnon commented 1 year ago

On line 15, there : DEBUG = False change it to DEBUG = True

It should open a window that shows the fishing area and show the scanning fps. If you see those, the programs should be working properly

MINEJHAZZ commented 1 year ago

I went back to my previous version commit d2f8fa70fe77f1887694692f6fb5c788d4fdba54 and it works fine but of the multimonitor bug is still present...

Also idk if this will help but this is my PC specs where I'm running it on CPU: Ryzen 5 5600G GPU: RX 5700XT RAM: 32GB OS: Windows 11 Pro

nopeAnon commented 1 year ago

I went back to my previous version commit https://github.com/nopeAnon/Automated-HoloCure-Fishing/commit/d2f8fa70fe77f1887694692f6fb5c788d4fdba54 and it works

That is really weird, I didn't even change the code in the latest commit, only the batch files...

Ok, I'll ask some questions for now

  1. What is your python version
  2. What resolution are you playing holocure at? 720 or 1080
  3. Did you open it throught launch_python.bat or holocure_fishing.py

Turn on the debug flag at line 15 and send me a screenshot like this

image

MINEJHAZZ commented 1 year ago
  1. Python 3.10.6
  2. 720p Windowed
  3. I launched it manually via "py ./holocure_fishing.py" on the installed directory Heres the screenshot you asked: image

Also, upon running it with debug on, i got an error named "ZeroDivisionError: Float Division by Zero" after hanging or just hovering my mouse over the holocure window image

nopeAnon commented 1 year ago

How the heck did elapsed even go to 0. That shouldn't be even possible. It calculates the time from start to the end of the loop. It's impossible for it to be 0 with all that computation in a single loop.

The scanning region way off too. I think you can solve it by adjusting the left and top values of BASE_ROI in line 31. But it should have properly got the area. Since the dpi is already disabled.

Can I ask the resolution and dpi of your monitors?

I'm going to think about this tomorrow.

MINEJHAZZ commented 1 year ago

Bahahahha, same, I tried to understand it as well but I'm as confused as you are XD Summary: My Monitor 1 and 2 is set at 1080p

Long explanation, My monitor's native video support is up to 720p, but my monitor is capable of being "soft-forced" to be set at 1080p using AMD Radeon

So I removed line 111-114, which removed the ZeroDivisionError but after that, it's still not working as if the debug was set to false And the area being scanned is incorrect as well(tried on 720p and 1080p)

MINEJHAZZ commented 1 year ago

I have a dual monitor setup and this doesn't work when I put my game on my 2nd monitor

Update: The commit that was previously made on e0b828915c7e949a4cb00b5e3fc6f31df21f52bc and up to commit e97c6ee2a0e0a6850836990ee3f76d3bf38bea8c fixed the "dual monitor" bug by adjusting the settings you made: image

It can now detect my game window on my 2nd monitor, BUT the problem is, the scanner is not able to pinpoint which button to press, so far it it can only press the "ok" button as well as continue the cycle <<== this one is only broken on the second monitor option

I haven't tested the other commits yet as I'm now getting scolded for using my PC at this hour XD

nopeAnon commented 1 year ago

I did some test of my own and noticed that if your monitor resolution is 1280x720 or lower. The script captures the wrong region. But if it is higher than 720p then it works in any resolution or scale. I think this is the problem.

As for the elapsed part, can you put a time.sleep(0.01) above the elapsed = time.time() - last_time and see if it is still giving a ZeroDivisionError. If it still gives a ZeroDivisionError after that, then I don't know anymore...

MINEJHAZZ commented 1 year ago

It still doesn't work, so far after the overhaul for the script was made, it became unusable for me TwT

Though at least the previous commits still works so I can just use those for now and only use it while the game is on the main screen

Also I noticed on the old commit, it does work and tries to scan my 2nd monitor, but upon finding the hitbox, it suddenly forces the scanner to go back to the 1st monitor so it breaks the program

MINEJHAZZ commented 1 year ago

Good news @nopeAnon I managed to temporarily fix the dual monitor bug for commit e97c6ee2a0e0a6850836990ee3f76d3bf38bea8c I changed these lines on the "holocure_fishing.py" image image

So for now I'm gonna use the old version while the new version is still not usable for me

MINEJHAZZ commented 1 year ago

Whoops accidentally pressed closed

Hexus-One commented 1 year ago

Hi sorry my refactor/rewrite of this program was coded and tested on Windows 10 so I don't know how it would behave in Win11 - see issue #34 for similar discussion

Hexus-One commented 1 year ago

Also, upon running it with debug on, i got an error named "ZeroDivisionError: Float Division by Zero"

I did some research and discovered the precision of time.time() on Windows can be as bad as 16ms, and with the script so running so quickly it's possible for consecutive calls to return the same value - we should probably replace it with time.perfcounter()