These forums are CLOSED. Please visit the new forums HERE
Data Storage |
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-23-2009 12:22
i fixed the script in my post above if anyone's interested
_____________________
Dark Heart Emporium
http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020 want more layers for tattoos, specifically for the head? vote here http://jira.secondlife.com/browse/VWR-1449? llDetectedCollision* Functions similar to touch http://jira.secondlife.com/browse/SVC-3369 |
Klug Kuhn
Registered User
Join date: 7 Sep 2007
Posts: 126
|
09-23-2009 22:13
i think the most tricky part you were facing was to play around the notecards(NC) after inventory changed. It is a very common question arises when making vendor or rezzer, especially the rezzing version with which items to rez and to sell. To be able to update the vendor content automatically instead of hardcoding or re-write config NC by copy-and-paste the inventory names.
First off, any bit of content change detection will trigger the "changed(integer change)" event. For instance if you add or delete 5 NC at the same time, the content will be reloaded not only 1 time and the changed event will probably occur 4-5 times depends on the lag performance. This is very unstable and hard to follow which line is it up to. To overcome this issue, i usually use a separate script to handle this multiple content changes. Simply keep sending a message to itself and tells the script that "Oi!! Content change hasn't finished yet, don't do things until i say so". It will trigger a timer event in 2 sec (should be enough for the sake of lag) and send a link_msg notice to where i indeed need the content change event originally. Then there're 3 possibilities after a content change: - the number of NC remains unchanged, but one or more of the NC was edited and saved. - the number of NC increased. - the number of NC decreased. To achieve more script memory, beside the main NC update script, i've also made a storage script which holds all NC UUID(key). When the number of NC unchanged, the main script send all the NC keys to the storage script and compare which NC is edited/saved. As the number of NC changed, the main script will check which NC is added or deleted simply by comparing between the original NC list and the new NC list after content changed. The example below demos the use of the idea. To see how it works, drop the 3 scripts into a prim. Add as many NC as you like to the content as long as the script memory can handle, then when you add, delete or save any NC in the content. A owner message will tell you which and how much NC has been changed. You don't have to worry about the names or the order of the NC in the content. Afterward you could use the result whatever you like to create menus or upload NC etc. Hope you find it useful. ![]() CODE
CODE
CODE
|