ANRAR4 / AutoBTD6

The scripts contained in this repository allow you to automatically play any gamemode on any map in Bloons TD6
31 stars 4 forks source link

Fixes for two bugs I found #16

Closed KendleMintJed closed 9 months ago

KendleMintJed commented 10 months ago

Bug 1:

When playing on impoppable, the program would miscalculate tower prices and think it was playing regular hard. I found the issue was File "AutoBTD6-main\helper.py", line 68, in adjustPrice where it uses the difficulty variable to check which pricing to use. The problem is this variable will never be "impoppable" because it is taken from the "group" element of gamemodes.json which, for impoppable, is "hard".

I fixed this by instead using the gamemode variable to first check if it is impoppable, and then doing the rest of the checks.

Bug 2:

When trying to recalculate costs, the program would exit with the error:

Traceback (most recent call last):
  File "AutoBTD6-main\replay.py", line 1230, in <module>
    main()
  File "AutoBTD6-main\replay.py", line 531, in main
    testPositions = json.loads(convertPositionsInString(json.dumps(testPositions['2560x1440']), (2560, 1440), pyautogui.size()))
UnboundLocalError: local variable 'testPositions' referenced before assignment

I fixed this by changing testPositions['2560x1440'] to allTestPositions['2560x1440'] (I assume that's what it's meant to be)

userconfig.json edit

I noticed that the maps.json file was completely up to date, however, userconfig.json not only didn't include all the maps, they were also out of order. I fixed that.

ANRAR4 commented 9 months ago

Thanks