Author Topic: Problem with the REMOVE_BLANK_LINES function  (Read 755 times)

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
Problem with the REMOVE_BLANK_LINES function
« on: January 11, 2017, 10:10:43 AM »
Out of left field, I'm having problems with Camdawg's REMOVE_LINES function.

I use this a lot to append stuff to .2da files. While the APPEND action makes sure that the row count is correct, I often need to append things in a patch. Which means using APPEND_FILE. This is nice, in that I can edit the thing being appended by editing the external text file, instead of having to find the string in my .tp2 code. But it's also clunkier because Weidu doesn't manage line breaks. So I tend to do something like:
Code: [Select]
COPY_EXISTING ~the_clab.2da~ ~override~
   LPM remove_blank_lines
   APPEND_FILE ~might_and_guile/bardsong/clab_text.txt~

The remove_lines macro makes sure the .2da file has no blank line at the end; then my text files begin with a line break, and have the text to be appended on the 2nd line. Clunky, but it has been effective so far.

Until now. Now I'm occasionally seeing this:
Code: [Select]
ERROR: illegal 1-byte read from offset 9493 of 9493-byte file d5_bard.2da
ERROR: [d5_bard.2da] -> [override] Patching Failed (COPY) (Failure("d5_bard.2da: read out of bounds"))

I can't figure out what is causing it. The only way I've found to eliminate the (install-stopping) error is to eliminate the remove_lines order. But then some of the files end up with extra blank rows, which may (??) be problematic.

I'm at a loss. If anyone has a chance to take a look, you can grab v3.2 of my mod from here and try to install component 210. The .tpa for that component is in /might_and_guile/components (the remove_lines stuff is toward the bottom), and the text files being appended are in /might_and_guile/bardsong.
https://github.com/subtledoctor/Might_and_Guile

Offline Magus_BGforge

  • Planewalker
  • *****
  • Posts: 75
Re: Problem with the REMOVE_BLANK_LINES function
« Reply #1 on: January 21, 2017, 06:15:51 PM »
Tried to install, all it says is "skipping tweak" components.
Anyway, what you should do is some PATCH_PRINT debugging.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: