igi Posted August 2, 2004 Share Posted August 2, 2004 Lo folks, Would it be possible for any weidu guru to draw up some weidu code to accomplish this task for me? What I have ----------- I have a series of items, named iiixxx (where xxx is a numbering system, starting at 000). Each item has 3 extended headers (this is a guarenteed fact). Each extended header has a varying number of feature blocks. None of the items have any equipping effects. What I want ----------- I want to add a feature block to every extended header, on every item. The feature block should contain a string in the 'resource' field, consisting of iiixxxY, where xxx is the numeric code from the filename (so 000 for the first item, 001 for the second item), and Y is the extended header index (so A for extended header 1, B for extended header 2, and C for extended header 3). Basically, I want every extended header on every item, so set a unique global variable, based on the items filename and the extended header used. Thanks!! Link to comment
igi Posted August 4, 2004 Author Share Posted August 4, 2004 *bump* I'd settle for just adding a feature block to each extended header in an item, if the rest is to hard. Please. Link to comment
Idobek Posted August 4, 2004 Share Posted August 4, 2004 It is actually fairly easy. I'll try and get it done on Sunday, no promises though. Link to comment
Idobek Posted August 8, 2004 Share Posted August 8, 2004 Okay, this should do the job: BEGIN ~igi's Request~ COPY ~mymod/iii001.itm~ ~override~ ~mymod/iii002.itm~ ~override~ ~mymod/iii003.itm~ ~override~ ~mymod/iiixxx.itm~ ~override~ READ_LONG 0x64 "abilitiesoffset" READ_LONG 0x6a "effectsoffset" READ_SHORT 0x68 "#abilities1" READ_SHORT 0x68 "#abilities2" READ_SHORT 0x70 "#globaleffects" WHILE ("%#abilities1%" > 0) BEGIN SET "ability#" = ("%#abilities1%" - 1) SET "ability" = ("%abilitiesoffset%" + "%ability#%" * 0x38) READ_SHORT ("%ability%" + 0x1e) "#effects" READ_SHORT ("%ability%" + 0x20) "effectsindex" INSERT_BYTES ("%effectsoffset%" + "%effectsindex%" * 0x30) 0x30 WRITE_EVALUATED_ASCII ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x14) ~%SOURCE_FILE%~ /* This WRITE_LONG removes the .ITM of %SOURCE_FILE%. */ WRITE_LONG ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x20) 0x00000000 WRITE_SHORT ("%ability%" + 0x1e) ("%#effects%" + 1) SET "#abilities1" = ("%#abilities1%" - 1) END SET "ability#" = 0 SET "total#effects" = "%#globaleffects%" WHILE ("%ability#%" < "%#abilities2%") BEGIN READ_SHORT ("%abilitiesoffset%" + "%ability#%" * 0x38 + 0x1e) "#effects" WRITE_SHORT ("%abilitiesoffset%" + "%ability#%" * 0x38 + 0x20) "%total#effects%" SET "total#effects" = ("%total#effects%" + "%#effects%") SET "ability#" = ("%ability#%" + 1) END It is not fully tested but I think it is fine. I'm sure you can work out the rest of the WRITE_BYTE/SHORT/LONGs required to make the new effect work. If not, tell me what you need and I'll add them in. Link to comment
igi Posted August 9, 2004 Author Share Posted August 9, 2004 Thank you! It will save a lot of time. Link to comment
igi Posted August 9, 2004 Author Share Posted August 9, 2004 I've had a play with this code, and it works great. There was an issue with the end of the resouce key not being blanked properly, but it was easy enough to fix. However, there is a small detail of my request which hasn't been implemented. I wanted the resource key for each extended header to be iixxxA, iixxxB or iixxxC, dependent on weather it's extended header 1, 2 or 3. Is this possible to do? The feature block should contain a string in the 'resource' field, consisting of iiixxxY, where xxx is the numeric code from the filename (so 000 for the first item, 001 for the second item), and Y is the extended header index (so A for extended header 1, B for extended header 2, and C for extended header 3). Link to comment
Idobek Posted August 9, 2004 Share Posted August 9, 2004 It would be easy if the suffix could be a number instead of a letter, is that alright? Link to comment
igi Posted August 9, 2004 Author Share Posted August 9, 2004 Yes, that would be ok, as long as it is a single digit number Link to comment
Idobek Posted August 9, 2004 Share Posted August 9, 2004 If so, the only thing you need to change is the WRITE_LONG section that removes the .ITM extension. Change the line like so: WRITE_LONG ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x19) "%#abilities1%" I fixed the offset too, it seems I added an extra i to the filenames when I worked it out. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.