User:Cow Taurog/Visitor nagger

From Second Life Wiki
Jump to: navigation, search

This script is used to nag people who haven't already been nagged about the rules of your place, or a welcome message. Drop a notecard named Rules, followed by this script into any object. The range is 20m, and it scans for people within range every 10 seconds by default. If someone is found that hasn't already been nagged, it will IM them the contents of the notecard line by line. There isn't a way to save the list, and if the script is reset, everyone will be nagged again. <lsl> list glLines; string gsNotecard="Rules"; float gfPoll=10; float gfRange=20; list glKeys; key gkReq; integer i; default{

   state_entry(){
       gkReq=llGetNotecardLine(gsNotecard,i);
   }
   dataserver(key req,string mess){if(req==gkReq){
       glLines=glLines+[mess];
       i++;
       gkReq=llGetNotecardLine(gsNotecard,i);
       if(mess==EOF){state running;}
   }}

} state running{

   state_entry(){
       llOwnerSay("'"+gsNotecard+"' notecard loaded.");
       llSensorRepeat("","",AGENT,gfRange,PI,gfPoll);
   }
   sensor(integer num){for(i=0;i<num;i++){
       if(llListFindList(glKeys,[llDetectedKey(i)])==-1){
           glKeys=glKeys+[llDetectedKey(i)];
           llInstantMessage(llDetectedKey(i),"\n"+llDumpList2String(glLines,"\n"));
       }
   }}

} </lsl>