|
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
|
02-10-2007 06:33
Hi All,
I trying to work out howto list/send my inventory to my sql database
This is what I want to do: 1. Every time the inventory changes within the object it sends the inventory key of the new item using llGetInventoryKey to the sql database. 2. If the inventory item is removed from the object it removes the entry from the database.
I am happy with llHTTPRequest and communicating with my database well, but i am not sure how to output the inventory key... can anyone help..
Regards...
|
|
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
|
02-10-2007 06:38
The change event doesn't pass inventory keys. You'd have to keep a running list of keys, then loop through and see what has been added or removed.
Or your other solution is to, on every change event, invalidate your current MySQL inventory list and then loop through each item currently in inventory and upload that to the database.
|
|
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
|
02-10-2007 06:40
I'm also assuming you mean the Contents of a rezzed object, not your actual avatar inventory. The latter is completely inaccessible to script.
|
|
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
|
02-10-2007 08:13
Thanks for the quick reply, all i need to do now is work out how that is done...
Regards
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-10-2007 08:44
From: Lord Slazar Thanks for the quick reply, all i need to do now is work out how that is done...
Regards You can use the llGetInventoryNumber function to return the number of a specific inventory type and then use a for or while loop to iterate through integer number = llGetInventoryNumber(INVENTORY_TEXTURE); integr index; for(index = 0;index < number;index++) { string name = llGetInventoryName(INVENTORY_TEXTURE,index); key = id = llGetInventoryKey(INVENTORY_TEXTURE,index); }
If you actually need to know what has changed rather than the current contents then you will need to maintain a list locally, unless you are capable of having the MySQL database handle the filtering.
|
|
Lord Slazar
Registered User
Join date: 4 Dec 2006
Posts: 13
|
02-10-2007 09:29
rgr that thanks for the help..
|