llSetObjectName when worn
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
12-12-2006 18:33
I have a prim that a user wears and, based on the timer event in my script, I detach it from them. I want the prim to only be used once - so when they attach, I check the name to see if it is "done". If it is, I immediately detach it. If not I change the the name to "done", let them use it and then detach it from them. If they try to attach again, it will fail the name inspection.
The problem is, it is not working the way I expect. While the prim is attached, I can tell that llSetObjectName worked because I have the object saying things for debug purposes and name in the chat says "done". However, after it detaches, the item in the inventory is still the old name. And when it is worn again, it is still the old name. So the llSetObjectName is not persisting.
Any thoughts?
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
12-12-2006 18:58
Or maybe I should ask this a different way. What do you all do when you only want something to be worn once? Do you use the prim name like I am or something else?
Frankly, I would rather just delete the prim rather than the whole exercise of "expiring" it. But llDie doesn't work on attachments. But maybe I am missing something there too?
|
|
Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
|
12-12-2006 20:12
A worn object does not keep name or description changes once you take it off. I will assume it is because You are now the Primary prim. Either way, I would wonder if you can have the objet do a llDie on detatch. I know I have a lightsaber hilt that when I twll it to detach it says to another hilt on my hip a command that makes it go from invisible to visible.
This probably didn't help you much and I am unsure how to help you further.
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
12-12-2006 20:30
>>A worn object does not keep name or description changes once you take it off.>>
Well, if this is true, at least I know I'm not doing anything wrong. I could always try a notecard, I suppose.
Actually, I'll try llDie on detach too but I can't imagine that will work. llDie supposedly doesn't work in an attachment and once it has passed back into inventory the script sort of suspends. But its worth a try.
Thanks, Perwin
|
|
Kitty Barnett
Registered User
Join date: 10 May 2006
Posts: 5,586
|
12-12-2006 20:53
You could take advantage of the not being able to reset scripts when the item is no-mod, which most of us hate  . default { state_entry() { }
attach(key attached) { if (attached) state worn; } }
state worn { state_entry() { }
attach(key attached) { if (attached) { llOwnerSay("This attachment can only be worn once, detaching."); llDetachFromAvatar(); } } }There's no guarantee of course that LL won't reenable being able to reset scripts on no-mod items in the future in which case the above wouldn't be quite fool-proof. If there's an invisible face on one of the prims that make up the object, you could do something sneaky such as change the texture on it when it's worn the first time. The texture key would tell you if the item has been worn before, and it would survive any script resets. [Edited to add that I just realized that getting the texture key requires the item to be full permission? The principle still applies though, you could resize the prim a little, change the colour on it, the texture offset, repeat, anything that's not visible to the user, but that can persistantly tell you that it's been worn already]
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-12-2006 21:45
From: Kitty Barnett [Edited to add that I just realized that getting the texture key requires the item to be full permission? The principle still applies though, you could resize the prim a little, change the colour on it, the texture offset, repeat, anything that's not visible to the user, but that can persistantly tell you that it's been worn already] Right, you could use llSetAlpha or llSetColor on the hidden face and check it. I divided it up into two scripts. Once it has been worn 5 seconds then the first script will kick in and change the face to alpha 0.1. Then no matter what you do, the second script will not work again after it is detached and attached again. Of course if anyone knows what your "code is, they could change it themselves in a modifyable object. No mod/no problem.
default{ attach(key attached) { if (attached){ llSleep(5.0); llSetAlpha(0.0,0); } } }
default{ attach(key attached) { if (attached){ if(llGetAlpha(0) == 0.0){ llOwnerSay("I am sorry but you will need to buy me now"); } else{ llOwnerSay("I am being worn first time"); } } } }
_____________________
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
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-12-2006 22:01
Hey! Thinking about this. For no copy, no mod objects, is there any reason this wouldn't work for trying on clothes?:
default{ attach(key attached) { if (attached){ llSleep(60.0); llOwnerSay("Trial period is over. You can detach me and discard now"); llSetAlpha(0.0,0); } } }
_____________________
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
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-12-2006 22:03
Is there any reason something like this wouldn't work for like even trying on clothes or hair in no copy/no mod objects:
default{ attach(key attached) { if (attached){ llSleep(60.0); llOwnerSay("Trial period is over. You can detach me and discard now"); llSetAlpha(0.0,0); } } }
_____________________
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
|
|
Kala Bijoux
Material Squirrel
Join date: 16 Nov 2004
Posts: 112
|
12-12-2006 23:21
How about this? state default state_entry if owner == creator, go to state running else lldetach/lldie/go to state no_more
state running attach go to state no_more
state no_more attach nag, detach
If this ever gets reset when in someone else's posession, it will detect it. This assumes you created the object. If not, you could check for the script's creator too, I think: llGetInventoryCreator(llGetScriptName())? Or something along those lines?
_____________________
http://materialsquirrel.blogspot.com/
|
|
Kitty Barnett
Registered User
Join date: 10 May 2006
Posts: 5,586
|
12-12-2006 23:23
I haven't tried, but having the script delete itself when detached might work as well.
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
12-13-2006 03:45
Good points, Jesse and Kitty - I guess there are a bunch of other properties that I could use. In my case, the prim is no mod - so yea, all properties are under my control only so they're safe.
I agree on the reset script approach - that could be risky if they decide to change that behavior.
Thanks!
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-13-2006 03:52
The other way would be to delete a configuration notecard sowhen rezzed it decides it cant configure itself and becomes inert that way.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-13-2006 04:03
From: Jesse Barnett Is there any reason something like this wouldn't work for like even trying on clothes or hair in no copy/no mod objects:
default{ attach(key attached) { if (attached){ llSleep(60.0); llOwnerSay("Trial period is over. You can detach me and discard now"); llSetAlpha(0.0,0); } } }
Cant wait to see a demo of lingerie with this feature.....
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-13-2006 06:19
From: Newgate Ludd Cant wait to see a demo of lingerie with this feature..... heehee. Yep, I could see lines of men hanging around the clothing stores..............
_____________________
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
|
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
12-13-2006 09:12
From: Jesse Barnett Is there any reason something like this wouldn't work for like even trying on clothes or hair in no copy/no mod objects: "No script" parcels. 
|
|
Dragon Eccleston
Registered User
Join date: 25 Dec 2005
Posts: 42
|
12-13-2006 11:29
From: Kitty Barnett You could take advantage of the not being able to reset scripts when the item is no-mod, which most of us hate  . default { state_entry() { if (llGetOwner() == "CREATORS KEY HERE") state wear; }
attach(key attached) { if (attached) { llOwnerSay("This attachment can only be worn once, detaching."); llDetachFromAvatar(); } }
state wear { state_entry() { }
attach(key attached) { } if (attached) llResetScript(); } }Fixed.
|