Jump to content


Photo

BPv179 Released


  • Please log in to reply
76 replies to this topic

#61 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 23 May 2010 - 01:53 AM

I'd propose updates to fix this code, but I really don't understand why these mxspl .2da files aren't simply copied over from the mod's folder.

Because overwriting is not cool - I thought you grasped that concept by now :P. I doubt it really needs that much code - it could probably be vastly compressed with ACTION/PATCH_FOR_EACH loops or the like. And if it takes 1400 or even 14,000 lines of code - so what. Infinity Animations uses 19,000+ lines to patch the .exe - it takes a whole 1.5 seconds to execute and compresses to a whole 36kb. Is that many lines of code a reason to overwrite the .exe? Hells, no.

So the question is: do you want to write the code or do I need to? (I'd rather not step into this monster since I'm trying to polish up a couple of other monsters, but I guess I will if no one else can.)

Speaking of bugs, Chev (or whoever else knows), aren't there still outstanding bugs in this re: faulty patching in the Crypt Lord and Shade Lord routines, or did someone fix those?

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#62 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 23 May 2010 - 02:37 AM

I'd propose updates to fix this code, but I really don't understand why these mxspl .2da files aren't simply copied over from the mod's folder.

Because overwriting is not cool

Cool or not, it has its place. If your goal is to change part of a file, you should be patching it. If your goal is to change a file completely, you should NOT be patching it.

#63 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 23 May 2010 - 04:06 AM

So, why not condense 40kb of unnecessary, partially buggy patching into 10kb of working, pregenerated files?

So, saving 40 kb is suddenly more important than keeping mod as compatible as possible? Whoa, that's a great idea for sure :lol:

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#64 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 23 May 2010 - 05:59 AM


So, why not condense 40kb of unnecessary, partially buggy patching into 10kb of working, pregenerated files?

So, saving 40 kb is suddenly more important than keeping mod as compatible as possible? Whoa, that's a great idea for sure :lol:

The file size savings are just a bonus. Let me say it again: patching is not always better. In this case, it reduces compatibility rather than increase it.

For example, if I install a mod that increases the number of spells known per day at all levels by 1 before this patch, then I will end up with tables that lose spell slots at points (e.g. 7 level 4 druid spells at level 16, then only 6 level 4 druid spells at levels 17 and 18).

#65 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 23 May 2010 - 07:26 AM

Let me say it again: patching is not always better. In this case, it reduces compatibility rather than increase it.

Only because the existing code is suboptimal. Overwriting is the lazy modder's answer to code issues.

But you didn't answer my question. I'm guessing you won't be helping update the code, either because it's beyond you or you're otherwise uninterested. Which is fine since it isn't your mod after all, but just say so and leave it at that.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#66 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 23 May 2010 - 02:19 PM

Let me say it again: patching is not always better. In this case, it reduces compatibility rather than increase it.

Only because the existing code is suboptimal. Overwriting is the lazy modder's answer to code issues.

Wrong on both counts. Modders who overwrite everything without thinking about compatibility are lazy, but so are those who patch everything without ever asking "what are the advantages and disadvantages of patching this file?". Even if this code did what it was trying to, it's not something that can be compatible with other mods that change the spell tables. It overwrites half the table, so you have to choose: do you want 1 functional table, or one frankentable?

If you want an example of spell tables done right, see the BG2 Tweak Pack.

But you didn't answer my question. I'm guessing you won't be helping update the code, either because it's beyond you or you're otherwise uninterested. Which is fine since it isn't your mod after all, but just say so and leave it at that.

Here you go:

COPY ~BPv179/2DA/mxspldru.2da~ ~override~
 	~BPv179/2DA/mxsplpal.2da~ ~override~
 	~BPv179/2DA/mxsplprs.2da~ ~override~
 	~BPv179/2DA/mxsplran.2da~ ~override~
 	~BPv179/2DA/mxsplsrc.2da~ ~override~
 	~BPv179/2DA/mxsplwiz.2da~ ~override~

Attached Files



#67 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 24 May 2010 - 06:56 AM

Lovely discussion.

Anyway, patchy code (hopefully problem-free) to extend mxsplpal to level 50, write the new values and add level 5 and level 6 columns:

COPY_EXISTING mxsplpal.2da override
  COUNT_2DA_COLS num_col
  COUNT_2DA_ROWS 3 num_row
  READ_2DA_ENTRY num_row - 1 0 3 max_level
  PATCH_IF max_level < 50 BEGIN //extend the table to level 50
    SPRINT string ""
    FOR (j=1;j<num_col;++j) BEGIN
      READ_2DA_ENTRY num_row - 1 j 3 entry
      SPRINT string "%string%"^"%entry% "
    END
    i = num_row
    FOR (j=max_level + 1;j<=50;++j) BEGIN
      SPRINT string2 "%j% "^"%string%"
      INSERT_2DA_ROW i 3 "%string2%"
      ++i
    END
  END
  READ_2DA_ENTRIES_NOW r2en_mxsplpal 3
  FOR (i=1;i<r2en_mxsplpal;++i) BEGIN //write the new table values
    READ_2DA_ENTRY_FORMER r2en_mxsplpal i 0 level
    FOR (j=1;j<num_col;++j) BEGIN
      READ_2DA_ENTRY_FORMER r2en_mxsplpal 0 j - 1 spell_level
      READ_2DA_ENTRY_FORMER r2en_mxsplpal i j entry
      SET_2DA_ENTRY_LATER s2el_mxsplpal i j ((level = 22 OR level = 23) AND spell_level < 2)
                                         OR ((level = 24 OR level = 25) AND spell_level < 3)
                                         OR ((level = 26 OR level = 27) AND spell_level < 4)
                                         OR ((level = 28 OR level = 29) AND spell_level < 5)
                                         OR ((level = 30 OR level = 31) AND spell_level > 1 AND spell_level < 5)
                                         OR ((level = 32 OR level = 33) AND spell_level > 2 AND spell_level < 5)
                                         OR ((level = 34 OR level = 35) AND spell_level > 3 AND spell_level < 5)
                                         ? 4 :
                                            ((level = 30 OR level = 31) AND spell_level < 2)
                                         OR ((level = 32 OR level = 33) AND spell_level < 3)
                                         OR ((level = 34 OR level = 35) AND spell_level < 4)
                                         OR ((level = 36 OR level = 37) AND spell_level < 5)
                                         OR ((level = 38 OR level = 39) AND spell_level > 1 AND spell_level < 5)
                                         OR ((level = 40 OR level = 41) AND spell_level > 2 AND spell_level < 5)
                                         OR  (level > 41 AND level < 47 AND spell_level > 3 AND spell_level < 5)
                                         ? 5 : 
                                            ((level = 38 OR level = 39) AND spell_level < 2)
                                         OR ((level = 40 OR level = 41) AND spell_level < 3)
                                         OR  (level = 42                AND spell_level < 4)
                                         OR ((level = 43 OR level = 44) AND spell_level > 1 AND spell_level < 4)
                                         OR ((level = 45 OR level = 46) AND spell_level > 2 AND spell_level < 4)
                                         OR  (level > 46 AND level < 51 AND spell_level > 2 AND spell_level < 5)
                                         ? 6 : 
                                            ((level = 43 OR level = 44) AND spell_level < 2)
                                         OR  (level > 44 AND level < 49 AND spell_level < 3)
                                         OR ((level = 49 OR level = 50) AND spell_level > 1 AND spell_level < 3)
                                         ? 7 :
                                            (level = 49 OR level = 50) AND spell_level < 2
                                         ? 8 : entry
    END
  END
  SET_2DA_ENTRIES_NOW s2el_mxsplpal 3
  PRETTY_PRINT_2DA
BUT_ONLY

APPEND_COL mxsplpal.2da ~$ $ 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4~ UNLESS "^[%tab% ]+1[%tab% ]+2[%tab% ]+3[%tab% ]+4[%tab% ]+5" //add a level 5 column unless there already is one
APPEND_COL mxsplpal.2da ~$ $ 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2~ UNLESS "^[%tab% ]+1[%tab% ]+2[%tab% ]+3[%tab% ]+4[%tab% ]+5[%tab% ]+6" //ditto for level 6

It should be easy to adapt to adapt it to the other mxspl* tables.

Edit: That was the straight port. If you want something a teensy-weensy bit more fancy, you can use this, for example:

COPY_EXISTING mxsplpal.2da override
  COUNT_2DA_COLS num_col
  COUNT_2DA_ROWS 3 num_row
  READ_2DA_ENTRY num_row - 1 0 3 max_level
  PATCH_IF max_level < 50 BEGIN //extend the table to level 50
    SPRINT string ""
    FOR (j=1;j<num_col;++j) BEGIN
      READ_2DA_ENTRY num_row - 1 j 3 entry
      SPRINT string "%string%"^"%entry% "
    END
    i = num_row
    FOR (j=max_level + 1;j<=50;++j) BEGIN
      SPRINT string2 "%j% "^"%string%"
      INSERT_2DA_ROW i 3 "%string2%"
      ++i
    END
  END
  READ_2DA_ENTRIES_NOW r2en_mxsplpal 3
  FOR (i=1;i<r2en_mxsplpal;++i) BEGIN //write the new table values
    READ_2DA_ENTRY_FORMER r2en_mxsplpal i 0 level
    FOR (j=1;j<num_col;++j) BEGIN
      READ_2DA_ENTRY_FORMER r2en_mxsplpal 0 j - 1 spell_level
      READ_2DA_ENTRY_FORMER r2en_mxsplpal i j entry
      SET_2DA_ENTRY_LATER s2el_mxsplpal i j ((level = 22 OR level = 23) AND spell_level < 2)
                                         OR ((level = 24 OR level = 25) AND spell_level < 3)
                                         OR ((level = 26 OR level = 27) AND spell_level < 4)
                                         OR ((level = 28 OR level = 29) AND spell_level < 5)
                                         OR ((level = 30 OR level = 31) AND spell_level > 1 AND spell_level < 5)
                                         OR ((level = 32 OR level = 33) AND spell_level > 2 AND spell_level < 5)
                                         OR ((level = 34 OR level = 35) AND spell_level > 3 AND spell_level < 5)
                                         ? entry < 4 ? 4 : entry :
                                            ((level = 30 OR level = 31) AND spell_level < 2)
                                         OR ((level = 32 OR level = 33) AND spell_level < 3)
                                         OR ((level = 34 OR level = 35) AND spell_level < 4)
                                         OR ((level = 36 OR level = 37) AND spell_level < 5)
                                         OR ((level = 38 OR level = 39) AND spell_level > 1 AND spell_level < 5)
                                         OR ((level = 40 OR level = 41) AND spell_level > 2 AND spell_level < 5)
                                         OR  (level > 41 AND level < 47 AND spell_level > 3 AND spell_level < 5)
                                         ? entry < 5 ? 5 : entry : 
                                            ((level = 38 OR level = 39) AND spell_level < 2)
                                         OR ((level = 40 OR level = 41) AND spell_level < 3)
                                         OR  (level = 42                AND spell_level < 4)
                                         OR ((level = 43 OR level = 44) AND spell_level > 1 AND spell_level < 4)
                                         OR ((level = 45 OR level = 46) AND spell_level > 2 AND spell_level < 4)
                                         OR  (level > 46 AND level < 51 AND spell_level > 2 AND spell_level < 5)
                                         ? entry < 6 ? 6 : entry : 
                                            ((level = 43 OR level = 44) AND spell_level < 2)
                                         OR  (level > 44 AND level < 49 AND spell_level < 3)
                                         OR ((level = 49 OR level = 50) AND spell_level > 1 AND spell_level < 3)
                                         ? entry < 7 ? 7 : entry :
                                            (level = 49 OR level = 50) AND spell_level < 2
                                         ? entry < 8 ? 8 : entry : entry
    END
  END
  SET_2DA_ENTRIES_NOW s2el_mxsplpal 3
  PRETTY_PRINT_2DA
BUT_ONLY

APPEND_COL mxsplpal.2da ~$ $ 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4~ UNLESS "^[%tab% ]+1[%tab% ]+2[%tab% ]+3[%tab% ]+4[%tab% ]+5" //add a level 5 column unless there already is one
APPEND_COL mxsplpal.2da ~$ $ 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2~ UNLESS "^[%tab% ]+1[%tab% ]+2[%tab% ]+3[%tab% ]+4[%tab% ]+5[%tab% ]+6" //ditto for level 6

That way you'll avoid inadvertently lowering any values and you will thus not cause negative spell progression.

Edited by Wisp, 24 May 2010 - 08:09 AM.


#68 horred the plague

horred the plague

    Scourge of the Seven Seas

  • Modder
  • 1899 posts

Posted 24 May 2010 - 09:18 AM

No kidding, lovely discussion indeed. Thanks for the code bits Wisp. I really don't have time to learn all the improvements to weidu since 2005. Keep in mind at least half the functions you're using here, didn't exist back then.

@Mike1072: A long time ago, before BP was BP-weidu, everything in the package was in overwrite format. I have to both agree and disagree with you. My very first weidu package in 2005 was set up very similar to what you offered here. It was later replaced with what you've seen to date.

Yes, sometimes the depths it takes to fix a couple lines of code are absolutely absurd. There's many more modern games with modding, where we still patch 2da's and similar files "the old fashioned way". BG2 is different, in that the tools were made by the community not game makers. So, there is a lot more functionality available to the modder, at a little added expense in time and code.

It is this community as a whole that highly values the "by-the-byte" code style. They like their 593,643 mods all plugged in at once, to play a single 35,000-hour game for the next three-four years. Not my style, any longer, but hey--I helped get this compatability train rolling in the first place, years ago. And it's picked up a lot of steam and momentum, since then. In the end, you have to consider your audience and please them. Even if it means 100x the workload for you. Either that, or make mods for just yourself, just the way you like them.

#69 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 24 May 2010 - 10:54 AM

@Mike1072: :new_bottom:
@Wisp: :new_thumbs:

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#70 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 24 May 2010 - 01:42 PM

I'll be nice and post patches for the other mxspl files as well, unless someone else really wants to do it. It will probably take me a day or three, however.
Mike explained how mxsplpal and mxsplran stand to benefit. Updated patches for the other files probably aren't quite as interesting, but at least one of the existing patches (mxsplprs) lower the current values at certain levels and an updated patch could do this a little better, to minimise the risk of creating negative spell progressions. If someone created a "everyone has 10 spells per level at all levels" tweak, you could also be compatible with that (the current patches aren't).

#71 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 27 May 2010 - 04:56 AM

I ended up fixing a couple of things like the patch glitches in the Crypt King component, since it looked like no one else had gotten to it. Then I fixed similar things in the Shade Lord patching to prevent glitches like this. Though that may not be BP hosing the CRE originally but some mod like TS, but anyhow, any subsequent patches done by BP or another mod are going to hose the CRE even further if it is already. Which makes me think maybe we should throw Nythrun's CRE-fixing macros in here as well. Fixed this as well, which involved a assigning a couple of DVs in the tp2 but also decompiling some of those script snippets so I could fix them. I decompiled all the BCSes while I was at it. No reason not to have them as BAFs - they're human-readable and actually take up less space than the compiled versions for the most part.

Fixed some other glitches while I was in there:
- Added TWOHANDED to any EQUIP weapon patches that should have them
- Made sure stackable ADD/REPLACE_CRE_ITEMs have at least one charge to prevent crashes (usually multiples of 10 in the case of normal arrows, bullets, etc.)
- Added #8 to several WRITE_ASCII values that should have them, to prevent hosed CREs
- Used modern WeiDU commands (ADD_MEMORIZED_SPELL, SET_BG2_PROFICIENCY, REMOVE_CRE_ITEM, LPF ADD_CRE_EFFECT, etc.) to prevent patch errors.
- Implemented missing patches from spells.tbl, prof_eff.tbl, itm_rmv.tbl and discontinued those tables (no longer necessary with modern commands)
- Replaced INVALID ITEM comments with sensible values where practical

Wasn't really planning on doing a full overhaul, but a couple of those fixes resulted in changing the tp2 rather significantly. It should be easy to add any table patches you're doing, since I'm not messing with those (and don't really plan on it - it is enough going through all the CRE patches). Just want to make sure I'm not stepping on anyone else who's updating the tp2 currently.

There is something else fairly significant that needs to be fixed, unless I'm quite mistaken. AFAIK, syntax like this won't work as intended:
COPY_EXISTING ~AR0501.BCS~ ~override~
  REPLACE_TEXTUALLY ~BPv179/SNIP/oAR0501.BCS~ ~BPv179/SNIP/nAR0501.BCS~
BUT_ONLY
I should say it won't work at all, because it'll try to replace that actual string in those scripts, not the contents of the BCS snippets. It may have worked with REPLACE_BCS_BLOCK at one time, but only if it could find those exact blocks, and only if some other mod didn't change them. So they'll need to be rewritten to use REPLACE_TEXTUALLY properly. I started this but there are at least a few dozen scripts affected, so I don't know if I'll be able to finish it. But at least there'll be code examples if someone else wants to finish it.

(Also BP still overwrites a number of vanilla resources, but I guess that's been a known issue for some time...)

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#72 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 27 May 2010 - 06:33 AM

Heya everyone! :cheers:

I dunno if this is needed, but I'd found some typos in the BPv179 and BPSeries class scripts (minor ones at that :)) ... Was gonna attach them along with everything else I found somewhat a month later in the "BWP Fixes Thread" but if BP's gonna get a revision, it might be better to have a look at these now :P

Stuff changed:
XPOTN008 -> XPOT008
CDSXVHLA -> CDXVHLA
CDIXVHEL6 -> CDXVHEL6

Thanks!

Attached Files


"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#73 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 29 May 2010 - 04:11 AM

So maybe it took more than three days, but now the new patches for the mxspl tables are done. The bulk of the code comes in two parts. The first part only concerns itself with writing values that are greater than or equal to the vanilla values. It can not write values that are lower than what's already there. The second part writes values that are lower than the vanilla values. After it is done with that, it goes over the table columns and makes sure there are no cases where the spell progression decreases with increasing levels. If it finds a case like that, it decreases the value of the lower-level row to match the value of the high-level row.

The code can be installed on top of other changes to the mxspl tables (I've tested with the G3 Tweakpack tables and tables with 10 in every table cell). I've diffed the output with that of the old code as aside from a few bugs in the old code*, the output is identical.

*The patch for mxsplran doesn't cover level 40 and the patch for mxsplsrc writes incorrect values at level=19, spell_level=7 and level=21, spell_level=8.

The one weakness I can think of is the column additions to mxsplpal and mxsplran. The new code still uses the old-code predefined columns, so the patch can still fail if someone's added more rows (e.g. by making rangers and paladins get spell slots earlier).

The code itself:
Spoiler


It will work as I've written it, but if you've got some place you'd rather put the macros and the function you can obviously move it around. I didn't bother with copying it into the BP tp2 and diff that etc, but the new code is intended as a replacement for all the mxspl patches, from mxspldru to mxsplwiz.

Edited by Wisp, 29 May 2010 - 04:13 AM.


#74 horred the plague

horred the plague

    Scourge of the Seven Seas

  • Modder
  • 1899 posts

Posted 05 June 2010 - 01:50 PM

I ended up fixing a couple of things like the patch glitches in the Crypt King component, since it looked like no one else had gotten to it. Then I fixed similar things in the Shade Lord patching to prevent glitches like this. Though that may not be BP hosing the CRE originally but some mod like TS, but anyhow, any subsequent patches done by BP or another mod are going to hose the CRE even further if it is already. Which makes me think maybe we should throw Nythrun's CRE-fixing macros in here as well. Fixed this as well, which involved a assigning a couple of DVs in the tp2 but also decompiling some of those script snippets so I could fix them. I decompiled all the BCSes while I was at it. No reason not to have them as BAFs - they're human-readable and actually take up less space than the compiled versions for the most part.

Fixed some other glitches while I was in there:
- Added TWOHANDED to any EQUIP weapon patches that should have them
- Made sure stackable ADD/REPLACE_CRE_ITEMs have at least one charge to prevent crashes (usually multiples of 10 in the case of normal arrows, bullets, etc.)
- Added #8 to several WRITE_ASCII values that should have them, to prevent hosed CREs
- Used modern WeiDU commands (ADD_MEMORIZED_SPELL, SET_BG2_PROFICIENCY, REMOVE_CRE_ITEM, LPF ADD_CRE_EFFECT, etc.) to prevent patch errors.
- Implemented missing patches from spells.tbl, prof_eff.tbl, itm_rmv.tbl and discontinued those tables (no longer necessary with modern commands)
- Replaced INVALID ITEM comments with sensible values where practical

Wasn't really planning on doing a full overhaul, but a couple of those fixes resulted in changing the tp2 rather significantly. It should be easy to add any table patches you're doing, since I'm not messing with those (and don't really plan on it - it is enough going through all the CRE patches). Just want to make sure I'm not stepping on anyone else who's updating the tp2 currently.

There is something else fairly significant that needs to be fixed, unless I'm quite mistaken. AFAIK, syntax like this won't work as intended:

COPY_EXISTING ~AR0501.BCS~ ~override~
  REPLACE_TEXTUALLY ~BPv179/SNIP/oAR0501.BCS~ ~BPv179/SNIP/nAR0501.BCS~
BUT_ONLY
I should say it won't work at all, because it'll try to replace that actual string in those scripts, not the contents of the BCS snippets. It may have worked with REPLACE_BCS_BLOCK at one time, but only if it could find those exact blocks, and only if some other mod didn't change them. So they'll need to be rewritten to use REPLACE_TEXTUALLY properly. I started this but there are at least a few dozen scripts affected, so I don't know if I'll be able to finish it. But at least there'll be code examples if someone else wants to finish it.

(Also BP still overwrites a number of vanilla resources, but I guess that's been a known issue for some time...)



I don't suppose you have one of these 'working examples' for perusal? I have time to do this today, and only today, and only got the time at the last minute. Sorry for rushing, but that's my life at present.

In the meantime, I'm reverting these back to the original replace code. It wasn't me that made the change. And I'd rather see some blocks work than none at all.

Edited by horred the plague, 05 June 2010 - 01:54 PM.


#75 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 05 June 2010 - 02:44 PM

I don't suppose you have one of these 'working examples' for perusal? I have time to do this today, and only today, and only got the time at the last minute. Sorry for rushing, but that's my life at present.

Sure, here's the vanilla script block for announce.bcs:
IF
  Global("DestroyAnnouncer","AR0406",1)
THEN
  RESPONSE #100
    CreateCreature("WOLFWI01",[2924.1372],12)
    CreateCreature("DSBODY01",[2638.1588],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
    CreateCreature("DSTHIEF",[2735.1598],12)
    CreateCreature("DSBODY01",[2831.1361],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
    DestroySelf()
END
BP wants it to look like this:
IF
  Global("DestroyAnnouncer","AR0406",1)
  DifficultyGT(EASIEST)
THEN
  RESPONSE #100
    CreateCreature("WOLFWI01",[2850.1300],4)
    CreateCreature("WOLFWI01",[2850.1350],4)
    CreateCreature("WOLFWI01",[2924.1372],4)
    CreateCreature("DSBODY01",[2638.1588],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
    CreateCreature("DSTHIEF",[2735.1598],12)
    CreateCreature("DSBODY01",[2831.1361],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
    CreateCreature("OGRE01",[2625.1125],4)
    CreateCreature("OGRE01",[2700.1150],4)
    CreateCreature("OGRE01",[2775.1125],4)
    CreateCreature("OGRMAG01",[2800.1200],4)
    DestroySelf()
END
Here's the previous code, that may or may not work with REPLACE_BCS_BLOCK depending on whether other mods have changed that block:
COPY_EXISTING ~ANNOUNCE.BCS~        ~override~
  REPLACE_TEXTUALLY ~BPv179/SNIP/oANNOUNC.bcs~ ~BPv179/SNIP/nANNOUNC.bcs~
BUT_ONLY_IF_IT_CHANGES
Here's the code to get it to work properly with REPLACE_TEXTUALLY:
COPY_EXISTING ~announce.bcs~        ~override~
  DECOMPILE_BCS_TO_BAF
    REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH ~Global("DestroyAnnouncer","AR0406",1)~
    ~Global("DestroyAnnouncer","AR0406",1) DifficultyGT(EASIEST)~
    REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH ~CreateCreature("WOLFWI01",[2924.1372],12)~
    ~CreateCreature("WOLFWI01",[2850.1300],4) CreateCreature("WOLFWI01",[2850.1350],4) CreateCreature("WOLFWI01",[2924.1372],4)~
    REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH ~CreateCreature("DSBODY01",[2831.1361],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />~
    ~CreateCreature("DSBODY01",[2831.1361],<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' /> CreateCreature("OGRE01",[2625.1125],4) CreateCreature("OGRE01",[2700.1150],4) CreateCreature("OGRE01",[2775.1125],4) CreateCreature("OGRMAG01",[2800.1200],4)~
  COMPILE_BAF_TO_BCS
BUT_ONLY_IF_IT_CHANGES
Basically, the main difference is you're replacing individual lines rather than entire blocks, so it's more "surgical" of a patch. A side effect is you can now dump all the o*.bcs/n*.bcs blocks in the mod folders, since they're now handled by the tp2.

If you want to take a stab at this, can you let me know where you get to? 'Cause if you don't get through the all, I can probably get through the rest once I'm done with patching the remaining items and spells.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#76 horred the plague

horred the plague

    Scourge of the Seven Seas

  • Modder
  • 1899 posts

Posted 05 June 2010 - 04:14 PM

If you want to take a stab at this, can you let me know where you get to? 'Cause if you don't get through the all, I can probably get through the rest once I'm done with patching the remaining items and spells.


Thanks for the example. Though I can see this is 'almost as prone' to the same issues as REPLACE_BCS_BLOCK, it has better odds of success. Not quite the way I was doing it...my attempts were basically the same code as the o/n previous blocks (using textually to replace whole blocks not lines). But I see where this could be a problem if you had several identical lines in various blocks of the same script.

As you have other stuff in the works for BP, perhaps I should release this v180 so you can see where it stands, and build from a common page. I did a couple of things you probably didn't anticipate (decisions only the modmaker can make i.e.), and I'm betting there are plenty in the community that will want these changes I've got to offer. It installs with only two warnings (two ascension D files, complaints about weights and I swear I don't see WTF it's talking about in either the 'before' or 'after' files) on a vanilla install. I'm testing with BWP next, as a couple of my changes were done w/ that community in mind. If that goes well, I'll drop BPv180 later this eve or tomorrow.

Edited by horred the plague, 05 June 2010 - 04:21 PM.


#77 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 05 June 2010 - 09:02 PM

Thanks for the example. Though I can see this is 'almost as prone' to the same issues as REPLACE_BCS_BLOCK, it has better odds of success. Not quite the way I was doing it...my attempts were basically the same code as the o/n previous blocks (using textually to replace whole blocks not lines). But I see where this could be a problem if you had several identical lines in various blocks of the same script.

Aye, you need to use a unique line that won't be replicated or delimit it such with whitespace (which is tricky, but there's a trick for that too borrowed from the fixpack folks) so that it takes only a certain line and replaces it. If you find any like that, that look problematic to patch, I can probably write those via codesnatching from other mods (mine and others). Also am looking at making sure that the patch doesn't get applied if some other mod's already applied it (tracking that here, should have a solution soonish). So I think it can be a foolproof way of patching scripts, because REPLACE_BCS_BLOCK will just skip and give a warning if it doesn't find the exact block it's looking for (though as they say, "make it foolproof and they'll make a bigger fool" but, heh, that'll always be the case :D).

As you have other stuff in the works for BP, perhaps I should release this v180 so you can see where it stands, and build from a common page. I did a couple of things you probably didn't anticipate (decisions only the modmaker can make i.e.), and I'm betting there are plenty in the community that will want these changes I've got to offer. It installs with only two warnings (two ascension D files, complaints about weights and I swear I don't see WTF it's talking about in either the 'before' or 'after' files) on a vanilla install. I'm testing with BWP next, as a couple of my changes were done w/ that community in mind. If that goes well, I'll drop BPv180 later this eve or tomorrow.

Cool enough, I can always diff our files with PSPad's TextDiff feature, which makes it fairly easy to view and incorporate any changes. If you want to post the DEBUG messages you got from those install warnings, maybe we can eliminate them.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle