list bubbleable = []; list bbpos = []; list bubbled = []; integer crouchcheck = 0; add_bubbleable(key id) { bubbleable = llListInsertList(bubbleable,[id],0); llSay(0,"Added to bubbleable. "+llList2CSV(bubbleable)); } remove_bubbleable(key id) { integer foundpos = llListFindList(bubbleable,[id]); if(foundpos != -1) { bubbleable = llListReplaceList(bubbleable,[],foundpos,foundpos); llSay(0,"Removed from bubbleable. "+llList2CSV(bubbleable)); remove_bbpos(foundpos); } } add_bubbled(key id) { bubbled = llListInsertList(bubbled,[id],0); llSay(0,"Added to bubbled. "+llList2CSV(bubbled)); } remove_bubbled(key id) { integer foundpos = llListFindList(bubbled,[id]); if(foundpos != -1) { bubbled = llListReplaceList(bubbled,[],foundpos,foundpos); llSay(0,"Removed from bubbled. "+llList2CSV(bubbleable)); } } add_bbpos(vector pos) { bbpos = llListInsertList(bbpos,[pos],0); llSay(0,"Added to bbpos. "+llList2CSV(bbpos)); } remove_bbpos(integer loc) { if(loc != -1) { bbpos = llListReplaceList(bbpos,[],loc,loc); llSay(0,"Removed from bbpos. "+llList2CSV(bbpos)); } } mod_bbpos(vector pos, integer loc) { if(loc != -1) { bbpos = llListReplaceList(bbpos,[pos],loc,loc); } } default { state_entry() { llVolumeDetect(1); llSetTimerEvent(0.5); } collision_start(integer num_detected) { vector otherpos = llDetectedPos(0); vector pos = llGetPos(); vector othervel = llDetectedVel(0); key id = llDetectedKey(0); //When they touch. if(otherpos.z > pos.z && llListFindList(bubbleable,[id]) == -1) { add_bubbleable(id); add_bbpos(otherpos); } } //Below removes the person from the list if they are in it so that they will be welcomed or said goodbye to the next time it collides with them. collision_end(integer num_detected) { key id = llDetectedKey(0); remove_bubbleable(id); remove_bubbled(id); } timer() { if(llGetListLength(bubbleable) > 0 && crouchcheck == 0) { llSensor("",llList2Key(bubbleable,0),AGENT,200000,7000*PI); } } sensor(integer num_detected) { integer bable = llGetListLength(bubbleable); if(crouchcheck < bable) { key id = llDetectedKey(0); integer info = llGetAgentInfo(id); vector otherpos = llDetectedPos(0); if(llListFindList(bubbled,[id]) == -1) { mod_bbpos(otherpos, crouchcheck); } if((info & AGENT_CROUCHING) && llListFindList(bubbled,[id]) == -1) { llSay(0,"Bubbled."); llRezObject("Bubble",otherpos+<0,0,2.9>,ZERO_VECTOR,ZERO_ROTATION,2); add_bubbled(id); } crouchcheck += 1; llSensor("",llList2Key(bubbleable,crouchcheck),AGENT,200000,7000*PI); } else { crouchcheck = 0; } } }