thedefside / BetterUI

Subtle UI mod for Valheim
BSD 2-Clause "Simplified" License
9 stars 9 forks source link

Console Spam ArgumentOutOfRangeException after 2.3.2 #40

Closed DaveKX closed 1 year ago

DaveKX commented 1 year ago

Hello, after updating to 2.3.2 I'm now getting spammed on console with this error (although I didn't really notice any problems while playing?). I can attach my log if needed!

[Error  : Unity Log] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Stack trace:
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
BetterUI.GameClasses.BetterHotkeyBar.PatchHotkeyBar (HotkeyBar& __instance, Player& player) (at <782a6fbf20064a6bb00c8bb10338286a>:0)
(wrapper dynamic-method) HotkeyBar.DMD<HotkeyBar::UpdateIcons>(HotkeyBar,Player)
HotkeyBar.Update () (at <035307060cbb4b30b916cd82ebd80490>:0)
thedefside commented 1 year ago

Do you have an equipment/quick slots mod installed?

DaveKX commented 1 year ago

Yeah, ComfyQuickSlots

thedefside commented 1 year ago

If you remove that mod, does the error go away?

DaveKX commented 1 year ago

Yes it did go away, is that extra row in the inventory added by the other mod the problem then?

thedefside commented 1 year ago

I'm not sure if it's the inventory, the error is coming from the HotBar patch. The same thing happens with the equipment slots for OdinsQOL. I believe it's just a conflict with both mods changing the same method. I think RandyKnapps Equipment and Quick Slots mod works with Better UI. Better UI even makes it so you can move those windows around.

DaveKX commented 1 year ago

Great! I was using this one instead of Randy's due to the lost equipment on death bug, but in the latest update they are saying this bug is now fixed, so I will switch back to it. Thank you and you can close this one then :)

thedefside commented 1 year ago

Well, they have said that bug was fixed in EAQS many times...

DaveKX commented 1 year ago

I hope the time has finally come... xD

Goldenrevolver commented 1 year ago

now it shouldn't error anymore. why they add items into the hotbar items list but don't increase the hotbar elements list is beyond me. also this won't get released immediately unless thedefside is in the mood for it

DaveKX commented 1 year ago

Sure, no problem. Thanks you guys for the quick help

thedefside commented 1 year ago

@DaveKX can you try the pre-release version and see if that solves your issue?

https://github.com/thedefside/BetterUI/releases/tag/v2.3.3-pre-release

DaveKX commented 1 year ago

Hey, just tested it now and no more errors with the ComfyQuickSlots mod at the console with this pre-release version! Some of the config in-game UI are a bit messy tho, but I guess it is because it's still the pre-release

thedefside commented 1 year ago

Could you expand on the 'messy' part?

DaveKX commented 1 year ago

Some of the configs that are now buttons have their text wrong, I think? Like the one that is 'Items slash max room' or the custom bars with 'OnX degrees', and I noticed that the custom bars 'degree' configs are being reseted to default when I overwrite the 2.3.2 dll with the 2.3.3, maybe it's because I'm not 'updating' it through r2modman? Idk

2.3.2 2.3.3

BruceOfTheBow commented 1 year ago

Submitted a fix for this with PR #41. The issue here is that comfy quickslots are bound to the gridPos.x 5,6,7 in the inventory which is out of range of the m_elements 0,1,2 for the 3-element hotkeybar for the quickslots. Same info to generate the durability can be found from the HotkeyBar.elementData instead of the indexes which may not be matched like the vanilla hotkeybar.

Goldenrevolver commented 1 year ago

@BruceOfTheBow great way to get around the issue. good job

@DaveKX those are intentional changes. having these set options (enum values) makes the config options easier to understand than multiple bools and floats that depend on one another or arbitrary integers that represent a certain option written in the description (like 0 = this, 1 = that). the "slash" is simply because we can't use special characters in an enum. so the display option "x slash y" simply means it displays it as "x / y". for the "OnX Degrees" it's similar. I can't start an enum with a number (for technical reasons), so I started it with the state, "on" rather than "off" (which is the first option). then the enum to text parser of the ingame config manager messes up and forgets to put a space between a letter and a number, so that's not really something we can change. we write enums as one word, e.g. "DoStuffLikeThis". we have to rely on the way the config manager displays it whether it looks good (for programmers no spaces looks good already of course :D )

we can rename them to other things like OnRotatedTo90Deg or something, if you have any better ideas before release let use know. changing these means resetting configs most of the time, so we want to do that before public release

DaveKX commented 1 year ago

I know that the set options are intended, didn't know that you couldn't use special characters on it tho. Then the names are good as they are imo, all of them are very self explanatory to me at least. And you said as well that when you changes those configs or their names idk, it resets to default, so all I said is actually intended behavior XD. All good then, thank you.

MLNW commented 1 year ago

I just saw this note in the ComfyArmorAndQuickSlots mod:

If using better UI set showDurabilityColor to disabled to prevent error log spam.

BruceOfTheBow commented 1 year ago

@MLNW Yeah I believe 2.3.2 removed the disable for that and it's been reimplemented for later versions. PR #41 will fix the error as soon as it's pulled in to the next release so nothing has to be disabled and showDurabilityColor can be used. I will update the CQS documentation accordingly on its release