|
Nerolus Mosienko
Registered User
Join date: 3 Aug 2006
Posts: 145
|
12-15-2006 17:58
Hello,
I'm helping with a build that calls for a script I can toss in a prim, so when one passes though said prim, they a notecard. I've searched around but I may be searching for the wrong tearms. I found one, but it seems to want to give it to anyone within 5m of the prim. I just need a tripwire type script.
Any help is greatly appreciated!
Nerolus
|
|
Floog Stuart
Registered User
Join date: 28 Jun 2006
Posts: 12
|
12-15-2006 20:14
default { state_entry() { llVolumeDetect(TRUE); } collision_start(integer num_detected) { llGiveInventory(llDetectedKey(0),"notecard"); } }
This should work I think.
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
12-16-2006 03:30
I'd expand that to: list lastAvatars; integer maxListSize = 20;
default { state_entry() { llVolumeDetect(TRUE); } collision_start(integer x) { while (x > 0) { // Go through all new collisions --x; key id = llDetectedKey(x); if (llListFindList(lastAvatars, [id]) < 0) { // Is this a new avatar? llGiveInventory(llDetectedKey(0), "notecard"); lastAvatars += [id]; // Add them to the recent avatars list } }
x = llGetListLength(lastAvatars) ; if (x > maxListSize) // Check the avatar list hasn't grown too large lastAvatars = llList2List(x - maxListSize, -1); } }
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Nerolus Mosienko
Registered User
Join date: 3 Aug 2006
Posts: 145
|
12-17-2006 04:11
Awesome! Thanks you two!
|
|
Tonny Turner
Registered User
Join date: 8 Jul 2005
Posts: 20
|
12-17-2006 08:09
From: Haravikk Mistral I'd expand that to: list lastAvatars; integer maxListSize = 20;
default { state_entry() { llVolumeDetect(TRUE); } collision_start(integer x) { while (x > 0) { // Go through all new collisions --x; key id = llDetectedKey(x); if (llListFindList(lastAvatars, [id]) < 0) { // Is this a new avatar? llGiveInventory(llDetectedKey(0), "notecard"); lastAvatars += [id]; // Add them to the recent avatars list } }
x = llGetListLength(lastAvatars) ; if (x > maxListSize) // Check the avatar list hasn't grown too large lastAvatars = llList2List(x - maxListSize, -1); } } ^^ doesnt work
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
12-17-2006 10:45
Argh pants, I posted the version from my inventory, must be out of date. Here's the live version I use: list lastAvatars; integer maxListSize = 20;
default { state_entry() { llVolumeDetect(TRUE); llMinEventDelay(0.5); } collision_start(integer x) { string note = llGetInventoryName(INVENTORY_NOTECARD, 0); // Get a notecard if (note != "") { while ((--x) >= 0) { // Go through all new collisions if (llDetectedType(x) & AGENT) { // Only avatars key id = llDetectedKey(x); if (llListFindList(lastAvatars, [id]) < 0) { // Is this a new avatar? llGiveInventory(llDetectedKey(x), note); lastAvatars += [id]; // Add them to the recent avatars list } } }
x = llGetListLength(lastAvatars) ; if (x > maxListSize) // Check the avatar list hasn't grown too large lastAvatars = llList2List(lastAvatars, x - maxListSize, -1); } } } This will use the first notecard in your object's inventory, if you need it to use a different one then replace the note variable with the name.
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|