Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

keyed lock?

Tere Karuna
Registered User
Join date: 4 Jul 2004
Posts: 159
08-01-2008 14:28
Not having any look figuring out where to even start on this script....

I want a lock that checks if the player has the correct prim key item, I think can handle what lock then does, next it should tell player in chat they had correct key, and finally... send a email to inform me the lock was activated. Also is there way to make the key one use only?
_____________________
"ooohhhh we didnt know what we had till it was gone;
they paved secondlife and put up a shoping mall,
oooooo, ba ba ba....."
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-01-2008 14:44
There's no way to see if a resident has the key in inventory, but you can certainly setup a chat communication between the lock and the key if the key is ATTACHED to the resident's avatar. Then you can certainly have the key mark that it's been used (via a state changed or global variable or even by deleting the script from the object) and not function again, though you can't delete the key object itself if it is attached to the avatar (you'll obviously want to make sure the key is no-copy so the resident can't copy it in inventory before it is used). You CAN detach the key back to inventory using llDetachFromAvatar() even though you can't delete it entirely.
Tere Karuna
Registered User
Join date: 4 Jul 2004
Posts: 159
08-02-2008 11:00
that works for me :) which command should I be looking up in wiki.. unless a scripter out there wants a job ;)
_____________________
"ooohhhh we didnt know what we had till it was gone;
they paved secondlife and put up a shoping mall,
oooooo, ba ba ba....."
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-02-2008 13:46
Hmm. Well, catch up on your communication functions I guess: http://www.lslwiki.net/lslwiki/wakka.php?wakka=communications

You'll probably have something like:

1.) Resident touches / bumps into / approaches door (touch_start, collision_start, or collision_start w/ llVolumeDetect()).

2.) Door challenges for a key owned by resident (llWhisper(), llSay(), llRegionSay(), etc.).

3.) Key sees challenge message aimed at its owner. if it is attached, it responds to the door (llWhisper(), llSay(), llRegionSay(), etc.).

4.) Door sees challenge response from key and opens.

5.) (If you want the key to be single-use) Door acknowledges opening to key (llWhisper(), llSay(), llRegionSay(), etc.), probably including the UUID of the key whose challenge response message caused it to open. Key marks itself as used (change states in its function, llRemoveInventory(llGetScriptName()), set a global variable, etc.) and possibly detaches itself (llDetachFromAvatar()).
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
08-02-2008 15:55
From: Hewee Zetkin
5.) (If you want the key to be single-use) Door acknowledges opening to key (llWhisper(), llSay(), llRegionSay(), etc.), probably including the UUID of the key whose challenge response message caused it to open. Key marks itself as used (change states in its function, llRemoveInventory(llGetScriptName()), set a global variable, etc.) and possibly detaches itself (llDetachFromAvatar()).


Pity we have no llDieAttached
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura