// Tessel's cane: a worn, invisible prim that feels the ground ahead so I stop walking off ledges (2026-10-11: a pit // at Haven Hollows, Centauria's river twice). Owner says on channel 7735: "probe [HEADING_DEG] [DIST] [STEP]". // Heading is a compass bearing (0 = north, 90 = east); omitted = the way I'm facing. Casts rays down every STEP m out // to DIST m and owner-says "LEDGE||d1:dz1,d2:dz2,..." where dz is ground height relative to my feet ("X" = // no ground found within 40 m below, "?" = the sim refused the ray). bridge/sl.py `ahead` reads it. Claude Opus 5.5 (Tessel). integer CH = 7735; float zof(vector v) { return v.z; } float ground(vector p, float top) { list r; integer n = -1; integer tries; for (tries = 0; tries < 4 && n < 0; ++tries) // n < 0: the sim refused the cast (busy/throttled), not "no ground" { if (tries) llSleep(0.1 * tries); r = llCastRay(, , [RC_REJECT_TYPES, RC_REJECT_AGENTS, RC_DATA_FLAGS, RC_GET_ROOT_KEY, RC_MAX_HITS, 3]); n = llList2Integer(r, -1); } if (n < 0) n = 0; // refused: fall through to the terrain fallback integer i; for (i = 0; i < n; ++i) { key k = llList2Key(r, i * 2); if (k != llGetKey()) return zof(llList2Vector(r, i * 2 + 1)); } // No ray hit at all, not even terrain: seen 2026-10-11 in Salem 1692 and on a Grand Harbor clifftop where solid // ground was underfoot. Fall back to the terrain height (water counts as a drop, so rivers still warn). vector off = p - llGetPos(); float t = llGround(); float w = llWater(); if (w > t) t = w - 1.5; // open water: report it well below the surface if (t > top - 42) return t; return -9999; } default { state_entry() { llListen(CH, "", llGetOwner(), ""); llSetPrimitiveParams([PRIM_SIZE, <0.05, 0.05, 0.05>, PRIM_COLOR, ALL_SIDES, <1,1,1>, 0.0]); } on_rez(integer n) { llResetScript(); } listen(integer ch, string name, key id, string msg) { list w = llParseString2List(msg, [" "], []); if (llList2String(w, 0) != "probe") return; vector me = llGetPos(); // attachment root: the avatar's position vector size = llGetAgentSize(llGetOwner()); float feet = me.z - size.z / 2; float yaw; if (llGetListLength(w) > 1 && llList2String(w, 1) != "-") yaw = (90.0 - llList2Float(w, 1)) * DEG_TO_RAD; // compass bearing -> math angle else { vector f = llRot2Fwd(llGetRootRotation()); yaw = llAtan2(f.y, f.x); } float dist = 8; float step = 1; if (llGetListLength(w) > 2) dist = llList2Float(w, 2); if (llGetListLength(w) > 3) step = llList2Float(w, 3); vector dir = ; string out = ""; float d; for (d = step; d <= dist + 0.001; d += step) { vector p = me + dir * d; float z = ground(p, feet + 3); string v = "X"; if (z == -8888) v = "?"; // couldn't tell (2026-10-11: dense woods, all rays refused) else if (z > -9000) v = llGetSubString((string)(z - feet), 0, -5); if (out != "") out += ","; out += llGetSubString((string)d, 0, -5) + ":" + v; } llOwnerSay("LEDGE|" + llGetSubString((string)feet, 0, -5) + "|" + out); } }