I watched the detection and collision script again and noticed some errors.
Sorry, I did not watch well the first time.
I made a new script for the iris to have a more beautiful and adjustable movement.
I have also revisited the collider that corrects these errors but also strengthens a little.
Iris Door v0.1 by djphil (CC-BY-NC-SA 4.0){L_CODE}:
// Iris Door v0.1 by djphil (CC-BY-NC-SA 4.0)
integer canal = -123456789;
float amount = 0.05;
float speed = 0.1;
integer ecoute;
float hollow;
default
{
state_entry()
{
llListenRemove(ecoute);
ecoute = llListen(canal, "", "", "");
}
listen(integer channel, string name, key id, string message)
{
if (message == "open")
{
while (hollow < 1.0 + amount)
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [
PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE,
<0.0, 1.0, 0.0>, hollow, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>
]);
hollow += amount;
llSleep(speed);
}
}
else if (message == "close")
{
while (hollow > 0.0 - amount)
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [
PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE,
<0.0, 1.0, 0.0>, hollow, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>
]);
hollow -= amount;
llSleep(speed);
}
}
}
}
Collider v0.1 by djphil (CC-BY-NC-SA 4.0){L_CODE}:
// Collider v0.1 by djphil (CC-BY-NC-SA 4.0)
integer canal = -123456789;
list avatars;
default
{
state_entry()
{
llSetAlpha(0.0, ALL_SIDES);
llVolumeDetect(TRUE);
}
on_rez(integer param)
{
llResetScript();
}
collision_start(integer n)
{
integer i;
for (i = 0; i < n; ++i)
{
key k = llDetectedKey(i);
if (llGetAgentSize(k) != ZERO_VECTOR)
{
if (!~llListFindList(avatars, [k]))
{
avatars += [k];
if (llGetListLength(avatars) == 1)
{
llSay(canal, "open");
}
}
}
}
}
collision_end(integer n)
{
integer i;
for (i = 0; i < n; ++i)
{
integer index = llListFindList(avatars, [llDetectedKey(i)]);
if (~index)
{
avatars = llDeleteSubList(avatars, index, index);
}
}
if (avatars == [])
{
llSay(canal, "close");
}
}
}
Enjoy!
