ShinyHobo/BG3-Modders-Multitool

Add rudimentary .txt checks similar to XML checks

Syrchalis opened this issue · 0 comments

We learned a few things about txt parsing that could be added to help find errors before paking:

  • // is a valid comment only at the beginning of the line

If // is used after the beginning of the line, warn the user

  • Lines that are invalid syntax are ignored, but the lines afterwards are still parsed as normal (i.e. txt parsing does not stop)
  • Whitespace does not matter, i.e. you can leave as much as you want before lines, after lines, in the middle of lines, etc
  • Space and tab both work as whitespace
  • Lines with 4096 characters and above will cause the game to get permanently stuck loading at 89%
  • Data values (not lines) above 2048 characters in FixedString properties (eg. Boosts) will crash the game

Add check for line length that stops paking similar to XML checks

Additionally, you could check that data entries are correct. The reset keyword would be new entry "...". type "..." determines type, then check entries after data against modifiers.txt if they are valid. Also check if format is data "..." - saw users miss a " a lot which is hard to see, even with syntax highlighting. I also see users a lot using invalid fields, like StatsFunctorContext in StatusData, this would help with that.

This would not have to be done for every data type, just the more common ones would already be very helpful, like type Weapon/Armor/PassiveData/StatusData/SpellData/InterruptData

Lastly, this may be a lot of work, but certain fields that only allow certain strings, check if they are valid with Valuelist.txt. Most notably all the context fields. E.g. StatsFunctorContext, RemoveContext, Interruptcontext, since they are weirdly different.

For example, in StatsFunctorContext triggering on spell cast would be "OnCast" but in RemoveContext it is "OnSpellCast".