Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Couple of things have me stymied....

Owner Maltese
Registered User
Join date: 13 Sep 2005
Posts: 65
11-28-2005 07:47
I'm trying to write a script where the owner gives permission for someone to give verbal commands to the object. There is no posing involved so there is no permissions there. What confuses me is how someone can say the name of the avatar and it becomes a string or key variable.

Also, I'm trying to build an object with two prims: One prim is seen and worn somewhere on the body, the other prim is attached to the HUD so only the owner sees it.

Any ideas on how to do both?

Thanks in advance...
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
11-28-2005 09:41
You want a sensor for that first problem. Give it the name, feed the name to the sensor function, and extract the detected key from the sensor event.

Something like:
CODE

key person;
listen(integer channel, string name, key id, string msg)
{
llSensor(msg,"",AGENT,10.0,PI);
}
sensor(integer tot_num)
{
person = llDetectedKey(tot_num);
}


Yah, that's just a snippet, but it should at least give you a clue how to write something that does what you want.
_____________________
(You): Aww! My pants won't rez! Does this texture look okay on me?

Incidental Radio :: Because nothing is by design
Now featuring Torley-tastic technomusic!
Lit Noir
Arrant Knave
Join date: 3 Jan 2004
Posts: 260
11-28-2005 10:41
If the person you are giving permission to is in range of the sensor when you give permission, Padraig's solution will work. If not, I would just store the name in a list (not worrying about keys), and in the listen event check to see if the speaking av is in the "permitted" list with llListFindList. If not -1, they are permitted, so do the action. Of course if only one person would ever have permission at any given time, then a string would work and would be a bit quicker execution wise. Course, you will need to be damn careful about spelling, might be good to use llToLower or llToUpper so weird capitalization doesn't mess you up.

As for the second problem, I strongly suspect you can't do that, they would have to be unlinked prims so the wouldn't be able to use link messages to communicate. I could be wrong, haven't messed with HUDs much yet, but I would be VERY surprised.