// Flesh wall tentacle (a friend, 2026-10-11). Hidden inside the wall; when someone comes within RANGE in // front of the wall it bursts out of the maw along a writhing curve toward them, holds, and pulls back. Now and then // it pokes out a little on its own. Segments are placed every tick along a quadratic curve with a travelling wave. // A hit (tip within HIT_DIST of the avatar) sends link message "TENTACLE_HIT" with the avatar's key, and, if // USE_EXPERIENCE is TRUE and this script is compiled with the land's Experience, teleports them to DEST. // Owner /7: on, off, lunge, reset. Links: wall root, "seg0".."segN-1", "tip". Claude Opus 5.5 (Tessel). integer USE_EXPERIENCE = FALSE; string DEST_LANDMARK = ""; // a landmark in this object's contents, or "" for DEST_POS in this region vector DEST_POS = <128, 128, 30>; vector DEST_LOOK = <1, 0, 0>; float REACH = 5.0; // longest the tentacle gets (m) float RANGE = 7.0; // how close someone must be to trigger it float HIT_DIST = 0.9; float R0 = 0.55; // thickness at the wall float R1 = 0.11; // thickness near the tip vector BASE = <0.22, 0, -0.3>; float DT = 0.05; list segL; integer TIP; integer N; integer armed = TRUE; integer mode; // 0 idle, 1 lunge, 2 hold, 3 retract, 4 twitch float t0; float ext; vector aim; key victim; integer hitDone; float nextTwitch; float coolUntil; integer link_named(string n) { integer i = llGetNumberOfPrims(); for (; i > 1; --i) if (llGetLinkName(i) == n) return i; return 0; } vector bez(vector a, vector b, vector c, float u) { float v = 1 - u; return a * (v * v) + b * (2 * v * u) + c * (u * u); } hide() { list p = []; integer i; for (i = 0; i < N; ++i) p += [PRIM_LINK_TARGET, llList2Integer(segL, i), PRIM_POS_LOCAL, BASE - <0.32, 0, 0>, PRIM_SIZE, <0.2, 0.2, 0.05>, PRIM_ROT_LOCAL, llEuler2Rot(<0, PI_BY_TWO, 0>)]; if (TIP) p += [PRIM_LINK_TARGET, TIP, PRIM_POS_LOCAL, BASE - <0.32, 0, 0>, PRIM_SIZE, <0.05, 0.05, 0.05>]; llSetLinkPrimitiveParamsFast(LINK_ROOT, p); } pose(float e, vector tipL) { if (e < 0.02) { hide(); return; } float now = llGetTime(); vector P0 = BASE; vector P2 = BASE + (tipL - BASE) * e; vector d = P2 - P0; float L = llVecMag(d); vector dir = d / L; vector side = dir % <0, 0, 1>; if (llVecMag(side) < 0.1) side = <0, 1, 0>; side = llVecNorm(side); vector up = llVecNorm(side % dir); // the bow of the curve sways; a wave travels down the length on top of it vector P1 = P0 + d * 0.45 + side * (0.3 * L * llSin(now * 3.1)) + up * (0.2 * L * llCos(now * 2.3) + 0.12 * L); float wav = 0.09 * L; list p = []; vector a = P0; integer i; for (i = 0; i < N; ++i) { float u = (float)(i + 1) / N; vector b = bez(P0, P1, P2, u) + side * (wav * u * llSin(u * 9.4 - now * 7.0)) + up * (wav * 0.6 * u * llCos(u * 7.0 - now * 5.0)); vector s = b - a; float len = llVecMag(s) * 1.18 + 0.02; float r = R0 + (R1 - R0) * ((float)i / N); if (e < 0.3) r *= 0.5 + e / 0.6; p += [PRIM_LINK_TARGET, llList2Integer(segL, i), PRIM_POS_LOCAL, (a + b) / 2, PRIM_SIZE, , PRIM_ROT_LOCAL, llRotBetween(<0, 0, 1>, s)]; if (i == N - 1 && TIP) { vector sd = llVecNorm(s); p += [PRIM_LINK_TARGET, TIP, PRIM_POS_LOCAL, b + sd * 0.17, PRIM_SIZE, , PRIM_ROT_LOCAL, llRotBetween(<0, 0, 1>, sd)]; } a = b; } llSetLinkPrimitiveParamsFast(LINK_ROOT, p); } vector tip_world() { if (!TIP) return llGetPos(); return llList2Vector(llGetLinkPrimitiveParams(TIP, [PRIM_POSITION]), 0); } // the target in the wall's frame, no further than REACH from the maw vector local_aim(vector world) { vector l = (world - llGetPos()) / llGetRot(); vector off = l - BASE; if (llVecMag(off) > REACH) off = llVecNorm(off) * REACH; if (off.x < 0.5) off.x = 0.5; return BASE + off; } on_hit(key av) { hitDone = TRUE; llMessageLinked(LINK_SET, 0, "TENTACLE_HIT", av); if (USE_EXPERIENCE) llRequestExperiencePermissions(av, ""); } go(integer m) { mode = m; t0 = llGetTime(); llSetTimerEvent(DT); } lunge(key who) { victim = who; hitDone = FALSE; vector p = llList2Vector(llGetObjectDetails(who, [OBJECT_POS]), 0); aim = local_aim(p); go(1); } default { state_entry() { segL = []; integer i = 0; while (link_named("seg" + (string)i)) { segL += link_named("seg" + (string)i); ++i; } N = llGetListLength(segL); TIP = link_named("tip"); mode = 0; ext = 0; hide(); llListen(7, "", llGetOwner(), ""); llSensorRepeat("", NULL_KEY, AGENT, RANGE, PI, 0.5); nextTwitch = llGetTime() + 6 + llFrand(6); llSetTimerEvent(0.5); } on_rez(integer n) { llResetScript(); } changed(integer c) { if (c & CHANGED_OWNER) llResetScript(); } listen(integer ch, string name, key id, string msg) { msg = llToLower(llStringTrim(msg, STRING_TRIM)); if (msg == "on") armed = TRUE; else if (msg == "off") { armed = FALSE; if (mode == 1 || mode == 2) go(3); } else if (msg == "lunge") lunge(id); else if (msg == "reset") llResetScript(); } sensor(integer n) { if (!armed || mode == 1 || mode == 2 || mode == 3 || llGetTime() < coolUntil) return; integer i; for (i = 0; i < n; ++i) { vector l = (llDetectedPos(i) - llGetPos()) / llGetRot(); if (l.x > 0.4) { lunge(llDetectedKey(i)); return; } // only people in front of the wall } } timer() { float now = llGetTime(); float t = now - t0; if (mode == 0) { if (armed && now > nextTwitch && now > coolUntil) { aim = BASE + <1.4, llFrand(1.2) - 0.6, llFrand(0.8) - 0.2>; go(4); } return; } if (mode == 1) // burst out, still tracking them { if (victim != NULL_KEY) { list od = llGetObjectDetails(victim, [OBJECT_POS]); if (od != []) aim = local_aim(llList2Vector(od, 0)); } float s = t / 0.45; if (s > 1) s = 1; ext = 1 - (1 - s) * (1 - s) * (1 - s); pose(ext, aim); if (!hitDone && victim != NULL_KEY) { list od2 = llGetObjectDetails(victim, [OBJECT_POS]); if (od2 != [] && llVecDist(tip_world(), llList2Vector(od2, 0)) < HIT_DIST) on_hit(victim); } if (s >= 1) go(2); } else if (mode == 2) // writhe in the air { pose(1.0, aim + <0, 0.25 * llSin(now * 4), 0.2 * llCos(now * 3)>); if (t > 1.6) go(3); } else if (mode == 3) // pull back in { float s3 = t / 0.9; if (s3 > 1) s3 = 1; ext = 1 - s3 * s3; pose(ext, aim); if (s3 >= 1) { mode = 0; ext = 0; hide(); coolUntil = now + 3; nextTwitch = now + 8 + llFrand(8); llSetTimerEvent(0.5); } } else if (mode == 4) // a curious poke { float s4 = t / 1.8; if (s4 > 1) s4 = 1; pose(0.75 * llSin(PI * s4), aim); if (s4 >= 1) { mode = 0; hide(); nextTwitch = now + 7 + llFrand(9); llSetTimerEvent(0.5); } } } experience_permissions(key av) { llTeleportAgent(av, DEST_LANDMARK, DEST_POS, DEST_LOOK); } experience_permissions_denied(key av, integer reason) { } }