Today’s scripts follow below the fold…
Part 1: detectors!
// Script 5.1 simple Collision detector default { collision_start(integer c) { llSay(0, "Bonk!, "+llDetectedName(0)); //llPushObject(llDetectedKey(0), <0,0,100>, <0,0,0>, TRUE); } }
// Script 5.2 Volumetric Collision detector default { state_entry() { llVolumeDetect(TRUE); } collision_start(integer c) { llSay(0, "Excuse me, "+llDetectedName(0)); } }
// 5.3 Simple sensor default { touch_end(integer c) { llSensor("", "", AGENT, 10.0, PI); } sensor(integer count) { integer i; for (i=0; i<count; i++) { llOwnerSay("I see "+llDetectedName(i)); } } }
Part 2: Inventory givers!
// 5.4 simple inventory giver vector WHITE=<1,1,1>; default { state_entry() { llSetText("Touch me for a present!", WHITE, 1.0); } touch_end(integer c) { llGiveInventory(llDetectedKey(0), "HappyBirthday"); } }
// 5.5 folder inventory giver vector WHITE=<1,1,1>; default { state_entry() { llSetText("Touch me for goodies!", WHITE, 1.0); } touch_end(integer c) { key lucky = llDetectedKey(0); list stuff = []; integer n = llGetInventoryNumber(INVENTORY_ALL); integer i; for (i=0; i<n; i++) { string item = llGetInventoryName(INVENTORY_ALL, i); if (item != llGetScriptName()) { stuff += [item]; } } llGiveInventoryList(lucky, "Goodies for "+llDetectedName(0), stuff); } }