// Big Mama Cow's Bell: clonks as you walk, faster when running, quiet when still. The clapper swings with each // clonk. Touch: menu (on/off, volume). Sounds made from scratch (gen_clank.py). Claude Opus 5.5 (Tessel), 2026-10-12, for a friend. key CLANK = "bdd6b6b9-4f39-40c3-4e3e-addcada5e1c5"; key SOFT = "ab0a3f42-d8e8-2799-ea21-a69774ad00ef"; integer on = TRUE; float vol = 0.4; integer CLAP; vector clapHome; float next; integer menuCh; integer lh; swing(float a) { if (!CLAP) return; rotation r = llEuler2Rot(); llSetLinkPrimitiveParamsFast(CLAP, [PRIM_POS_LOCAL, <0, 0, 0.004> + (clapHome - <0, 0, 0.004>) * r]); } default { state_entry() { integer i; for (i = 2; i <= llGetNumberOfPrims(); ++i) if (llGetLinkName(i) == "clapper") { CLAP = i; clapHome = llList2Vector(llGetLinkPrimitiveParams(i, [PRIM_POS_LOCAL]), 0); } llPreloadSound(CLANK); llPreloadSound(SOFT); llSetTimerEvent(0.12); } on_rez(integer p) { llSetTimerEvent(0.12); if (llGetAttached() == 0) llOwnerSay("Big Mama Cow's Bell: wear me (Neck or Chin; Edit to size and place me for your avatar). I clonk as you walk. Touch for on/off and volume."); } attach(key id) { if (id != NULL_KEY) { llOwnerSay("Clonk! (touch the bell for on/off and volume)"); swing(0); } } timer() { if (!on || llGetAttached() == 0) return; integer info = llGetAgentInfo(llGetOwner()); float now = llGetTime(); if (now < next) return; if (info & AGENT_WALKING) { float gap = 0.62; key s = SOFT; float v = vol * 0.7; vector vel = llGetVel(); if (llVecMag() > 3.5) { gap = 0.36; s = CLANK; v = vol; } gap *= 0.85 + llFrand(0.3); llPlaySound(s, v * (0.8 + llFrand(0.2))); float side = 0.45; if (llFrand(1) < 0.5) side = -0.45; swing(side); next = now + gap; llSleep(0.08); swing(-side * 0.4); } else if (info & (AGENT_FLYING | AGENT_IN_AIR)) next = now + 0.5; else swing(0); } touch_start(integer n) { key who = llDetectedKey(0); if (who != llGetOwner()) { llPlaySound(CLANK, vol); swing(0.6); return; } // anyone can give it a ding menuCh = -1 - (integer)llFrand(1000000); llListenRemove(lh); lh = llListen(menuCh, "", who, ""); string st = "off"; if (on) st = "on"; llDialog(who, "Cowbell is " + st + ", volume " + (string)llRound(vol * 100) + "%", ["On", "Off", "Ding", "Quieter", "Louder"], menuCh); llSetTimerEvent(0.12); } listen(integer ch, string name, key id, string msg) { if (msg == "On") on = TRUE; else if (msg == "Off") on = FALSE; else if (msg == "Ding") { llPlaySound(CLANK, vol); swing(0.6); } else if (msg == "Quieter") { vol -= 0.1; if (vol < 0.1) vol = 0.1; } else if (msg == "Louder") { vol += 0.1; if (vol > 1.0) vol = 1.0; } llListenRemove(lh); } }