Ever notice how the stores on a PW have a tendency to accumulate treasure (sold by PCs) and run out of limited-quantity items (bought by PCs)? This script creates a reverse effect, removing items that were not in a store's original inventory and adding items from the original inventory that were sold out. Store gold (if limited) is also adjusted. You could call this a simulation of the store's NPC customers.
The restocking occurs several real-time hours after a store is opened while no restock is pending. This should be long enough to discourage a player from sitting around waiting for the restock to kick in.
One reason to use this script is so that you can limit the availability of certain items (by not having them available in infinite quantities), while not giving an advantage to those who log in right after a server reset (and immediately buy those limited quantities).
The time before a restock, the chances of items appearing and disappearing, and the acceptable range of gold can be set for the module by changing the appropriate constants in this script. If you want one of these to be different for a particular store, you can override the module setting with a local variable on the store.
The downloadable file, once unzipped, contains an importable version of this script. I named the script nw_d1_startstore even though that name is reserved by BioWare because BioWare's script of that name is a mere placeholder, and the place it holds is the OnOpenStore event handler for all the standard stores. That means that you do not have to modify those stores before they will use the imported script.
After unzipping, you have to import the .erf into your module. Once that is done, the standard stores will automatically use the script, but custom stores might need to have nw_d1_startstore manually specified as the OnOpenStore event handler.