Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rename object in inventory?

Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
10-12-2006 15:55
I've been looking all over this forum and on the wiki site and haven't been able to find the answer I want to find. I have a suspicion it isn't doable, I just need confirmation.

Through any combination of hacks, rezzing, re-rezzing, inventory giving, inventory getting, or any other what-have-you... is it possible to programmatically rename an inventory object while it is in the calling object's inventory?

For example, I have an item rezzed in world named MyGadget. Inventory drops are allowed via llAllowInventoryDrop(). If I drop object Object1 into MyGadget, is it possible for MyGadget to rename Object1 to Object2?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-12-2006 16:15
Sure you can do that. You can change Object name and also the object description.
Look up LLSetObjectName in the wiki.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
10-12-2006 16:26
No, it's not possible.

llSetObjectName() only sets the name of the prim the script is in... a script inside an object inside inventory/contents is NOT a running script. Therefore, that function won't change the name of a different object within the scripted object's contents.

Edit: it's probably possible for LL to change the name of an object within contents of another object.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-12-2006 20:24
Sorry. A case of forumitis(failure to thoroughly read the question and supplying a kneejerk response).

DoteDote is correct per the afore mentioned wiki:

"Q: How do I rename/copy/duplicate an item in my object's inventory?
A: You can't, though a script can delete items (even itself) with llRemoveInventory. "

But if I was to dissect your original question all the way then there is one more comment:

"is it possible for MyGadget to rename Object1 to Object2?"

IF two objects named exactly the same were dropped into inventory then SL would automatically add a space and then 1 to the end of the name in increments of one for each additional. Example:

Object1
Object1 1
Object1 2
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Reacher Rau
Reach Isles
Join date: 9 Mar 2007
Posts: 40
12-06-2008 15:54
the last post in this thread went unanswered, but it's a few years later now, so maybe there's a way -- i need to do something very similar, which is:

when I add a texture to a prim's contents, I need for it to overwrite the existing texture in there of the same name. currently, the new texture is renamed "Foo 1" while existing "Foo" is left untouched. i need the reverse behavior. the existing texture can even be deleted, i don't care, as long as the new texture ends up named "Foo".

i think this is a timing question- if my script uses say, the 'changed' event to detect new inventory, would i be able to delete the existing Foo texture before the new one is added? if so, i'd have what i need.

how would you solve this if you had to write such a script?

thanks.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-06-2008 17:20
From: Reacher Rau
the last post in this thread went unanswered, but it's a few years later now, so maybe there's a way -- i need to do something very similar, which is:

when I add a texture to a prim's contents, I need for it to overwrite the existing texture in there of the same name. currently, the new texture is renamed "Foo 1" while existing "Foo" is left untouched. i need the reverse behavior. the existing texture can even be deleted, i don't care, as long as the new texture ends up named "Foo".

i think this is a timing question- if my script uses say, the 'changed' event to detect new inventory, would i be able to delete the existing Foo texture before the new one is added? if so, i'd have what i need.

how would you solve this if you had to write such a script?

thanks.

The answer would still be no.

There is no "timing issue". The changed event is fired when the new texture is already added to the inventory, not before.

There is a way that we use to detect and delete multiples inside of inventory, such as in the new gen texture organizers. Build a list of the inventory items and then check one at a time to see if there is a duplicate. You have to be knowledgeable in both list and string manipulations to do it though.

Search the forum here. I remember a thread here a year or more ago where we did this.

Actually you can start here:

/54/6d/260897/1.html

& here:

/54/cf/148598/1.html
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
12-07-2008 06:59
From: Jesse Barnett


IF two objects named exactly the same were dropped into inventory then SL would automatically add a space and then 1 to the end of the name in increments of one for each additional. Example:

Object1
Object1 1
Object1 2



this also only works if it's done by the avatar, if it's passed thru a script, it ust overwrites the already existing one
_____________________
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
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
12-07-2008 21:53
Another way to do it is to use two prims with the main texture-holding prim hidden or not easily accessed. Use a script in the root prim that detects when inventory changes, determines if it was a texture, sends the name of the texture to the hidden prim.... if the hidden prim finds that name in its contents, it deletes it and sends a message back to the root prim... the root prim then gives the texture to the hidden prim... protecting the name.

Use llGetLinkKey() to get the key of the linked prim for use in llGiveInventory().
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
12-07-2008 23:06
Ooo! I like that idea. I've been trying to figure out how to script an object so that the user can drop a notecard into it, replacing a previous notecard without having to go into edit mode. I hadn't thought of a two-prim solution. Thank you.:D
Reacher Rau
Reach Isles
Join date: 9 Mar 2007
Posts: 40
12-07-2008 23:23
From: DoteDote Edison
Another way to do it is to use two prims with the main texture-holding prim hidden or not easily accessed. Use a script in the root prim that detects when inventory changes, determines if it was a texture, sends the name of the texture to the hidden prim.... if the hidden prim finds that name in its contents, it deletes it and sends a message back to the root prim... the root prim then gives the texture to the hidden prim... protecting the name.

Use llGetLinkKey() to get the key of the linked prim for use in llGiveInventory().

ok, this is a good idea, i think i'll try it.

what is the mechanism used to send messages between the 2 prims?
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
12-08-2008 06:48
Combining 2 posts above:
From: DoteDote Edison
Another way to do it is to use two prims with the main texture-holding prim hidden or not easily accessed. Use a script in the root prim that detects when inventory changes, determines if it was a texture, sends the name of the texture to the hidden prim.... if the hidden prim finds that name in its contents, it deletes it and sends a message back to the root prim... the root prim then gives the texture to the hidden prim... protecting the name.

Use llGetLinkKey() to get the key of the linked prim for use in llGiveInventory().

and
From: Ruthven Willenov
this also only works if it's done by the avatar, if it's passed thru a script, it ust overwrites the already existing one


You do not even need to test for existence. The receiving prim can pass it directly to the target prim and the original should be overwritten.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
12-08-2008 20:32
yep, but i did have an odd thing happen earlier, i was attempting to make a script copy itself to the rest of the link set. rather than running a loop, i put a if statement in the state entry, so that if it was less than the number of links it would give a copy of itself to the next prim. i found that didn't work because when a script is given by a script, the new copy isn't set to running. when i selected the object and clicked set scripts to running in selection. it then copied it's self to the next prim, etc etc. when i looked into a couple of prims, i saw that it had in fact made 2 copies "new script" and "new script 1" inside 1 prim. i got called to another project elsewhere and forgot about it. i was having lag issues and ended up crashing, and i haven't had the motivation to log back in to see if i can re-create that (no i didn't leave the object out, i picked it up before heading to the other project)
_____________________
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