And object with the same name ?
Thank you for your help

These forums are CLOSED. Please visit the new forums HERE
Delete Duplicate Texture by UUID or Object in a prims ? |
|
Kay Douglas
Registered User
Join date: 20 Feb 2007
Posts: 41
|
05-24-2008 17:04
If possible to delete duplicate texture on a prims by UUID ?
And object with the same name ? Thank you for your help ![]() |
Jesse Barnett
500,000 scoville units
![]() Join date: 21 May 2006
Posts: 4,160
|
05-24-2008 18:35
If possible to delete duplicate texture on a prims by UUID ? And object with the same name ? Thank you for your help ![]() Yes it is possible because some of the next gen texture organizers have that built in. But you will first need to learn a few different concepts dealing with manipulating lists. http://lslwiki.net/lslwiki/wakka.php?wakka=inventory Shows you all of the functions that deal with inventory, take note of llRemoveInventory. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
Kay Douglas
Registered User
Join date: 20 Feb 2007
Posts: 41
|
05-25-2008 09:55
I see many script on forum to delete object with the same name with llGetInventoryName but none for UUID.
I search this script on opensource, because i'm not a good developper Function list UUID Function compare UUID Function delete UUID Removing duplicate objects from a prim /54/c7/105034/1.html removing duplicates from a list /54/cf/148598/1.html Removing duplicates from a list ? /54/cb/47032/1.html Other function: Remove special characters from Object name and inventory /54/09/112500/1.html |
Newgate Ludd
Out of Chesse Error
![]() Join date: 8 Apr 2005
Posts: 2,103
|
05-26-2008 04:21
I see many script on forum to delete object with the same name with llGetInventoryName but none for UUID. I search this script on opensource, because i'm not a good developper Function list UUID Function compare UUID Function delete UUID Removing duplicate objects from a prim /54/c7/105034/1.html removing duplicates from a list /54/cf/148598/1.html Removing duplicates from a list ? /54/cb/47032/1.html Other function: Remove special characters from Object name and inventory /54/09/112500/1.html You would need to get the list of item names and then get the corresponding key using llGetInventoryKey. Then check each key for duplicates. However it seems that Duplicate names are now allowed (wheren't last time I was here!) which complicates matters. You would need to do two passes, once to remove duplicate names and then again to remove the duplicate uuids. _____________________
I'm back......
|
Day Oh
Registered User
![]() Join date: 3 Feb 2007
Posts: 1,257
|
05-26-2008 05:02
You would need to get the list of item names and then get the corresponding key using llGetInventoryKey. Then check each key for duplicates. However it seems that Duplicate names are now allowed (wheren't last time I was here!) which complicates matters. You would need to do two passes, once to remove duplicate names and then again to remove the duplicate uuids. If you found a way to have duplicate names, you should report it and mark it major before it breaks everything ever ![]() _____________________
![]() |
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
05-26-2008 06:12
no list needed to delete duplicate inventory entries.
long lists cause stack heap colisions, wich is FUN! put a loop in a loop, 2 values, entry a and b are being compared. --a goes from listlength to 0 in the outer loop ----when a changed && key_a !=NULL_KEY, b goes from a to 0. in the inner loop ------if (key_b!=NULL_KEY && key_a == key_b){ remove b from inventory. b--} theres a problem, that NULL_KEY can be returned due to lack of permissions to read the key, so you either keep all inventory items that lack permissions to return their key (as above), or you remove them all (likely a bad idea, likely better to have a different provedure to remove some NULL_KEYs within other criteria if you want to). |
Newgate Ludd
Out of Chesse Error
![]() Join date: 8 Apr 2005
Posts: 2,103
|
05-27-2008 03:30
If you found a way to have duplicate names, you should report it and mark it major before it breaks everything ever ![]() Playing around last night I managed to quite happily have 3 textures in a prim with what appeared to be exactly the same name "Snapshot : snapshot". This is markedly different from the previous naming convention and since I have been away for sometime I assumed this was just new behaviour. _____________________
I'm back......
|
Day Oh
Registered User
![]() Join date: 3 Feb 2007
Posts: 1,257
|
05-27-2008 06:17
Playing around last night I managed to quite happily have 3 textures in a prim with what appeared to be exactly the same name "Snapshot : snapshot". This is markedly different from the previous naming convention and since I have been away for sometime I assumed this was just new behaviour. It's seriously bad, you should write up an issue in JIRA, or IM me about it and I'll write one, before it confuses someone and causes widespread problems. See, because the inventory functions rely on the names being unique, what happens if you use llGiveInventory, llRemoveInventory, llGetInventoryKey, llRezObject, etc? To contribute to the OP's topic here's a script to delete items from object inventory if they point to the same asset default { state_entry() { key null_key = NULL_KEY; string self_name = llGetScriptName(); integer inventory_count = llGetInventoryNumber(INVENTORY_ALL); integer x = inventory_count - 1; string x_name; key x_key; integer y; string y_name; key y_key; do { x_name = llGetInventoryName(INVENTORY_ALL, x); x_key = llGetInventoryKey(x_name); y = inventory_count - 1; do { y_name = llGetInventoryName(INVENTORY_ALL, y); y_key = llGetInventoryKey(y_name); if((y_key != null_key) && (y_key == x_key)) { if((y_name != x_name) && (y_name != self_name)) { llRemoveInventory(y_name); } } } while(~--y); } while(~--x); llRemoveInventory(self_name); } } ew yucky yuck _____________________
![]() |
Kay Douglas
Registered User
Join date: 20 Feb 2007
Posts: 41
|
05-29-2008 05:46
Why the script are deleted ?
default { touch_start(integer total_number) { key null_key = NULL_KEY; string self_name = llGetScriptName(); integer inventory_count = llGetInventoryNumber(INVENTORY_ALL); integer x = inventory_count - 1; string x_name; key x_key; integer y; string y_name; key y_key; do { x_name = llGetInventoryName(INVENTORY_ALL, x); x_key = llGetInventoryKey(x_name); y = inventory_count - 1; do { y_name = llGetInventoryName(INVENTORY_ALL, y); y_key = llGetInventoryKey(y_name); if((y_key != null_key) && (y_key == x_key)) { if((y_name != x_name) && (y_name != self_name)) { llRemoveInventory(y_name); } } } while(~--y); } while(~--x); llRemoveInventory(self_name); } } I just add touch event. When the prims are touched the script it's executed. Thanks Day Oh ![]() |
Newgate Ludd
Out of Chesse Error
![]() Join date: 8 Apr 2005
Posts: 2,103
|
05-29-2008 15:36
Why the script are deleted ? Thanks Day Oh ![]() The idea was probably so you could drop this in a prim and it cleans up and then removes itself. _____________________
I'm back......
|
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
05-29-2008 16:32
beware. if asset servers are sucky they MAY return NULL_KEY or nonsensical keys and your script may find false matches and remove unique textures..
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-29-2008 17:41
beware. if asset servers are sucky they MAY return NULL_KEY or nonsensical keys and your script may find false matches and remove unique textures.. If you don't have full permissions on the texture the system will return NULL_KEY by design, so you can't tell if it is a duplicate and you should never remove one of those. It looks like the above script takes care of that logic though. |