-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i write other kinds of records? #4
Comments
Okay, let's see here. First, as far as I'm aware, scripts can only be in a SCPT section in a mod, so no external files. Sorry about that, the format seems a bit hacked-together based on modern standards. Second, the type error should be resolved if you declare the strings as binaries. Something like:
instead of
In python, when you Hope that helps, and sorry for taking so long to respond, -john |
Ah, i'd forgotten i've opened this. I eventually managed to figure it out and even made some 'generic' packing and unpacking methods. I had some trouble with the unpacking, because there are subrecords that should not be strings or should be 'lists', but there is nothing really indicating that on the fileformat (even if you make every 'doubled' type a list, there are individual subrecords that should be lists but only have one instance of that particular subrecord). I ended up with blacklists for that, a bit clumsy but it works. https://github.com/i30817/raremagic4openmw I also found some strange things. For instance i'm reading strings with:
instead of your version:
I think some 'sufficiently large string subrecords don't have \0 and are limited by max size instead. There was also the case of the BOOK->TEXT subrecord which i found to not have a \0 at the end even if the book text subrecord has unlimited size (well the size is serialized just before the subrecord, but you know what i mean). I vbindiff compared a save of the same esp in openmw-cs and made manually to reach this conclusion so maybe my methodology is flawed |
I also decided that my mod would overwrite the previous esp instead of adding a new version with a date derived name. I think overwriting the old version is good, considering the only requirement is the omwaddon being near the end of the load order and allows me to simply ignore the previous version mod as part of load order when collecting records to alter, which is the correct behavior to prevent bizarre errors. I'm.... about 95% sure you should do something similar to warn/panic/ignore previous versions of the levelled list omwaddon spoiling your new one instead of depending on users being smart enough to deactivate the previous version before generating a new one. |
Oh, that string length thing is a good catch. With your permission, I'll add it to my code. Like you, I was operating off of internet documents which reverse-engineered the format, so there are likely more issues of that nature. The double/list issue strikes me as the same family of problems. The solution? Write a new, updated file spec, of course! Volunteers requested. :) As for overwriting instead of creating, one of my goals is to work with multiple sets of mods without issue (hence the ability to specify a different conf file at the command line). I spit out text at the end of the run explicitly telling people to uncheck other omwllf mods, but, agreed, that's not the best solution. Instead, I think the "right" way for this tool is to edit the conf file directly -- no need to check/uncheck anything. One of the reasons I haven't tackled issue #2 yet is because it quickly expanded, in my mind, to include the need to check for other omwllf mods, which expanded to changing the conf file. I really ought to break those tasks out so I can tackle them more easily. |
Yeah, it's fine ofc. About issue 2, i dunno what's the best solution. In fact i'd swear openmw-launcher adds mods in that directory to the openmw.ini if you enable them, so i don't really see a problem there? There is probably some extra functionality in openmw i'm missing. |
Closing -- old and now only referencing #2. |
I'm trying to adapt omwllf code to make a mod.
https://en.uesp.net/morrow/tech/mw_esm.txt
The idea is to add a script to all the books that:
I have managed to parse books (welll, i just reused your code, that parses books fine), and now i wanted to test rewriting before starting to change things (adding a script... btw, can the script on a morrowind mod be a external file or does it have to be a record in the esp?).
I'm having trouble conceptualizing the stride and what methods to use to pack.
this is the little i have:
Stuck on that BKDT subrecord with 20 bytes
TypeError: must be str, not bytes
when summing up the return . I didn't actually change it, ie: this is the parsing:The text was updated successfully, but these errors were encountered: