Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Person in prime

fr0b Assia
Registered User
Join date: 6 Jun 2005
Posts: 10
06-20-2005 17:20
I am trying to make my script ONLY listen to people standing within a phantom prime.. but can not see to get it to work.

Working on a simple teleport script that will move a person UP or DOWN when they said UP or DOWN.. right now you have to "touch" the prime or else it works on everyone in range.. any help?
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
06-20-2005 18:14
llVolumeDetect might be what you're looking for, but if you want the teleporter to only affect specific people, you need to isolate the speaker's key, and then act only on it.

If you post your code, I can offer some more specific pointers.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
06-22-2005 20:16
By the way, it's prim, for primitive: Not prime.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
06-22-2005 22:07
I do agree with Zindorf, "prime" reads more like "prime number" then it does "rez a prime" in my mind.

But I digress :)

Here's some sample code to get you started:
CODE

integer listenHandle;
list teleportableAvatars;
default {
state_entry() {
llVolumeDetect(TRUE);
}

collision_start(integer numDetected) {
// Someone entered the teleporter.
llListenRemove(listenHandle); // Make sure we only have 1 listen set up.
listenHandle = llListen(0, "", NULL_KEY, "");
integer i;
for (i = 0; i < numDetected; ++i) { // For every thing colliding with me.
string dName = llDetectedName(i);
// Make sure we dont already have this thing in the list.
if (llListFindList(teleportableAvatars, [dName]) == -1
&& (llDetectedType(i) & AGENT)) { // And that the thing is an avatar.
teleportableAvatars += dName;
}
}
}

collision_end(integer numDetected) {
// Someone left the teleporter.
integer i;
for (i = 0; i < numDetected; ++i) {
string dName = llDetectedName(i);
integer index = llListFindList(teleportableAvatars, [dName]);
if (index != -1) {
teleportableAvatars = llDeleteSubList(teleportableAvatars, index, index);
}
}
// If there's no one to teleport
if (llGetListLength(teleportableAvatars) == 0) {
llListenRemove(listenHandle); // Get rid of the listen, we dont need it.
}
}

listen(integer channel, string name, key id, string message) {
if (llListFindList(teleportableAvatars, [name]) != -1) {
// Then the speaker is within the teleporter.
// Do teleporting stuff here.
}
}
}

==Chris