|
Amaiur Babenco
Registered User
Join date: 30 May 2008
Posts: 3
|
10-15-2008 01:34
Hi, everyone!
I recently added a script from Revolution Perenti. Its a menu-driven script to select a given texture from a choice of several and it´s activated when the prim is touched. Trouble is that anyone can change the texture and I would like to know whether it would be possible that it worked only for me (as owner) plus someone else, so that only two people have access to the menu. Any help would be greatly appreciated. Thanks!
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
10-15-2008 02:06
When you respond to a dialog, it basically 'chats' your response on a hidden channel, so you need to filter whom your script listens to. There's a couple of ways to do it, but the most reliable thing to do is probably to create a list of 'authorised' avatars at the top of your script, like this: list authorisedavatars = [(key)"UUID", (key)"UUID"];
Replace the two UUID bits with the keys of your avatar and the other avatar you want to authorise. Next, find the "listen" event further down the script, and at the top of that, simply check to see if the person who is chatting is on the authorised list. If they are not, then you just stop that event. Something like this should work: if (llListFindList(authorisedavatars, [id]) < 0) return;
You might need to replace "id" with whatever the key parameter in the listen event is called (but make sure it has square brackets round it!). EDIT: whoops... forgot one minor point  ... you need to make it only display the menu to authorised avatars too. You can do that with the same code you put in the "listen" event, but replace "[id]" with "[llDetectedKey(0)]".
|
|
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
|
10-15-2008 02:06
hmmm... It's easy if you have mod perms. First, get your friend's key. Put this script in a new prim and make him/her touch it: defaut { touch_start(integer i) { llOwnerSay("key FriendKey = \"" + (string)llDetectedKey(0) + " \";" } } Copy and paste the chat line at the very beginning of the texture menu script; Then find the touch_start() event in it and insert this line just after the curly bracket. if ((llDetectedKey(0) != llGetOwner()) && (llDetectedKey(0) != FriendKey)) { return; } This is a big patch but it will work. To optimize things a little, check the touch_start() event, if there is line that looks like: something = llDetectedKey(0); Then, instead of a big patch, you can insert a smaller patch just after this line: if ((something != llGetOwner()) && (something != FriendKey)) { return; } Rinse and repeat... 
|
|
Talon Brown
Slacker Punk
Join date: 17 May 2006
Posts: 352
|
10-15-2008 02:12
Owner only is easy enough to do:
touch_start(integer total) { if (llDetectedKey(0) != llGetOwner()) return;
// Rest of the code here. }
Group only is easy enough as well:
touch_start(integer total) { if (!llSameGroup(llDetectedKey(0))) return;
// Rest of the code here. }
But if group only isn't sufficient and want it restricted to the owner and 1 other person, you'll need their key. Once you have that, it's still pretty simple:
//Define a global var at the top of the script key partner = "enter their key here";
touch_start(integer total) { key id = llDetectedKey(0);
if (id != llGetOwner() && id != partner) return;
// Rest of the code here. }
Edit: Beaten to death...
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
10-15-2008 02:14
Welcome to the Forums.
If you have source code for the script, it would be pretty easy to add a test in the touch_start() handler (or possibly touch_end... whichever is being used to trigger the menu) that checks if llDetectedName(0) == the name of either of the desired operators, and if not, just return from that event handler.
If you don't have source code... I think you're out of luck.
|
|
Amaiur Babenco
Registered User
Join date: 30 May 2008
Posts: 3
|
10-15-2008 02:45
Thanks, Pedro, Kaluura and Talon. I´ll try as soon as possible.
|
|
Amaiur Babenco
Registered User
Join date: 30 May 2008
Posts: 3
|
10-19-2008 01:45
Thanks to you all. It works great!
|