Hi,
I think I have discovered a couple of bugs, or at least one bug and one quirk with OBSEv19.
The most serious first:
In HUD Status Bars, I have the following code that is called if GetGameLoaded returns true:
RemoveEventHandler "OnHit" HUDfindCurrentEnemy RunBatchScript "Data\ini\HUD Status Bars.ini" ... if tnoHSB.trackEnemy DebugPrint "HSB:Need to track current enemy" SetEventHandler "OnHit" HUDfindCurrentEnemy object::PlayerRef endif
The reading of the ini file initates a few functions, one of them detecting if an event handler is neeed, by setting tnoHSB.trackEnemy. Now, as you may see, this script will call RemoveEventHandler once per savegame load, even if SetEventHandler has never been called. From the docs, it seems OK, and ingame it works fine too.
But that's as long as HSB is the only loaded mod that uses event handlers. I got report of freeze if HSB was used with Class Advantages, so I checked out CA and found that it has a GetGameReloaded block that adds 4 or 5 event handlers, all but one of them "OnHit" handlers with no filter at all. And what happens is that if HSB's RemoveEventHandler line is called after CA has added event handlers, the RemoveEventHandler causes instant freeze. E.g.:
Ex 1:
1. Start game and load first savegame
2. CA is initialized and adds its event handlers
3. HSB is initalized and calls RemoveEventHandler, causing instant freeze
Ex 2:
1. Start game and load first savegame
2. HSB is initalized and calls RemoveEventHandler, then adds event handler
3. CA is initialized and adds its event handlers
4. Game works OK
5. A savgeame is loaded
6. HSB's GetGameLoaded is called, thus calling RemoveEventHandler while CA's event handlers are in place - causing instant freeze
I also checked this with Skycaptain and his Deadly Reflex 6 which adds event handlers, and HSB's RemoveEventHandler line causes freeze there too. I of course rewrote the code to add one event handler in the GetGameRestarted block that I never removed, which fixed the problem for me (and next version of HSB), but I guess this can cause more problems in the future.
The second, less serious is GetBarterItem again
It turns out that when activating a trade, when the quantity menu gets opened, GetBarterItem continues to return correct item if the trade was initiated with the mouse, but starts returning 0 if initiated with the keyboard. I also think (from reports) that it
sometimes return 0 when the quantiry menu gets opened even if the mouse is used, but I wasn't able to re-cerate this myself. But I was able to work around it, by using one help variable tht I set to the value of GetBarterItem, but only if GetBarterItem returns a real formId, and use that variable when the quantity menu gets opened. So the function is useful to me, but the documenation should probably say that it cannot be trusted when the quantity menu is open.