berelinde Posted December 24, 2006 Share Posted December 24, 2006 If I attempt to extend the bottom of a script that doesn't exist, for example, a script for a CRE that previously had none assigned, will it create one? In the interests of mod compatibility with other mods that might want to use this CRE, could I do this in the tp2: EXTEND_BOTTOM ~_SLEEPMH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPMH.baf~ EXTEND_BOTTOM ~_SLEEPFH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPFH.baf~ BUT_ONLY_IF_IT_CHANGES If I did this, would it then compile the baf and create a _SLEEPMH.bcs and _SLEEPFH.bcs? Link to comment
berelinde Posted December 24, 2006 Author Share Posted December 24, 2006 According to this thread, it works for area scripts. I guess I'll find out whether or not it works for other kinds of scripts as well. http://forums.pocketplane.net/index.php/topic,23341.0.html Link to comment
devSin Posted December 24, 2006 Share Posted December 24, 2006 Yes. EXTEND_BOTTOM ~anyScript.bcs~ ~whatever~ will create anyScript if it doesn't exist (as will EXTEND_TOP). WeiDU doesn't know (or care) what you're going to assign the script to. I think BUT_ONLY_IF_IT_CHANGES is a copy constraint (unless support is hacked on to other actions); you can only use it with COPY actions. In any case, it wouldn't serve any purpose in your example. Link to comment
berelinde Posted December 24, 2006 Author Share Posted December 24, 2006 Thanks much. I'll just leave it out, then. Useful to know that about EXTEND_TOP/EXTEND_BOTTOM. And a relief. Link to comment
Miloch Posted December 24, 2006 Share Posted December 24, 2006 Huh? Why are you asking a guy who knows jack about scripting? Oh wait... you're asking *anyone*... nevermind then... Dunno if it helps much but this is what I used "in the interest of compatibility" (i.e. creating a script if it doesn't exist or extending one if it does, vis-a-vis different versions of Tutu, BGT and BG1). I don't know if it works... I feel testing is always a bad idea. That might actually reveal *bugs* - therefore if we don't test, we don't discover bugs, and therefore, there aren't any, right? //Mod variable declarations ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.ARE~ THEN BEGIN //Tutu PRINT @1 //Tutu install: using Tutu naming conventions SPRINT "bwscr" "_AR3307" //Burning Wizard L1 script END ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.ARE~ THEN BEGIN //BGT PRINT @2 //BGT install: using BGT naming conventions SPRINT "bwscr" "AR6707" //Burning Wizard L1 script END ACTION_IF FILE_EXISTS_IN_GAME ~AR0100.ARE~ THEN BEGIN //BG1 PRINT @3 //BG1 install: using BG1 naming conventions SPRINT "bwscr" "AR3307" //Burning Wizard L1 script END ELSE BEGIN PRINT @4 //Error: This mod can only be installed on BG1, BGT or Tutu. END //... Other mod code //Scripts ACTION_IF FILE_EXISTS_IN_GAME ~%bwscr%.BCS~ THEN BEGIN EXTEND_TOP ~%bwscr%.BCS~ ~MyMod/script/AR3307.BAF~ END ELSE BEGIN ACTION_IF (FILE_EXISTS_IN_GAME ~FW0100.ARE~ OR FILE_EXISTS_IN_GAME ~AR7200.ARE~) THEN BEGIN //non-BG1 COPY - ~MyMod/script/AR3307.BAF~ ~MyMod/script/%bwscr%.BAF~ END COMPILE ~MyMod/script/%bwscr%.BAF~ END Believe it or not, I wrote most of this code, though reading it back now, it doesn't make a whole lot of sense. Whether that is due to the influence of wine or due to the intricacies of multiple platforms, or due to the fact it is rubbish code (or all three), I dunno. As I said, it's completely theoretical and untested but it would save me coding that same block three times if it works. Link to comment
cmorgan Posted December 24, 2006 Share Posted December 24, 2006 what do you do about the internal script having different resource names/actions etc. based on platform? "imoen" vs "IMOEN2", etc.? I think you are also missing some ELSE behavior in the top secion A_I F_E_I_G X T B ~x~ END ELSE A_I F_E_I_G Y T B ~y~ END ELSE A_I F_E_I_G Y T B ~z~ END ELSE B print ~fail~ END but not necessarily - won't it work just to use the single-call condition, i.e. A_I NOT (F_E_I_G ~X~) AND NOT (F_E_I_G ~Y~) AND NOT (F_E_I_G ~Z~) print ~fail~ END //there is a cool way of doing this from TutuFix and the BG2 Fixpack, but I can't remember it) A_I F_E_I_G X T B ~x~ END A_I F_E_I_G Y T B ~y~ END A_I F_E_I_G Z T B ~z~ END @berelinde - I ran into some silliness forgetting that just because I compiled a script doesn't mean that the game knows how to reference it, so I had to double check that the .cre in question had been patched to match the new script... that was a tough round I think I dragged gorilym through with Mr. Tanarii Link to comment
berelinde Posted December 24, 2006 Author Share Posted December 24, 2006 Good point. I am using the script to clear a house of sleepers who are only present at certain hours. Those two sleepers are _SLEEPFH.CRE and _SLEEPMH.CRE. For B!SLEEPFH.BAF and for B!SLEEP.BAF, i've got: IF AreaCheck("FWxxxx") //the location in question THEN RESPONSE #100 DestroySelf() END For the tp2: EXTEND_BOTTOM ~_SLEEPMH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPMH.baf~ EXTEND_BOTTOM ~_SLEEPFH.bcs~ ~GAVIN/Quest/QuestBAF/B!SLEEPFH.baf~ /* lots more stuff to do with dialog compilation, item placement, portrait assignment, etc for CREs that aren't meant to snuff it before the party sees them */ COPY_EXISTING ~_SLEEPMH.CRE~ ~override~ SAY NAME1 ~Sleeping Man~ SAY NAME2 ~Sleeping Man~ WRITE_ASCII 0x248 ~_SLEEPMH~ #8 // override BUT_ONLY_IF_IT_CHANGES COPY_EXISTING ~_SLEEPFH.CRE~ ~override~ SAY NAME1 ~Sleeping Woman~ SAY NAME2 ~Sleeping Woman~ WRITE_ASCII 0x248 ~_SLEEPFH~ #8 // override BUT_ONLY_IF_IT_CHANGES the SAY NAME bits probably aren't necessary, since they don't need names for my purposes, but what the heck. I think this will work. It's Christmas Eve. I'm going to do a little last minute shopping, then go to boyfriend's mother's for Christmas Eve dinner, then come home and *not mod*. I'm going to download a new copy of EasyTutu, install the latest alpha of Gavin, v 0.5, (and another alpha...) and then play a bit. Link to comment
Miloch Posted January 1, 2007 Share Posted January 1, 2007 what do you do about the internal script having different resource names/actions etc. based on platform? "imoen" vs "IMOEN2", etc.? I think you are also missing some ELSE behavior in the top secionI avoided all that by including platform-dependent variables in the declaration section. And it's even easier for most resources as I just assign: ACTION_IF FILE_EXISTS_IN_GAME ~FW0100.ARE~ THEN BEGIN //Tutu SPRINT "tsu" "_" //assign Tutu underscore END Then when I refer to something e.g. _SLEEPFH.CRE in Tutu or SLEEPFH.CRE in BGT/BG1, I just refer to it as %tsu%SLEEPFH.CRE. There are exceptions but I just assign variables to those as well in the declarations section. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.