lewisgibson / monopoly-go-bot

Automate playing Monopoly Go! using Python and Bluestacks.
47 stars 12 forks source link

It's not working. #1

Closed SouzaRicardoG closed 1 year ago

SouzaRicardoG commented 1 year ago

Hi Lewis.

I tried to execute your bot, but something is not working.

How Could I send you more information about it?

I download the project in zip format, unpack in a directory. by the powershell with admin, I install the requirements and after start the scrit (with the bluestacks opened and the monopoly go working). But after execute the script, it appear that nothing happens.

I tried to toggle f2 also, but nothing happens.

I'm using python 3.8, bluestack 5.

Thanks in advance Ricardo

lewisgibson commented 1 year ago

Hey @SouzaRicardoG, it appears that the script is functioning correctly, but it's encountering difficulty in locating the images. Could you please verify that it hasn't moved your mouse?

If you have any additional information, it would be greatly appreciated.

When I run bluestacks I have it set to a height of 1440p in portrait mode with the width adjusted to match the default aspect ratio. It's possible that the images aren't being detected because your window size is different from when I initially wrote the script.

As a last resort, you can replace the files in the images directory with your own screen captures. It's possible that the aspect ratio or color of the images may vary slightly compared to when I took them.

MarcoReckless commented 1 year ago

I'm having the same issue at 1440x2560, running on BlueStacks 5.12.105.

SouzaRicardoG commented 1 year ago

Hi @lewisgibson. I did some more testes here, like uninstall the python and install the lastest version (3.11), download your code again and unzip, etc., but I got the same problem...

I saw that another screen opens and quickly closes when I press F2 screen. I took my phone and recorded the execution and was able to capture an error that occurs when the bot is executed.

Also, I checked the resolution of bluestack and it is the same you said: 1440x2560

Error_monopoly_Bot

Hope this help you.

Thanks

lewisgibson commented 1 year ago

Thanks for the screenshot @SouzaRicardoG. This provides much greater context. The script is crashing because a system library, OpenCV, is not installed. OpenCV is a computer vision library used for image detection in pyautogui.

You can install opencv with pip install opencv-python and it will handle everything for you. I have updated the requirements.txt with 51aaf311e683cb1775a3244e2b2818c7fd48332e to capture this.

If you do not wish to execute the command above, you can instead download the new zip file and follow the instructions as normal.

lewisgibson commented 1 year ago

Let me know if the above changes fix your problems and I will close the issue 🙂

MarcoReckless commented 1 year ago

Let me know if the above changes fix your problems and I will close the issue 🙂

While it now manages to search for the elements in the issue, it gets stuck hovering on the album button. Also, I have a doubt, 'z_build.png' got screenshotted with 5 pending notifications, wouldn't it be better if you captured only the part with the hammer? I believe it can cause trouble when using the bot.

lewisgibson commented 1 year ago

@MarcoReckless Support for building and upgrading structures is pretty experimental. Please open a new issue if you'd like to discuss it more, but it is on the todo list. Searching for the hammer exclusively would result in a loop of opening and closing the build page when there are no structures to upgrade. The system should be expanded to read 1/2/3/4/5 notification icon most likely.

Regarding the album hovering, can you provide a screenshot? Feel free to submit a PR with replacement image targets if you feel that is the issue.

MarcoReckless commented 1 year ago

@MarcoReckless Support for building and upgrading structures is pretty experimental. Please open a new issue if you'd like to discuss it more, but it is on the todo list. Searching for the hammer exclusively would result in a loop of opening and closing the build page when there are no structures to upgrade. The system should be expanded to read 1/2/3/4/5 notification icon most likely.

Regarding the album hovering, can you provide a screenshot? Feel free to submit a PR with replacement image targets if you feel that is the issue.

I see, I didn't read the readme file in its entirety. Anyway, I recorded a small video so it should be a bit more clear, basically it keeps trying to press the album button from what I can see.

lewisgibson commented 1 year ago

Thanks for the video @MarcoReckless. Looks like it's getting stuck on the build upgrade scan. You can make another folder in the project directory called disabled and move the image it's getting stuck on from images into the disabled folder. In this case it's build-upgrade.png. Building is still quite experiment so I suspect there will be issues with it. I will address issues like this properly at a later date when I can dedicate more time to this project.

SouzaRicardoG commented 1 year ago

Let me know if the above changes fix your problems and I will close the issue 🙂

@lewisgibson, I follow your recomendation and now it's working...

I face the same problem reported by Marco, so I moved the image to disable folder.

Just to let you know, I needed to make new copies of the images, because the ones in the folder weren't working. I don't know for sure, if the problem was the size of your images or if it was something related to the tone of the colors, because some colors on my laptop are with different tones from the images that you made available. When I made a copy of the images, copying from my bluestack/laptop, it worked.

You can close this issue, as the problem reported was solved.

Thanks a lot!!!