Jump to content


Photo

Very small almost-bug: newlines in CLAB files


4 replies to this topic

#1 subtledoctor

subtledoctor
  • Modders
  • 2177 posts
  • Gender:Male

Posted 20 October 2014 - 05:25 PM

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!


Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#2 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9268 posts
  • Gender:Not Telling

Posted 24 October 2014 - 06:48 AM

// 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

I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#3 subtledoctor

subtledoctor
  • Modders
  • 2177 posts
  • Gender:Male

Posted 24 October 2014 - 07:05 AM

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!

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#4 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9268 posts
  • Gender:Not Telling

Posted 24 October 2014 - 07:42 AM

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.

I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#5 subtledoctor

subtledoctor
  • Modders
  • 2177 posts
  • Gender:Male

Posted 24 October 2014 - 09:49 AM

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.

Edited by subtledoctor, 24 October 2014 - 09:49 AM.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users