Skip to content

Error fix: update_map_compass_messages gives you dungeon_location not…#2597

Merged
cjohnson57 merged 2 commits into
OoTRandomizer:Devfrom
JackTriton:Error-Fix
Jun 28, 2026
Merged

Error fix: update_map_compass_messages gives you dungeon_location not…#2597
cjohnson57 merged 2 commits into
OoTRandomizer:Devfrom
JackTriton:Error-Fix

Conversation

@JackTriton

Copy link
Copy Markdown

… defined error

Reference

User on the Discord reports that with certain settings, this error will appear:
Error Message: [romBuilding] Randomizer Python code error - UnboundLocalError: cannot access local variable 'dungeon_location' where it is not associated with a value

This PR is the fix for this

@fenhl fenhl added Type: Bug Something isn't working Status: Needs Review Someone should be looking at it Component: Hints related to how we help the player Status: Needs Testing Probably should be tested labels Jun 28, 2026
@cjohnson57

cjohnson57 commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

I tried this fix and got a key error on 0, using the same settings string that generated the original error:

0
Traceback (most recent call last):
  File "C:\Users\Caleb\Repos\OoT-Randomizer\OoTRandomizer.py", line 57, in start
    main(settings)
    ~~~~^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer\Main.py", line 57, in main
    patch_and_output(settings, spoiler, rom)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer\Main.py", line 379, in patch_and_output
    patch_cosmetics_log = prepare_rom(spoiler, world, rom, settings, rng_state, restore_rom)
  File "C:\Users\Caleb\Repos\OoT-Randomizer\Main.py", line 221, in prepare_rom
    patch_rom(spoiler, world, rom)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer\Patches.py", line 1803, in patch_rom
    update_map_compass_messages(messages, world)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\Caleb\Repos\OoT-Randomizer\Messages.py", line 1551, in update_map_compass_messages
    dungeon_location = dungeon_textbox_list[dungeon_index[0]]
                       ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 0

Settings string with Japanese language: BSAWDNCAX2TB2WCHGAB3L62ANAEACAAAJAEACACA2DAAGXMAASASETSAAFAJEWLAAAESB2AP2DAC6SHBUV8EMBSBWAF3WQYAAAJAA3FA26TA4VFESB6PAJS2A3BLCSHAAABAFCED3AB

@fenhl

fenhl commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

I think it needs to be dungeon_textbox_list[dungeon_index][0], same for the existing instances?

@cjohnson57

Copy link
Copy Markdown
Collaborator

I think it needs to be dungeon_textbox_list[dungeon_index][0], same for the existing instances?

dungeon_index is actually a list (which does seem weird)
image

@cjohnson57

Copy link
Copy Markdown
Collaborator

The problem actually is that it's trying to index into a dictionary, not a list
image

@cjohnson57

Copy link
Copy Markdown
Collaborator

Changing the line to dungeon_location = dungeon_textbox_list[dungeon.name] fixed it.

@JackTriton

Copy link
Copy Markdown
Author

I should rename them as dungeon_indexes instead for the confusions

Comment thread Messages.py
@fenhl fenhl removed the Status: Needs Review Someone should be looking at it label Jun 28, 2026
@cjohnson57 cjohnson57 merged commit 0f1c4bd into OoTRandomizer:Dev Jun 28, 2026
6 checks passed
@cjohnson57 cjohnson57 added this to the next milestone Jun 28, 2026
@fenhl fenhl removed the Status: Needs Testing Probably should be tested label Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Hints related to how we help the player Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants