CommanderCashMoney / CommodityPriceGrabber

4 stars 1 forks source link

Error when resolution is not set to 1920x1080 #1

Open fibrinoid opened 9 years ago

fibrinoid commented 9 years ago

I get this error when ED is set to any resolution other than 1920x1080.

[log] App.focus Elite - Dangerous (CLIENT)(0) #0

[error] script [ PriceGrabber ] stopped with error in line 245 [error] FindFailed ( can not find 1416765457866-1.png in R[0,0 2560x1440]@S(0) ) [error] --- Traceback --- error source first line: module ( function ) statement 28: main ( init ) header = find("1416765457866-1.png") [error] --- Traceback --- end --------------

I ran into this error when ED was (in windowed mode) set to 1280x1024 and 2560x1440. It was fixed by changing to 1920x1080 (still in windowed mode).

CommanderCashMoney commented 9 years ago

Thanks! Copying in my reply from Reddit as the current workaround.

That error means it couldn't find the header image. That is pretty key to finding the individual items. I haven't tried it on anything but 5760x1080 and 1920x1080. If your resolution is different you probably need to get a new screenshot of the header for it to find. You will probably also need to resize the grid on this line: grid = Region(header.x - 10, header.y,1200,840) Basically it first tries to find a match on your whole desktop for this image: https://raw.githubusercontent.com/CommanderCashMoney/CommodityPriceGrabber/master/PriceGrabber.sikuli/1416765457866-1.png Once found it creates a grid that is 1200x840 starting 10 pixels to the left of where it finds the header. So that later searches can just focus on this area for performance reasons. What I could do is have it first figure out your screen dimensions and appropriately size the grid. I'll add this to the issue list on GitHub. Thanks! Here is a quick tip that can help you see exactly what the grid looks like if you want to modify the size for a different resolutuion. Just below this line: grid = Region(header.x - 10, header.y,1200,840) Add: capture(grid) print grid This will take a pic of the grid it's using and print out it's location on the SIkuli results window. Go take a look at that image and modify the size of the grid till it stops just below the EXIT button. To change the header screenshot to one that will match your resolution is pretty quick in Sikuli. On the top left there is a Take Screenshot button. Click that and select the header area just like the image above. If it doesnt start and end in just about the same place as my screenshot you may run into some alignment issues later down the road.

CommanderCashMoney commented 9 years ago

For the header image what I can do in the future is put in several different versions of the header screenshot from different resolutions and try to find any of them. What resolution were you using?

fibrinoid commented 9 years ago

I normally play at 1280x1024 or 2560x1440. I wonder if a higher resolution would help the OCR.

I tried modifying the script for 1280x1024 according to your instructions. I grabbed a new header image and set my grid to 800,560 and it was able to run without any errors but the screen grabs were all over the place (see the attached screenshot). commoditypricegrabberresults1280x1024

new header: header1280x1024

changes to code:

    #header = find("1416765457866-1.png")
    header = find("1417908013661.png")

    #grid = Region(header.x - 10, header.y,1200,840)
    grid = Region(header.x - 10, header.y,800,560)
CommanderCashMoney commented 9 years ago

yeah now that I think about it most of the calculations are based on a 1920x1080. I'll may have to come up with some calculations so it can adjust to different resolutions. One other thing to try might be swapping out the other image that it looks for. The start of the yellow bar for each row.

https://github.com/CommanderCashMoney/CommodityPriceGrabber/blob/master/PriceGrabber.sikuli/1416712504495.png

Antmax commented 9 years ago

After working for a couple of days I'm suddenly getting fibrinoids problem, only at 1080p. Will investigate tomorrow. It's after 1am. Doesn't make sense that it would go wrong by itself.

Currently it works till it reaches the bottom of the screen and the screen starts to scroll up. Then it starts to look like fibrinoids attached screenshot of the scans and ocr side by side.