jraynolds / Glimmer-and-Gloom

A python automated bot to play Flight Rising's Glimmer and Gloom minigame.
MIT License
4 stars 1 forks source link

am I doing this right? #1

Open Justauser4 opened 3 years ago

Justauser4 commented 3 years ago

I have no idea how to code. Maybe I installed this incorrectly. When I run the bot I get this

File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 212, in run_bot() File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 24, in run_bot glimgloms = order_gloms(gather_gloms()) File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 171, in order_gloms glom = gloms[0] IndexError: list index out of range

I've tried to figure out how to fix it but I have no idea what I'm doing or what this error even means, any help is appreciated

DePhantasia commented 3 years ago

I also am at this point in the script~ Hope to get this situated and soon!

jraynolds commented 3 years ago

Hey folks! I'm so sorry for not responding to this sooner. I don't think my notifications are working quite right.

I've made some changes to the code and improved the readability of the Readme. @Justauser4, can you try a fresh install going through the Step-by-Step Guide and see what you come up with?

Justauser4 commented 3 years ago

@jraynolds I re-installed python and I think I followed the steps correctly. This time when I try to run the bot I get this We're running a setup diagnostic. We're saving a file to game_region.png showing our search region. If the image you find at that location isn't representative of the entire game board, you need to change the global variables defining it. We're saving a file to ./glimmer2.png found.png with illustrative boxes. If the image you find at that location doesn't have any red boxes present, it's not properly detecting. We're saving a file to ./gloom.png found.png with illustrative boxes. If the image you find at that location doesn't have any red boxes present, it's not properly detecting. In total we found 0 glimmers and 0 glooms. We didn't manage to find any glimmer or gloom squares. Is the game begun and visible on your screen? Have you arranged the Flight Rising window and the search window area appropriately? Traceback (most recent call last): File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 238, in run_bot() File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 35, in run_bot glimgloms = order_gloms(gather_gloms()) File "C:\Users\user\Desktop\Glimmer-and-Gloom-master\bot.py", line 185, in order_gloms glom = gloms[0] IndexError: list index out of range

I have the bot on the right side of my screen, and the game open on the left. it doesn't seem to be detecting that I have it open

jraynolds commented 3 years ago

Hey @Justauser4! I'm working with @DePhantasia on some fixes and they've found the same problems you're having when using Firefox. Are you using Firefox to open Flight Rising?

Justauser4 commented 3 years ago

@jraynolds no. I was using Microsoft Edge, I tried Chrome and still got the same issue

jraynolds commented 3 years ago

Inside the folder you should have 3 image files generated by the program: game_region.png, glimmer2.png and gloom.png. Can you show me those?

Justauser4 commented 3 years ago

I have those in the folder currently!

jraynolds commented 3 years ago

Looking at your game_region.png I can see your capture window is slightly offset: it's not capturing the whole game window... but that shouldn't be a problem. The more frustrating issue is that there are no red boxes in "glimmer2.png found" and "gloom.png found", which means the glimmers and glooms aren't being detected. I'm not sure what's going wrong, unfortunately. You can try changing the global variable in bot.py named "GAME_OFFSET" so that game_region.png captures the game accurately, but I'm not sure that'll help things. What version of python are you using?

Justauser4 commented 3 years ago

I believe I am using 3.9.6. Is there a way for me to re-capture the images so they are centered?

jraynolds commented 3 years ago

You can edit this line: GAME_OFFSET = (220, 350) # The top left corner of the Glimmer and Gloom game, in pixels down and right from the top left corner of your monitor.

Judging from your photos I would change the numbers to something like (140, 270) but there's no guarantee this will make the program work, since on your machine it's not detecting the images properly anyway.

Justauser4 commented 3 years ago

it did change so it's now more centered, but it still is not detecting the images unfortunately. I'm going to try on a different computer and see if that could fix the problem? This shouldn't matter if I am using Windows or Mac right?

Justauser4 commented 3 years ago

just tried it on a different computer and no luck, still running into the same issues

jraynolds commented 3 years ago

How frustrating! I'm sorry it isn't working for you. At this point it seems clear to me the difficulty is in the image search itself. My last suggestion I can help you with is to run this code:

from python_imagesearch.imagesearch import imagesearch

pos = imagesearch("./github.png")
if pos[0] != -1:
    print("position : ", pos[0], pos[1])
else:
    print("image not found")

Replace ./github.png with an image you can currently see on your screen, such as one of the gloom/glimmer squares. It should print the position.

Justauser4 commented 3 years ago

you kinda lost me on that lol. Do I just copy paste that code when the bot is running? and do i replace the one part with something already in the folder?

I also want to be 100% sure I have this set up right, you would set it up like this and run the bot correct? I could very well have done something wrong in the set up

TheCarmenStar commented 2 years ago

Hello, I have the same issue. Has any solution been found yet?

jraynolds commented 2 years ago

Hey Carmen! Can you give me more information on what's going wrong?

TheCarmenStar commented 2 years ago

I read through this thread and compared my issue to this, and saw that it seems to be a similar problem. I originally received the same error, and upon observing, it appears I was having the same issue of the glimmers and glooms not being detected. I've tried adjusting the offset, but that did nothing. I wanted to run the code you suggested here,

How frustrating! I'm sorry it isn't working for you. At this point it seems clear to me the difficulty is in the image search itself. My last suggestion I can help you with is to run this code:

from python_imagesearch.imagesearch import imagesearch

pos = imagesearch("./github.png")
if pos[0] != -1:
    print("position : ", pos[0], pos[1])
else:
    print("image not found")

Replace ./github.png with an image you can currently see on your screen, such as one of the gloom/glimmer squares. It should print the position.

But like Justasuer4, I was confused about where to run it, since I am no developer and this is my first time messing with actual code like this. Any help would be appreciated!

jraynolds commented 2 years ago

Before you do run that code, have you tried alternate web browsers? Some people seem to get it working with Chrome--others with Firefox or Microsoft Edge.

TheCarmenStar commented 2 years ago

Yes, I've tried it with all three of those. Still met with the same original error.

jraynolds commented 2 years ago

Gotcha. In that case, make a copy of the bot.py file and set it somewhere else. You can replace the entire text of the original bot.py file with that above text and run it the same way you've been running the others so far.

TheCarmenStar commented 2 years ago

Tried it, and was greeted with

 Traceback (most recent call last):
     File "C:\Users\user\Downloads\Glimmer-and-Gloom-master\Glimmer-and-Gloom-master\bot.py", line 1, in <module>
     from python_imagesearch.imagesearch import imagesearch
 ModuleNotFoundError: No module named 'python_imagesearch'

The image I had input for it to find was "glimmer.png" (Previously attempted with another icon that would be onscreen, "fullscreen.png", the little fullscreen icon. Was met with the same result.) , and I had my G&G window open on splitscreen, just like I did for the previous times. Did I do something incorrectly?

jraynolds commented 2 years ago

I'm afraid the bug fixing solution is broken right now, so I can't even have you install python_imagesearch. What a bummer.

You've done everything correctly but for some reason, it's just not working. And it's only partially working for others. Until the package this is built atop is fixed, I don't think there's anything either of us can do. I wish I had better news.

jraynolds commented 2 years ago

Hey @Justauser4, @DePhantasia and @TheCarmenStar, I've made some major changes. Can you try downloading this version and seeing if it works?

gofrusg commented 2 years ago

hi, i have an issue, bot is not detecting "gloom.png" image

jraynolds commented 2 years ago

Hi @gofrusg! Can you send me a screenshot of your screen while trying to use it?

gofrusg commented 2 years ago

Sorry for long response, i didn’t have time for FR.    So here it is

Среда, 2 февраля 2022, 9:08 +07:00 от jraynolds @.***>:     Hi @gofrusg ! Can you send me a screenshot of your screen while trying to use it? — Reply to this email directly, view it on GitHub , or unsubscribe . Triage notifications on the go with GitHub Mobile for iOS or Android . You are receiving this because you were mentioned. Message ID: <jraynolds/Glimmer-and-Gloom/issues/1/1027506885 @ github . com>        

jraynolds commented 2 years ago

Hey @gofrusg. I'm afraid I don't think the information was transmitted in that email.