Jump to content

Writing into "Uknown or unused data" - safe?


temnix

Recommended Posts

Is it safe to record some numbers, within the size of the field, in "unknown" fields of a file? For instance, to leave markers for later patching. I would just do it, but maybe there is a known problem with this?

Edited by temnix
Link to comment

You will want to disable this after you have made your mod work, but there's no problem leaving files in the folder ... as properly coded mods don't leave much room for unknown variables in their regular expressions. But there could always be some.

The unknown fields of course can have actual effects for the file, so I would actually print the outcome as a file, and keep that in the mods folder if you need to read it. It's there for that, after all. Of if you install the mod, you can of course use "print" command to port the list to the debug file, and read it from there.

Here's how we made a list of all the probable innate the game has... so later I could patch them later:

PRINT ~First we build a list of spells to patch~

OUTER_TEXT_SPRINT ability_list ~~
COPY_EXISTING - ~kitlist.2da~ ~override~
COUNT_2DA_COLS kit_numCols
COUNT_2DA_ROWS kit_numCols kit_numRows
FOR (kit_row = 0; kit_row < kit_numRows; ++kit_row) BEGIN
  READ_2DA_ENTRY kit_row 5 kit_numCols clabFile
  PATCH_IF (FILE_EXISTS_IN_GAME ~%clabFile%.2da~) BEGIN
    INNER_ACTION BEGIN
      COPY_EXISTING - ~%clabFile%.2da~ ~override~
      COUNT_2DA_COLS clab_numCols
      COUNT_2DA_ROWS clab_numCols clab_numRows
      FOR (clab_row = 0; clab_row < clab_numRows; ++clab_row) BEGIN
        FOR (clab_col = 1; clab_col < clab_numCols; ++clab_col) BEGIN
          READ_2DA_ENTRY clab_row clab_col clab_numCols entry
          // processing GA_* entries...
          PATCH_IF (~%entry%~ STRING_MATCHES_REGEXP ~GA_.+~ = 0) BEGIN
            INNER_PATCH_SAVE splFile ~%entry%~ BEGIN
              REPLACE_TEXTUALLY ~GA_\(.+\)~ ~\1~
            END
            PATCH_IF (~%ability_list%~ STRING_CONTAINS_REGEXP ~%splFile%~ != 0) BEGIN
              TEXT_SPRINT ability_list ~%ability_list%%splFile%%WNL%~
            END
          END
        END
      END
    END
  END
END

TEXT_SPRINT ability_list ~%ability_list%
SPIN101
SPIN102
SPIN103
SPIN104
SPIN105
SPIN106~

PRINT ~Abilities found:~
PRINT ~%ability_list%~

 

Edited by Jarno Mikkola
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...