Thread: wallet
View Single Post
  #3  
Unread 04-19-2012, 11:07 PM
Niwashi's Avatar
Niwashi Niwashi is offline
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Feb 2011
Posts: 7
Ok, that's not much like what I'm doing, but going through the code I found where it adds the callback for "QuantityChanged" on each of the wallet items, and that piece looks straightforward enough. That at least should give me a trigger for knowing that something has happened.

Now the tricky part. I need to figure out what has happened. I can look up how many of the given item are in the wallet when the QuantityChanged event occurs, but in order to turn that into knowing how many were just added/removed, I would also need to know how many there had been just prior to the change.

In my initial draft of this Per Character Wallet plugin (which, as I mentioned before, just has the manual assignments so far) I first tried initializing what currencies are in the wallet when the plugin was loaded, but found there's nothing there then. I switched it to initializing the first time the user invokes the plugin, which works well enough for something that only has display and manual input. Of course, it won't work so well once event triggers are added into the mix. I have no way of knowing whether the player will look at the plugin before earning any barter currencies. Is there any point at which I can safely do initializations? Sometime after the game loads the wallet information (which apparently occurs after plugins are loaded), but before any point when the player might earn or spend wallet currency?
Reply With Quote