WRITE_ASCII and variables |
The Black Wyrm's Lair Terms of Use | Help Search Members Calendar |
WRITE_ASCII and variables |
Jul 22 2008, 04:11 PM
Post
#1
|
|
Mod Developer Posts: 1158 Joined: 22-July 04 From: Sweden |
This piece of code is supposed to patch all .spl files to have their animation overlays (such as Fireshield Red) be played inside an external .eff file rather than the .spl file itself.
It looks pretty good until I get to the WRITE_ASCII 0x30 ~%resource%~ part. Instead of writing the string stored inside the variable, it writes "%RESOURC" instead. Is there any way to fix this? CODE COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) BEGIN // Protects against invalid files READ_LONG 0x64 ext_off READ_SHORT 0x68 ext_num READ_LONG 0x6a fb_off SET graphicsduration = 0 FOR (outerloops = 0; outerloops < ext_num; outerloops += 1) BEGIN READ_SHORT ( outerloops * 0x28 + ext_off + 0x1e ) eff_num READ_SHORT ( outerloops * 0x28 + ext_off + 0x20 ) eff_off FOR (innerloops = 0; innerloops < eff_num; innerloops += 1) BEGIN SET "tot_off" = ("%fb_off%" + ("%eff_off%" + "%innerloops%") * 0x30) READ_SHORT "%tot_off%" opcode // Reads opcode READ_LONG "%tot_off%" + 0x04 param1 // Reads parameter 1 READ_LONG "%tot_off%" + 0x08 param2 // Reads parameter 2 READ_LONG "%tot_off%" + 0x0e duration // Reads duration READ_ASCII "%tot_off%" + 0x14 resource // Reads resource PATCH_IF ( opcode = 215 AND param2 = 1 AND duration > 5 ) BEGIN WRITE_SHORT "%tot_off%" 272 // Apply Effect on Condition [Opcode 272] WRITE_LONG "%tot_off%" + 0x04 1 // Frequency [Parameter 1] WRITE_LONG "%tot_off%" + 0x08 3 // Type [Parameter 2] PATCH_IF !( FILE_EXISTS_IN_GAME ~%resource%.eff~ ) BEGIN INNER_ACTION BEGIN COPY_EXISTING ~BOLTELEM.eff~ ~override\%resource%.eff~ WRITE_LONG 0x10 215 // Play 3D Effect [Opcode 215] WRITE_LONG 0x14 1 // Set target type to self WRITE_LONG 0x1c 0 // Undetermined [Parameter 1] WRITE_LONG 0x20 1 // Effect State: Play over target [Parameter 2] WRITE_ASCII 0x30 ~%resource%~ (8) // Resource played WRITE_LONG 0x38 0 // Dice Thrown WRITE_LONG 0x3c 0 // Dice Sides END END END END END END BUT_ONLY_IF_IT_CHANGES -Galactygon -------------------- |
|
|
Lo-Fi Version | Time is now: 16th November 2024 - 11:57 AM |