AzurLaneAutoScript icon indicating copy to clipboard operation
AzurLaneAutoScript copied to clipboard

Problem updating the asset.py file...

Open JustShinobi opened this issue 6 years ago • 17 comments

I managed to create the assets according to development.md, but when I run button_extract.py it gives an error.

Steps:

  1. setup new venv and installed dependencies, without errors.
  2. Create a new asset CAMPAIGN_GOTO_DAILY.png and replace previous file.
  3. Run python ./dev_tools/button_extract.py and gives this error Z:\AzurLaneAutoScript-master (venv) λ python ./dev_tools/button_extract.py Traceback (most recent call last): File "./dev_tools/button_extract.py", line 8, in <module> ModuleNotFoundError: No module named 'module'

Curiously, emulator_test.py also didn't work, it gives this error.

Z:\AzurLaneAutoScript-master (venv) λ python .\dev_tools\emulator_test.py Traceback (most recent call last): File ".\dev_tools\emulator_test.py", line 5, in <module> from module.config.config import AzurLaneConfig ModuleNotFoundError: No module named 'module'

But the script worked, I ran alas_en.pyw without any problems, I managed to test some things but I ran into the issue of asset recognition

If you can give me a light I would appreciate it.

JustShinobi avatar May 26 '20 09:05 JustShinobi

Fixed, now can run it using python -m dev_tools.button_extract It's my fault, I always run it in pycharm, never tried in command line.

When the script starts, it will find current page and switch to the expected page. In the error, it can not find what page it is currently. It use XXX_CHECK.png to recognise what page it is, and use XXX_GOTO_YYY.png to switch. See module/ui/page.py to know how do the pages link each other.

Replace assets named MAIN_CHECK, CAMPAIGN_CHECK, FLEET_CHECK, MAIN_GOTO_CAMPAIGN, MAIN_GOTO_FLEET, GOTO_MAIN, and the script can switch between page_main (main page), page_campaign (weigh anchor), page_fleet (fleet formation)

LmeSzinc avatar May 26 '20 19:05 LmeSzinc

ran without problems, I will finish the assets and test the modules.

By the way, what would be the correct way to translate the GUI from Chinese to English? translate on argparser_en.py or dictionary.py?

JustShinobi avatar May 26 '20 20:05 JustShinobi

I suggest translate both, because the argment names may be too chinglish or abstract.

Create another dictionary named dic_true_eng_to_eng, for example. Then replace dic_chi_to_eng, dic_eng_to_chi in argparser_en.py, and replace argment with true_eng.

LmeSzinc avatar May 26 '20 20:05 LmeSzinc

So, what can you help me about this error? it seems that he is not recognizing the chapter, which is strange because you used numbers in OCR.

JustShinobi avatar May 27 '20 02:05 JustShinobi

I registered Azurlane EN, and find out that charactors in EN have different location and size. 1-2

In module/campaign/campaign_ocr, the script use TEMPLATE_STAGE_CLEAR (the "Clear" icon) and TEMPLATE_STAGE_PERCENT (the "%" icon) to match stage. And then get location of stage name according to name_offset and name_size

replace:

name_offset = (70, 12)  # Line 71
name_size = (60, 13)  # Line 72
name_offset = (45, 3)  # Line 86

Tested in chapter 1, EN.

LmeSzinc avatar May 27 '20 08:05 LmeSzinc

Weird, stuck at stage.

JustShinobi avatar May 27 '20 08:05 JustShinobi

I tried to reproduce, includes switch to previous page and wrong recognise of "1--A", but nothing gets wrong. Steps i do:

  1. Create a new account in Azurlane EN, push to chapter 2.
  2. replace CAMPAIGN_CHECK.png
  3. replace name_offset, name_size in module/campaign/campaign_ocr.py prev

Try, switch to chapter 1 manully, and re-run 1-2. If still get stuck, keep it running and see if it raise an error after 20 times. (Class method handle_campaign_ui in module/campaign/run.py) If still, try to debug ensure_campaign_ui in mudule/campaign/campaign_ui.py and ui_ensure_index in module/ui/ui.py, find out where it stucks.

LmeSzinc avatar May 27 '20 10:05 LmeSzinc

can you give me the asset you used?

JustShinobi avatar May 27 '20 10:05 JustShinobi

CAMPAIGN_CHECK It's the letter "Chapter" on the upper-left

LmeSzinc avatar May 27 '20 10:05 LmeSzinc

By the way, adjust module/campaign/campaign_ocr.py, can make it recognise "1-4" rather than "1-A"

name_size = (60, 14)  # Line 72

LmeSzinc avatar May 27 '20 10:05 LmeSzinc

As I imagined there is no problem with the asset (there is no secret alias)

could there be any configuration that prevents the attack from starting? can you send me your alas.ini?

JustShinobi avatar May 27 '20 10:05 JustShinobi

alas.txt I rename it to txt, because github can't upload ini

LmeSzinc avatar May 27 '20 10:05 LmeSzinc

It worked :)

I must have made a mess on alas.ini lol thanks again. now I will be able to test the assets of the combat module.

JustShinobi avatar May 27 '20 11:05 JustShinobi

Send me you ini as well, may be i can find out what's wrong

LmeSzinc avatar May 27 '20 11:05 LmeSzinc

I pasted the contents of your .txt into it, I don't have the copy anymore.

JustShinobi avatar May 27 '20 11:05 JustShinobi

Did you remenber what you configered? or just the default settings in template.ini

LmeSzinc avatar May 27 '20 11:05 LmeSzinc

I modified the template, but as I was having a lot of problems to make the script run at first, I must have made a lot of mess there, the truth is that I shouldn't have used it now.

JustShinobi avatar May 27 '20 11:05 JustShinobi