I'd like to update several values in a 2DA file with a great number of lines (over 1000). I'm currently using this code. However, it is very slow and takes several seconds to complete.
OUTER_SET strref_1 = RESOLVE_STR_REF(@10000) OUTER_SET strref_2 = RESOLVE_STR_REF(@10001) OUTER_SET strref_3 = RESOLVE_STR_REF(@10002) OUTER_SET strref_4 = RESOLVE_STR_REF(@10003) ACTION_DEFINE_ASSOCIATIVE_ARRAY strings BEGIN ~STRREF_FEEDBACK_SNEAK_ATTACK~ => ~%strref_1%~ ~STRREF_FEEDBACK_SNEAK_AVOIDED~ => ~%strref_2%~ ~STRREF_FEEDBACK_CRIPPLING_STRIKE~ => ~%strref_3%~ ~STRREF_FEEDBACK_SNEAK_UNUSABLE_WEAPON~ => ~%strref_4%~ END COPY_EXISTING ~enginest.2da~ ~override~ COUNT_2DA_ROWS 2 numRows PHP_EACH strings AS name => value BEGIN FOR (row = 0; row < numRows; row += 1) BEGIN READ_2DA_ENTRY row 0 2 curName PATCH_IF (~%curName%~ STR_EQ ~%name%~) BEGIN SET_2DA_ENTRY row 1 2 value SET row = numRows END END END BUT_ONLY
I'd like to use the 2DA batch functions READ_2DA_ENTRIES_NOW/READ_2DA_ENTRY_FORMER and SET_2DA_ENTRIES_NOW/SET_2DA_ENTRY_LATER (which are hopefully faster), but I'm not very experienced with them. A first test didn't result into any changes. Any idea how to use these functions properly?
Edited by argent77, 20 May 2017 - 04:25 AM.