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 -------------------- |
|
|
Jul 22 2008, 04:13 PM
Post
#2
|
|
Master of energies Council Member Posts: 3319 Joined: 9-July 04 From: Magyarország |
Did you try it with "%resource%" ? (Yes, the quotation marks are literal, I use them instead of tildes ~).
-------------------- Mental harmony dispels the darkness.
|
|
|
Jul 22 2008, 04:23 PM
Post
#3
|
|
Mod Developer Posts: 1158 Joined: 22-July 04 From: Sweden |
Yes, they yield the same results.
-Galactygon -------------------- |
|
|
Jul 22 2008, 04:27 PM
Post
#4
|
|
Master of energies Council Member Posts: 3319 Joined: 9-July 04 From: Magyarország |
What about:
READ_ASCII "%tot_off%" + 0x14 "resource" // Reads resource That is, enclose resource in quotation marks. -------------------- Mental harmony dispels the darkness.
|
|
|
Jul 22 2008, 04:38 PM
Post
#5
|
|
Mod Developer Posts: 1158 Joined: 22-July 04 From: Sweden |
-------------------- |
|
|
Jul 22 2008, 08:37 PM
Post
#6
|
|
Master of energies Council Member Posts: 3319 Joined: 9-July 04 From: Magyarország |
I followed the link you gave, you got a reply there. It's WRITE_EVALUATED_ASCII. It seems it has consequences that I haven't written anything special in TP2 for a long time.
-------------------- Mental harmony dispels the darkness.
|
|
|
Jul 23 2008, 09:13 AM
Post
#7
|
|
Mod Developer Posts: 1158 Joined: 22-July 04 From: Sweden |
And I even started to develop a Weiego!
-Galactygon -------------------- |
|
|
Lo-Fi Version | Time is now: 14th November 2024 - 01:46 PM |