Pocket Plane Group

Miscellany, Inc. => Infinity Engine Modding Q&A => Topic started by: Andyr on September 30, 2004, 12:48:33 PM

Title: REPLACE_BCS_BLOCK
Post by: Andyr on September 30, 2004, 12:48:33 PM
I have not used this command before.

I am looking at the WeiDU ReadMe:

Quote
REPLACE_BCS_BLOCK oldFile newFile

If the current file is a BCS file, the segment of it corresponding to oldFile is replaced with the contents of newFile. oldFile and newFile may be BCS or BAF files. If they are BAF files they will not get the benefit of AUTO_TRA.

So am I right in thinking I could do something like:

Code: [Select]
COPY_EXISTING ~ppjon.bcs~ ~override/ppjon.bcs~
DECOMPILE_BCS_TO_BAF
REPLACE_BCS_BLOCK ~mymod/a.baf~ ~mymod/b.baf~
COMPILE_BAF_TO_BCS

Where a.baf is this block of his script:

Code: [Select]
IF
Global("AsylumPlot","GLOBAL",54)
HPLT(Myself,20)
THEN
RESPONSE #100
DialogInterrupt(TRUE)
SetInterrupt(FALSE)
Unlock("Door11")
OpenDoor("Door11")
OpenDoor("Door01")
ForceSpell("ppdra2",WIZARD_TRUE_SIGHT)
Kill("ppnalj2")
Kill("ppaph2")
Kill("ppdra2")
Kill("ppwanev2")
Kill("pptiax2")
SetInterrupt(TRUE)
SetGlobal("AsylumPlot","GLOBAL",55)
StartDialogueNoSet(Player1)
END

And b.baf is:

Code: [Select]
IF
Global("AsylumPlot","GLOBAL",54)
HPLT(Myself,20)
THEN
RESPONSE #100
DialogInterrupt(TRUE)
SetInterrupt(FALSE)
Unlock("Door11")
OpenDoor("Door11")
OpenDoor("Door01")
ForceSpell("ppdra2",WIZARD_TRUE_SIGHT)
SetInterrupt(TRUE)
SetGlobal("AsylumPlot","GLOBAL",55)
StartDialogueNoSet(Player1)
END

Essentially, I want to stop everyone dying in the Asylum. :)
Title: Re: REPLACE_BCS_BLOCK
Post by: CamDawg on September 30, 2004, 12:53:46 PM
It'll work, though you don't need the DE/COMPILE commands. My one gripe about REPLACE_BCS_BLOCK is that it's too easy to not get a match. In this case since it's incrementing a variable, I would just use an EXTEND_TOP and add the contents of b.baf. This will ensure your block gets executed and not the existing one.
Title: Re: REPLACE_BCS_BLOCK
Post by: Andyr on September 30, 2004, 12:58:28 PM
I see. Well, let's see what happens. :)
Title: Re: REPLACE_BCS_BLOCK
Post by: SimDing0™ on September 30, 2004, 12:59:32 PM
I'd use (DE)COMPILE and REPLACE_TEXTUALLY to address only the lines you need changing. EXTEND_TOP with a similar block is messy, and while maybe not in this case, it's more prone to breaking other stuff.
Title: Re: REPLACE_BCS_BLOCK
Post by: Andyr on September 30, 2004, 01:18:23 PM
Can I blank out a line using REPLACE_TEXTUALLY, though, eg REPLACE_TEXTUALLY ~Kill("ppdra2")~ ~~ without messing up the script?
Title: Re: REPLACE_BCS_BLOCK
Post by: jcompton on September 30, 2004, 01:29:49 PM
If you for some reason cannot, you can always set some nonsense variable to 0 or something else equally harmless.
Title: Re: REPLACE_BCS_BLOCK
Post by: Andyr on September 30, 2004, 07:27:14 PM
I'll give it a go, then, and see whast WeiDU tells me in return.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 02, 2004, 04:02:32 AM
umm... what is the point of COMPILE_BAF_TO_BCS? i just put
COMPILE ~override/awblah.baf~

and that always seems to work.
Title: Re: REPLACE_BCS_BLOCK
Post by: SimDing0™ on October 02, 2004, 05:26:47 AM
The usage is completely different. COMPILE_BAF_TO_BCS is part of a patching sequence. For example:

COPY_EXISTING ~baldur.bcs~ ~override~
DECOMPILE_BCS_TO_BAF
REPLACE_TEXTUALLY ~OnCreation()~ ~True()~
COMPILE_BAF_TO_BCS

This code would replace every occurance of "OnCreation()" in baldur.bcs with "True()". The logic is that WeiDU decompiles the script, you replace the line in the BAF source, then it's recompiled. This avoids having to use lots of nasty BCS code in the REPLACE_TEXTUALLY statement.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 02, 2004, 11:37:14 AM
ah, that makes sense.
umm.... how would i add to baldur.bcs? would it be like this

DECOMPILE_BCS_TO_BAF ~override/baldur.bcs~
EXTEND_BOTTOM ~IF
Globlal(klfdjlkfdijd)
THEN
.........
COMPILE_BAF_TO_BCS
Title: Re: REPLACE_BCS_BLOCK
Post by: Grim Squeaker on October 02, 2004, 11:44:37 AM
ah, that makes sense.
umm.... how would i add to baldur.bcs? would it be like this

DECOMPILE_BCS_TO_BAF ~override/baldur.bcs~
EXTEND_BOTTOM ~IF
Globlal(klfdjlkfdijd)
THEN
.........
COMPILE_BAF_TO_BCS

If all you want to do is ADD a new block to baldur.bcs then just slap your new block in a baf (say Foo.baf) and then:

EXTEND_BOTTOM ~baldur.bcs~ ~directory/foo.baf~

You only need to DECOMPILE_BSC_TO_BAF and vice-versa if you are doing clever tricks to replace stuff already in baldur.bcs
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 02, 2004, 11:46:38 AM
thanks. i've been trying to figure out how to do this for a while now.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 02, 2004, 09:13:03 PM
heh, it says i'm offline but i'm not. that's weird. anyways, wouldn't it need too look like this

EXTEND_BOTTOM ~override/baldur.bcs~ ~script/blah.baf~
Title: Re: REPLACE_BCS_BLOCK
Post by: icelus on October 02, 2004, 09:23:02 PM
heh, it says i'm offline but i'm not. that's weird. anyways, wouldn't it need too look like this

Look in your account settings.  Somewhere you clicked to hide your online presence.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 03, 2004, 01:42:36 AM
oh yeah, didn't realize it would do that. i was just tired of seeing my name at the bottom of the screen. like i didn't know that i was online....

anyways, i used the extend_bottom and it seemed to work, but when i go in w/ dltcep the script isn't changed.
Title: Re: REPLACE_BCS_BLOCK
Post by: icelus on October 03, 2004, 02:02:55 AM
DLTCEP may be pulling the original file from the .bif files.  How are you opening the file in the program?
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 03, 2004, 02:04:55 AM
i click on load file on the bottom left of the script screen and select dplayer3.bcs
Title: Re: REPLACE_BCS_BLOCK
Post by: icelus on October 03, 2004, 02:12:28 AM
You'll probably need to press "Load external script" and browse for the file in your override folder.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 03, 2004, 02:14:25 AM
argh. not too much work, but still, argh. alright. i'll check that now........

heh, it's not there.....
Title: Re: REPLACE_BCS_BLOCK
Post by: Rastor on October 03, 2004, 01:38:34 PM
Quote
EXTEND_BOTTOM ~override/baldur.bcs~ ~script/blah.baf~

Did you use that?  If so, then it won't work.  It needs to be EXTEND_BOTTOM ~baldur.bcs~ ~script/blah.baf~
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 03, 2004, 05:21:28 PM
ahhh... that got it. what i actually did was this:

EXTEND_BOTTOM ~baldur.bcs~ ~blah.baf~

instead of

EXTEND_BOTTOM ~baldur.bcs~ ~blah/blah.baf~
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 12, 2004, 06:34:39 PM
Andyr, did the REPLACE_TEXTUALLY ~Kill("ppdra2")~ ~~ work?
Title: Re: REPLACE_BCS_BLOCK
Post by: Andyr on October 13, 2004, 08:03:13 PM
Didn't use it in the end, give it a shot. :)
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 13, 2004, 08:25:33 PM
heh, none of it's working for me unfortunately. i tried a space in there though, it's not working. i guess i'll have to keep trying, i do need this to work, i think.
Title: Re: REPLACE_BCS_BLOCK
Post by: Andyr on October 13, 2004, 08:42:26 PM
You could just replace the next line with itself.

eg REPLACE TEXTUALLY
~a
b~

~c
b~

Or something.
Title: Re: REPLACE_BCS_BLOCK
Post by: Awake on October 13, 2004, 09:08:34 PM
actually, REPLACE_TEXTUALLY ~foo~ ~~ works. i just tested it. it gets rid of the line entirely and moves the END up a line. very nice