I'd like to see a new option in the Tools section: a way to detect mis-indexed effects in spells and items. I.e. if there are 4 global effects, making sure that the first ability starts at an index of 4, that the next ability accounts for the previous ability's effects, etc., etc. If these indices are not correct, it causes hard crashes on OS X and no shortage of hair pulling for the COPY_EXISTING_REGEXP crowd. devSin's posted
some WeiDU code that can catch this; I had written one as well:
// index checker
COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~
~^.+\.itm$~ ~override~
PATCH_IF ("%SOURCE_FILE%" STRING_COMPARE_REGEXP "^.+\.spl$" = 0) BEGIN
SET "abil_length" = 0x28
END ELSE BEGIN
SET "abil_length" = 0x38
END
READ_LONG 0x64 "abil_off" ELSE 0
READ_SHORT 0x68 "abil_num" ELSE 0
READ_SHORT 0x70 "fx_num" ELSE 0
FOR (index = 0; index < abil_num; index = index + 1) BEGIN
READ_SHORT ("%abil_off%" + 0x20 + ("%abil_length%" * "%index%")) "abil_fx_idx"
PATCH_IF ("%fx_num%" = "%abil_fx_idx%") BEGIN
READ_SHORT ("%abil_off%" + 0x1e + ("%abil_length%" * "%index%")) "abil_fx_num"
SET "fx_num" = ("%fx_num%" + "%abil_fx_num%")
END ELSE BEGIN
PATCH_PRINT "~%SOURCE_FILE%~ has index error on ability ~%index2%~"
END
END
BUT_ONLY_IF_IT_CHANGES