Posted by: devSin
« on: February 18, 2010, 03:22:53 PM »All looks to work now.
THIS/STHISIt looks like this only works the first time eval fails (e.g., afterward, THIS & STHIS are always set to something and never updated again)?
Array.to_list (Array.mapi (fun i x ->
Tp.TP_PatchASCII(Tp.PE_Add(Tp.PE_Mul(Tp.get_pe_int (string_of_int i), Tp.get_pe_int "8"), e1), x, true, Some (Tp.get_pe_int "8"))
) (Array.of_list e2))
But I think you'll still need to console me with THIS and WRITE_ASCIIL so I don't go completely apeshit.they're coming up, I'm just a bit on hiatus.
You should remove -- since it's so flaky....or make ++ and -- be prefix
Or maybe we can switch to 8-bit characters (pick an encoding) and use en-dashes instead of dashes... ;-)Not if I want all
OUTER_PATCH ~12~ BEGIN
WRITE_BYTE 1 0x09
READ_ASCII 1 tab (1) // 0x09, tab
END
OUTER_SPRINT null ""
DEFINE_PATCH_FUNCTION change_damage INT_VAR change_ab = 1 RET dmg_output BEGIN
READ_LONG 0x64 ab_off
READ_SHORT 0x68 num_ab
FOR (i=0;i<num_ab;i+=1) BEGIN
READ_SHORT ab_off + 0x38*i ab_type ELSE 999
PATCH_IF ab_type = change_ab BEGIN
WRITE_SHORT ab_off + 0x38*i + 0x16 size
WRITE_SHORT ab_off + 0x38*i + 0x18 dice
END
END
SPRINT thac0 thac0 //@0
SPRINT thaco thaco //@1
SPRINT damage Damage //@3
INNER_PATCH_SAVE dmg_output "%dmg_input%" BEGIN
REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "%thaco%" "%thac0%"
REPLACE_TEXTUALLY CASE_INSENSITIVE EVALUATE_REGEXP "^%damage%:?[ %tab%%null%]+[0-9]+d[0-9]+" "%damage%: %dice%d%size%"
END
END
COPY_EXISTING sw1h43.itm override
READ_STRREF 0x50 desc1
//SPRINT dmg_input "%desc1%"
LPF change_damage INT_VAR size = 4 dice = 2 STR_VAR dmg_input = "%desc1%" RET desc2 = dmg_output END
SAY_EVALUATED 0x54 "%desc2%"
BUT_ONLY