Okay, yeh, what you're doing there's pretty clever. I can't say I can easily follow all the code, so I've attempted writing my own which probably won't work.
<<<<<<<< isthere.baf
IF
Global("D0VirtueInstalled","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("D0VirtueInstalled","GLOBAL",1)
Continue()
END
>>>>>>>>
<<<<<<<< notthere.baf
IF
Global("D0VirtueInstalled","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("D0VirtueInstalled","GLOBAL",0)
Continue()
END
>>>>>>>>
ACTION_IF NOT FILE_CONTAINS ~baldur.bcs~ ~D0VirtueInstalled~ BEGIN
EXTEND_TOP + ~baldur.bcs~ ~notthere.baf~
END
ACTION_IF NOT FILE_CONTAINS ~baldur25.bcs~ ~D0VirtueInstalled~ BEGIN
EXTEND_TOP + ~baldur25.bcs~ ~notthere.baf~
END
COPY_EXISTING ~baldur.bcs~ ~override~
REPLACE_BCS_BLOCK ~notthere.baf~ ~isthere.baf~
COPY_EXISTING ~baldur25.bcs~ ~override~
REPLACE_BCS_BLOCK ~notthere.baf~ ~isthere.baf~
I'm using the hypothetical EXTEND_TOP + that somebody, probably you, suggested on the WeiDU forum the other day. Now that I look back, a lot of your code looks to be faking this behaviour with the tempbaldur and stuff.
Yeah, that code seems to be correct (although FILE_CONTAINS search for files (as in COPY) instead of gamefiles (as in COPY_EXISTING), so you need to manually extract baldur.bcs and baldur25.bcs to the override with the + option and then use FILE_CONTAINS ~
override/foo~).
tempbaldur was (as you guessed) to fake the EXTEND_TOP + option.
Finally, to keep existing code correct I'd set d0virtuedisable to 1 if Virtue is not installed (add proper IF/THEN block to notthere.baf), and instead of d0virtueinstalled I'd use virtuesetup.
This method still falls down if somebody reinstalls the game completely but keeps their savegames, but I guess that's an obscure enough scenario to be forgivable.
There is a line where the user must have half a brain after all; however, setting it further is better than keeping it where it is now
I must say, if I implement this, I'll be pretty impressed if people actually bother adding Virtue support to their mods.
I'd certainly do this - meaning I'll patch all the code in Refinements, Mazzy the Palaidn and tb#quest, and will gently ask Quitch&Littiz to review all hundred or so of pages of RtW code. *loads gun*