DavidNowlin Posted July 10, 2008 Share Posted July 10, 2008 Okay. So I'm still trying to design my very first mod, which is a portrait pack, and I think I've got the basics down. For each NPC I want to add a portrait to, I'll enter the npc-specific variant of the following code: //*npc* = *cre* COPY ~dnportraitpack/portraits/world/*npc*s.bmp~ ~portraits~ COPY ~dnportraitpack/portraits/world/*npc*l.bmp~ ~portraits~ COPY_EXISTING ~*cre*.cre~ ~Override~ WRITE_ASCII 0x34 ~*npc*s~ #8 WRITE_ASCII 0x3c ~*npc*l~ #8 ...where *npc* is the npc's name and *cre* is it's .cre file's name. I've tested that and I'm pretty sure it works (though... nevertheless, if anyone sees any problems with it, by all means, let me know). But while I was totally ripping off code from several portrait packs that are available out there, I came across the NPC Damage mod and saw something in there that I think might help make this easier... if I understood it at all. This is what I found: DEFINE_ASSOCIATIVE_ARRAY portraits BEGIN "aer" => "naerie" "ano" => "nanomen" "cer" => "ncernd" ...etc... and then: ACTION_PHP_EACH portraits AS "npc" => "portrait" BEGIN COPY ~npcdamage/spells/sc#npcds.spl~ ~override/sc#d%npc_0%1.spl~ WRITE_EVALUATED_ASCII 0xae ~%portrait%s~ #8 // small portrait WRITE_EVALUATED_ASCII 0xde ~%portrait%m~ #8 // medium portrait ACTION_FOR_EACH "level" IN 2 5 7 BEGIN COPY ~npcdamage/spells/sc#npcds.spl~ ~override/sc#d%npc_0%%level%.spl~ WRITE_EVALUATED_ASCII 0xae ~sc#%npc_0%%level%s~ #8 // small portrait WRITE_EVALUATED_ASCII 0xde ~sc#%npc_0%%level%m~ #8 // medium portrait END END It looks to me like this is a way of creating a list that defines each item in one group (like xxxx.cre) and associates it with a value in another group (like yyyys.bmp) so that you can enter only one actual command and have it execute that command for every item in the first group. Is that pretty close? See... here's what I was hoping to do with that. I've got like 200 images I want to put in my portrait pack, and some of those images are for npcs like "commoner" and "peasant" and so forth. I haven't even counted the number of .cre files I'm wanting to alter, but it's probably in the neighborhood of 300-350. For each of those files I'll have to enter the same command (see above) with only slight variations (namely, the name of the image and the name of the .cre file). I tried to tinker with the code I found and this is what I came up with: DEFINE_ASSOCIATIVE_ARRAY portraits BEGIN "latlara" => "acolara" "udsilver" => "adalon" "agnasi" => "agnasia" ACTION_PHP_EACH portraits AS "npc" => "portrait" BEGIN COPY ~dnportraitpack/portraits/world/%portrait%s.bmp~ ~portraits~ COPY ~dnportraitpack/portraits/world/%portrait%l.bmp~ ~portraits~ COPY_EXISTING ~%npc%.cre~ ~Override~ WRITE_EVALUATED_ASCII 0x34 ~%npc%s~ #8 WRITE_EVALUATED_ASCII 0x3c ~%npc%l~ #8 END ...but it didn't work. And I can't figure out what's wrong with it. Is there a way to just write out a list of npcs and the corresponding .cre for each and then write a command that refers to that list, picks up the npc name and the .cre name and plugs them in over and over again until it gets to the end of the list? Any help would be terrific. Link to comment
Taimon Posted July 10, 2008 Share Posted July 10, 2008 Post the error message. I think you forgot an END to end the array definition. (So add END before the ACTION_PHP_EACH.) Also, using %npc% instead of the %npc_0% in SConrad's (?) code, will only work, if you use at least WeiDU version 207. /Edit: And I think these lines WRITE_EVALUATED_ASCII 0x34 ~%npc%s~ #8 WRITE_EVALUATED_ASCII 0x3c ~%npc%l~ #8 should use %portrait% instead of %npc%. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 I think you forgot an END to end the array definition. (So add END before the ACTION_PHP_EACH.) Jebus. I didn't see it out there after the name. I guess I expect it to be on its own line. Also, using %npc% instead of the %npc_0% in SConrad's (?) code, will only work, if you use at least WeiDU version 207. I couldn't figure out what the _0 was for, so I left it off. I thought it was something specific to his project. should use %portrait% instead of %npc%. Heh. I actually caught that while I was writing the post, corrected it, ran it (still didn't work) but forgot to correct it in the post. I'll try it again. Thanks for replying. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 Still not working. This is the code I've got now. BACKUP ~dnportraitpack/backup~ AUTHOR ~davidnowlin@austin.rr.com~ BEGIN ~dnportraitpack~ //Code //Atmosphere - Female DEFINE_ASSOCIATIVE_ARRAY portraits BEGIN "latlara" => "acolara" "udsilver" => "adalon" "agnasi" => "agnasia" END ACTION_PHP_EACH portraits AS "npc" => "portrait" BEGIN COPY ~dnportraitpack/portraits/girls/%portrait%s.bmp~ ~portraits~ COPY ~dnportraitpack/portraits/girls/%portrait%l.bmp~ ~portraits~ COPY_EXISTING ~%npc_0%.cre~ ~Override~ WRITE_EVALUATED_ASCII 0x34 ~%portrait%s~ #8 WRITE_EVALUATED_ASCII 0x3c ~%portrait%l~ #8 END And this is the error message it gets me: WeiDU v 20600 Log C:\Program Files\Black Isle\BGII - SoA\Setup-dnportraitpack.exe [./CHITIN.KEY] loaded, 679026 bytes [./CHITIN.KEY] 258 BIFFs, 47951 resources [dialog.tlk] 172789 string entries [./Autorun.ini] loaded, 1452 bytes [./baldur.ini] loaded, 3656 bytes Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD1\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD3\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD4\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD5\] [./Keymap.ini] loaded, 5618 bytes [./Mplaynow.ini] loaded, 230 bytes [C:\Program Files\Black Isle\BGII - SoA\Setup-dnportraitpack.exe] Using scripting style "BG" [dialog.tlk] claims to be writeable. [dialog.tlk] claims to be a regular file. [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2] PARSE ERROR at line 12 column 1-24 Near Text: DEFINE_ASSOCIATIVE_ARRAY GLR parse error [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2] ERROR at line 12 column 1-24 Near Text: DEFINE_ASSOCIATIVE_ARRAY Parsing.Parse_error ERROR: parsing [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2]: Parsing.Parse_error ERROR: problem parsing TP file [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2]: Parsing.Parse_error FATAL ERROR: Parsing.Parse_error WeiDU Timings Parsing TP2 files 0.000 parsing .log files 0.000 loading files 0.010 unmarshal KEY 0.070 stuff not covered elsewhere 0.310 unmarshal TLK 1.773 TOTAL 2.163 Link to comment
Miloch Posted July 10, 2008 Share Posted July 10, 2008 You are using WeiDU v206. You should get v207 or above, like Taimon said. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 You are using WeiDU v206. You should get v207 or above, like Taimon said. I must have misunderstood him. But okay. Where do I get that? I got the one I'm using out of a mod folder. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 Found it. So... I just take the installer and replace the one I've been using with the new one? And then rename it to match, right? Link to comment
Taimon Posted July 10, 2008 Share Posted July 10, 2008 weidu.org v207 only fixes the _0 thing (you don't need it anymore with this version). Try replacing DEFINE_ASSOCIATIVE_ARRAY with ACTION_DEFINE_ASSOCIATIVE_ARRAY. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 Erm... Okay. I think I did what you suggested (or at least I tried to). I downloaded weidu 207 and unzipped it. I took the Weidu.exe out of the folder and put it in BG - SoA. I renamed it Setup-dnportraitpack after taking my existing Setup-dnportraitpack out of the folder. Then I ran it. It still didn't work, but the error message looks different. Now I'm getting this: WeiDU v 20700 Log C:\Program Files\Black Isle\BGII - SoA\Setup-dnportraitpack.exe version = 20600 Newest WeiDU is version 20700, updating! WeiDU files in version order: [Setup-dnportraitpack.exe] version 20700 [SETUP-UB.exe] version 20600 [Setup-Tashia.exe] version 20600 [Setup-Solaufein.exe] version 20600 [setup-sarahsoa.exe] version 20600 [Setup-RE.exe] version 20600 [setup-npc_tweak.exe] version 20600 [Setup-NPCFlirt.exe] version 20600 [Setup-kivan.exe] version 20600 [Setup-Keto.exe] version 20600 [Setup-IndiNPC.exe] version 20600 [Setup-Imoen.exe] version 20600 [Setup-GUI.exe] version 20600 [Setup-Fade.exe] version 20600 [Setup-deArnise.exe] version 20600 [Setup-D0QuestPack.exe] version 20600 [setup-CrossmodBG2.exe] version 20600 [Setup-Chloe.exe] version 20600 [setup-BTL.exe] version 20600 [Setup-BGTMusic.exe] version 20600 [Setup-BGT105bPatch.exe] version 20600 [Setup-BGT.exe] version 20600 [setup-bgqe.exe] version 20600 [Setup-BG2_Tweaks.exe] version 20600 [Setup-bg2fixpack.exe] version 20600 [setup-bg1ub.exe] version 20600 [setup-bg1npc.exe] version 20600 [Setup-AurenAseph.exe] version 20600 [Setup-Amber.exe] version 20600 [Setup-dnportraitpack.exe] loaded, 498176 bytes Copying [Setup-dnportraitpack.exe] -> [SETUP-UB.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Tashia.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Solaufein.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-sarahsoa.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-RE.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-npc_tweak.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-NPCFlirt.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-kivan.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Keto.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-IndiNPC.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Imoen.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-GUI.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Fade.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-deArnise.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-D0QuestPack.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-CrossmodBG2.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Chloe.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-BTL.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-BGTMusic.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-BGT105bPatch.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-BGT.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-bgqe.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-BG2_Tweaks.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-bg2fixpack.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-bg1ub.exe]: true Copying [Setup-dnportraitpack.exe] -> [setup-bg1npc.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-AurenAseph.exe]: true Copying [Setup-dnportraitpack.exe] -> [Setup-Amber.exe]: true [./CHITIN.KEY] loaded, 679026 bytes [./CHITIN.KEY] 258 BIFFs, 47951 resources [dialog.tlk] 172789 string entries [./Autorun.ini] loaded, 1452 bytes [./baldur.ini] loaded, 3656 bytes Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD1\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD3\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD4\] Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD5\] [./Keymap.ini] loaded, 5618 bytes [./Mplaynow.ini] loaded, 230 bytes [C:\Program Files\Black Isle\BGII - SoA\Setup-dnportraitpack.exe] Using scripting style "BG2" [dialog.tlk] claims to be writeable. [dialog.tlk] claims to be a regular file. [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2] PARSE ERROR at line 12 column 1-24 Near Text: DEFINE_ASSOCIATIVE_ARRAY GLR parse error [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2] ERROR at line 12 column 1-24 Near Text: DEFINE_ASSOCIATIVE_ARRAY Parsing.Parse_error ERROR: parsing [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2]: Parsing.Parse_error ERROR: problem parsing TP file [DNPORTRAITPACK/SETUP-DNPORTRAITPACK.TP2]: Parsing.Parse_error FATAL ERROR: Parsing.Parse_error WeiDU Timings Parsing TP2 files 0.000 loading files 0.000 parsing .log files 0.010 unmarshal KEY 0.170 unmarshal TLK 1.823 stuff not covered elsewhere 3.124 TOTAL 5.127 Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 v207 only fixes the _0 thing (you don't need it anymore with this version). Okay. I'll take that out. Try replacing DEFINE_ASSOCIATIVE_ARRAY with ACTION_DEFINE_ASSOCIATIVE_ARRAY. On it. Link to comment
DavidNowlin Posted July 10, 2008 Author Share Posted July 10, 2008 Try replacing DEFINE_ASSOCIATIVE_ARRAY with ACTION_DEFINE_ASSOCIATIVE_ARRAY. Tears of joy stream down my face. I love you guys. In a manly way, of course. That seems to have done the trick. I really appreciate the help. Link to comment
Miloch Posted July 10, 2008 Share Posted July 10, 2008 Great. Now Taimon/bigg can just paste your working code into the WeiDU doc, so this is actually documented somewhere (I didn't even know about the ACTION_DEFINE_ASSOCIATIVE_ARRAY). Or we can all wait for SConrad to produce "more exaustive documentation" . Link to comment
the bigg Posted July 10, 2008 Share Posted July 10, 2008 Great. Now Taimon/bigg can just paste your working code into the WeiDU doc, so this is actually documented somewhere (I didn't even know about the ACTION_DEFINE_ASSOCIATIVE_ARRAY). Or we can all wait for SConrad to produce "more exaustive documentation" . If the word "LaTeX" brings shivers of fear down your spine, you'll know why I always postpone documentation work. Besides, I need to add exaustive description to his code, and I can't write long and exaustive text for the life of me. Also, the problem with arrays (and associated commands) is that all examples end up being forced into their place, and that putting arrays (or any other 'advanced' WeiDU construct) to use succesfully requires much more creativity than just going by the example (like here). Bah, who am I kidding, we should all make monolithic mods, give up real life opportunities in favor of modding, copy our folder to the override without patching, and handle compatibility with 'careful procedures' and ad-hoc compatibility patches Link to comment
Miloch Posted July 10, 2008 Share Posted July 10, 2008 Bah, who am I kidding, we should all make monolithic mods, give up real life opportunities in favor of modding, copy our folder to the override without patching, and handle compatibility with 'careful procedures' and ad-hoc compatibility patches Hey, we can't all aspire to be Distinguished Developers. Such a coveted privilege is only for the elite few, not for us "hobbyist modders" who only lurk around the non-serious modding forums. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.