Author Topic: Misbehaving persistent storage system  (Read 316 times)

Legacy_Chaszmyr

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Misbehaving persistent storage system
« on: March 04, 2015, 05:32:48 am »


               

Hello, I was wondering if anyone might be able to point me in the right direction with a misbehaving persistent item storage system.


 


To start with, here are both the OnOpen and OnClosed scripts in the same pastebin file: http://pastebin.com/eYh4qwv5


 


For starters, these are the same scripts this server has used for 10+ years. There have been three major iterations of the server; there was absolutely no misbehavior on the first (2002-2007) nor the second (2007-2012). Only after the final rework from 2012 onwards has it started misbehaving - the problem wasn't apparent immediately so I'm not sure if it was something related to the new version, but I guess it'd have to be.


 


The actual misbehavior comes in the form of stored items randomly being deleted or duplicated after a server reset and repopulation of the chests. I've even downloaded the database file, observed a chest with 2 listed items, opened the chest, saw 3 items (one was duplicated), closed the box, redownloaded it again, with the new number of 3 items in the DBF file. Somewhere the campaign object retrieval is going haywire, or the databases aren't being read right, or something.


 


Also, if it is of any interest, despite all persistent chests having been emptied while I consider the problem and possibly replace the system, the FPT file is still over 10 megabytes and has random item data for some reason. The DBF file has zero entries across the board. I would assume the FPT would empty out as items are retrieved.


 


I think I remember some reports of items randomly appearing where they shouldn't have as well, but I don't remember the circumstances clearly.


 


Either way, where could this problem be? We use NWNx2 but we're on good ol' base Bioware database stuff - no MySQL or SQL lite to speak of. 


 


I guess my question is twofold: how can I fix this, and if it can't be figured out, does anyone know of any alternatives, just some nice, simple OnOpen/Onclose storage doodads?


 


Any help would be greatly appreciated. Thank you in advance for your time!!



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #1 on: March 04, 2015, 02:13:46 pm »


               

You probably know Scarface's system? It is very easy to trim it and keep only the item storage part if you want. The system is fast and on my 24/7 server I did not experience a single problem so far, just so you know.


 


 


Kato 



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #2 on: March 04, 2015, 02:25:09 pm »


               

One thought is that there are now multiple chests with the same tag. With the code you posted that could lead to this kind of error.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #3 on: March 04, 2015, 06:02:36 pm »


               

First of all. DO NOT USE OnOpen and OnClose events for anything that might allow to dupe items. Whenever chest gets bugged these events doesnt work and it will result to items duping. And there is a trick how to bug chest on purpose. You need to use OnUse event for this really.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #4 on: March 04, 2015, 06:11:42 pm »


               


First of all. DO NOT USE OnOpen and OnClose events for anything that might allow to dupe items. Whenever chest gets bugged these events doesnt work and it will result to items duping. And there is a trick how to bug chest on purpose. You need to use OnUse event for this really.




 


Could you please elaborate, Shadooow? Sounds like I should further modify my current storage system...


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #5 on: March 04, 2015, 06:47:56 pm »


               


Could you please elaborate, Shadooow? Sounds like I should further modify my current storage system...




Chest can often get stuck, this can happen randomly and intentionally. When this happens OnOpen and OnClose events does not fire. This means that if you open the persistent chest and it loads items from database, you can make it stuck and OnClose event wont fire which means you can take items and they still will be in database (usually, if the system deletes items from database when OnOpen then this will not happen but nobody does that)


               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #6 on: March 04, 2015, 07:16:24 pm »


               


Chest can often get stuck, this can happen randomly and intentionally. When this happens OnOpen and OnClose events does not fire. This means that if you open the persistent chest and it loads items from database, you can make it stuck and OnClose event wont fire which means you can take items and they still will be in database (usually, if the system deletes items from database when OnOpen then this will not happen but nobody does that)




 


Ha, making a good note of this, thank you '<img'>


               
               

               
            

Legacy_Chaszmyr

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Misbehaving persistent storage system
« Reply #7 on: March 04, 2015, 08:25:59 pm »


               

I wasn't aware of Scarface's system - the new vault's search system frustrated me quickly because I continually came across NWN2 stuff and figured I'd ask since someone was bound to be able to point me in the right direction - thanks! I'll compare with that system and possibly just use that instead.


 


Unique tags for persistent chests are a thing we always keep an eye on, thankfully we've never had a mishap there.


 


I have seen a stuck chest a few times, that is a good point.


 


I'll be checking out Scarface's system, comparing to ours, and likely just flat out replacing ours with that one - hopefully it doesn't suffer from the same oddity, as I'm still not sure how standard Campaign Object functions and bioware database would suddenly go so wrong. Thanks everyone for your time! I'll keep watching the thread in case anything else pops up '<img'>