asarandi / wordscapes-bot

python bot that plays wordscapes via scrcpy, pyautogui
https://en.wikipedia.org/wiki/Wordscapes
25 stars 14 forks source link

I can not get the bot to function #1

Open JaxzKyd opened 3 years ago

JaxzKyd commented 3 years ago

I have all the requirements installed. When I try to use the bot the cursor goes random, the console output was, -x was unexpected at this time. and Traceback (most recent call last): File "C:\Users\Owner\wordscapes-bot\script.py", line 206, in <module> click(config["shuffle_button"]) File "C:\Users\Owner\wordscapes-bot\script.py", line 188, in click pyautogui.click(cx, cy) File "C:\Users\Owner\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 597, in wrapper failSafeCheck() File "C:\Users\Owner\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 1722, in failSafeCheck raise FailSafeException( pyautogui.FailSafeException: PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.

How do I fix this issue?

asarandi commented 3 years ago

ahh, i have not tried running this on windows - you might need to experiment by yourself, as per the error message try adding pyautogui.FAILSAFE = False after the import and see what happens. the cursor should not be moving to the corner of the screen. make sure you set the y_offset variable - this is to account for window title bars. look at lines: #87, #99, #133 - that are commented out - those could help you debug.

asarandi commented 3 years ago

regarding -x was unexpected at this time. look at scrcpy() function on line #142: https://github.com/asarandi/wordscapes-bot/blob/main/script.py#L142 it's trying to use pgrep adb and scrcpy .. plus there is a unixy if/then/else/fi - you might need to adapt that stuff to windows. adb: https://developer.android.com/studio/command-line/adb scrcpy: https://github.com/Genymobile/scrcpy

JaxzKyd commented 3 years ago

it's trying to use pgrep

To my knowledge, pgrep is not avaliable on Windows, how do I work around this?

asarandi commented 3 years ago

it's trying to use pgrep

To my knowledge, pgrep is not avaliable on Windows, how do I work around this?

found this post on stackoverflow: https://stackoverflow.com/questions/10153087/equivalent-of-ps-a-grep-c-process-in-windows

the function logic is to check if an instance of scrcpy is already running - in that case the script only prints a message (#145). otherwise it launches Wordscapes on your android device (#147) and then runs scrcpy with arguments (#148-#157) .. nohup is to "detach" from the terminal and parent process (python) - so that it can continue running.