Jump to content

Very small almost-bug: newlines in CLAB files


subtledoctor

Recommended Posts

Just want to report something that is not quite a bug, but maybe sort of is.

 

The CLAB files for the S&S kits have an extra blank row beneath the last row of "ABILITY **** **** " etc. text. (The Chorister has two blank rows.) It doesn't have any effect in-game, but it does make it hard for any mod that comes along and might want to append things to CLAB files - like the new weapon proficiency system in my mod :)

 

The base game's CLAB files only have as many rows as there is text, and I think we would all benefit if everyone sticks to conventions as much as possible, so things are as predictable as possible for other modders.

 

Cheers!

Link to comment
// removes extra blank lines from end of file
DEFINE_PATCH_MACRO ~remove_blank_lines_from_eof~ BEGIN
SET "size" = (SOURCE_SIZE - 1)
READ_BYTE ("%size%") "eof"
WHILE ((%size% > 0) AND (("%eof%" = 0x0a) OR ("%eof%" = 0x0d))) BEGIN // removes any empty lines at the end of the file
DELETE_BYTES "%size%" 0x01
SET "size" = ("%size%" - 1)
READ_BYTE ("%size%") "eof"
END
END
Link to comment

Hmm. So a mod that wants to append things to 2da files would, in an abundance of caution, do something like

COPY_EXISTING_REGEXP ~.*\.2da~ ~override~
    LPM remove_blank_lines_from_eof
... probably in an ALWAYS block?

 

Seems reasonable. Thanks!

 

In general, I don't like messing with files I'm not patching, so you may want to only run the macro on files you're otherwise modifying.

 

The macro is straight out of DR, which implements the spheres with a lot of CLAB appending. It may have other libraries you may want to check out, such as re-indexing the CLAB rows.

Link to comment

Ah! Makes sense. I actually looked at the DR code a lot when I was starting out - spent hours and hours trying to adapt the macro that adds sequential numbers after the word "ABILITY" in appended lines, before someone clued me in to the fact that the numbers are arbitrary and unnecessary.

 

In general, I don't like messing with files I'm not patching, so you may want to only run the macro on files you're otherwise modifying.

Ah yes, on reflection it would be quite simple to just run the LPM immediately prior to any APPEND_FILE lines.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...