Without being too blase about it, BUT_ONLY_IF_IT_CHANGES can never hurt you and basically always does exactly what you are thinking :-). If there would be no point in writing out the new file (because it would be exactly the same as the old after all of your patches), it will not be written.
I haven't found this to be the case. I stay away from BUT_ONLY_IF_IT_CHANGES, simply because it causes too many problems. It will not work for textual changes, and doesn't seem to work for INSERT/DELETE_BYTES. For instance, the following change will fail if BUT_ONLY_IF_IT_CHANGES is used:
COPY_EXISTING ~SPPR302.SPL~ ~override~
READ_LONG 0x64 ~abilitiesOffset~
READ_LONG 0x6A ~effectsOffset~
READ_SHORT 0x68 ~numberOfAbilities~
INSERT_BYTES ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) 0x28
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x10 0x14
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x26 0x55
INSERT_BYTES ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) 0x28
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x10 0x13
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x26 0x54
WRITE_LONG 0x6A ~%effectsOffset%~ + (0x02 * 0x28)
WRITE_SHORT 0x68 ~%numberOfAbilities%~ + 0x02
SET ~index~ = 0x02
WHILE (~%index%~ > 0x00) BEGIN
WRITE_ASCII ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x04 ~SPPR302B~
WRITE_BYTE ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) 0x01
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x02 0x02
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x0C 0x01
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x0E 0x50
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x12 0x09
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x16 0x06
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x1C 0x01
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x1E 0x02
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x22 0x01
WRITE_SHORT ~%abilitiesOffset%~ + (~%numberOfAbilities%~ * 0x28) + 0x24 0x01
SET ~abilitiesOffset~ = ~%abilitiesOffset%~ + 0x28
SET ~index~ = ~%index%~ - 0x01
END
Although there's really no point in using BUT_ONLY_IF_IT_CHANGES here (the file will *always* change), I wouldn't expect it to cause a problem. It does, however, as the following will now fail:
COPY_EXISTING ~SPPR302.SPL~ ~override~
READ_LONG 0x6A ~effectsOffset~
READ_SHORT 0x68 ~numberOfAbilities~
READ_SHORT 0x70 ~numberOfEffects~
SET ~numberOfEffects~ = (~%numberOfAbilities%~ - 0x02) * 0x02
INSERT_BYTES ~%effectsOffset%~ + (~%numberOfEffects%~ * 0x30) 0xC0
SET ~index~ = 0xC0
WHILE (~%index%~ > 0x00) BEGIN
READ_LONG ~%effectsOffset%~ ~cloneEffect~
WRITE_LONG ~%effectsOffset%~ + (~%numberOfEffects%~ * 0x30) ~%cloneEffect%~
SET ~effectsOffset~ = ~%effectsOffset%~ + 0x04
SET ~index~ = ~%index%~ - 0x04
END
WRITE_LONG 0x84E 0x0B
WRITE_LONG 0x87E 0x0A
WRITE_LONG 0x8AE 0x0B
WRITE_LONG 0x8DE 0x0B
Running this will give the generic "bad offset" error as
WeiDU tries to modify bytes that don't exist (since the previous patch was never written).
The PLOT thing is annoying -- basically, the game biffs include malformed items. One approach would be to have WeiDU not flag errors when you try to read or write from an offset that isn't there. Hmm. Or maybe invalid reads could always return 0. The thing I'm worried about here is masking actual errors in mods that people are developing. If WeiDU silently walks over your errors, you won't realize that your patch makes no sense.
This would be terrible. Almost all of the errors I receive are incorrect offset errors. If
WeiDU didn't report the error, I would happily be using these files until the game crashed. The problem is that
WeiDU's error reporting is terrible (it's always the same set of error messages, regardless of the actual problem). Perhaps if
WeiDU simply skipped zero-byte files?