Difference between revisions of "User:ANSI Soderstrom"

From Second Life Wiki
Jump to navigation Jump to search
Line 91: Line 91:


<lsl>
<lsl>
// Simple Copy Protection for your Items
list SOMELIST;
// (C) 10/2009 ANSI Soderstrom


default {
string GET(list ARRAY,list KEY) {
    state_entry() {
    if(llGetListLength(KEY)>1) {
        if(llGetCreator() != "9adba1b4-a733-4a44-8275-f4a666784d8c") { // ANSI Soderstrom
        return "-1";
            llOwnerSay("Script: " + llGetScriptName() + ":");
            llOwnerSay("Sorry, my Scripts are only running in MY Items");
            llOwnerSay("Greetings, ANSI Soderstrom");
            // llDie();
        } else {
            state online;
        }     
     }
     }
    integer position;
    do {
        position = llListFindList(ARRAY, KEY);
        if(position%2 && ~position && position) {
            ARRAY = llDeleteSubList(ARRAY,0,position);
        }
    } while (~position  && position%2);
    if(~position) {
        return llList2String(ARRAY,position+1);
    } else {
        return "-1";
    }
}


     on_rez(integer i) {
list PUT(list ARRAY,list KEY, list VALUE) {
         llResetScript();
     if(llGetListLength(KEY)>1 || llGetListLength(VALUE)>1) {
        return [-1];
    }   
    integer position = llListFindList(ARRAY,KEY);
    if(~position) {
         ARRAY = llListReplaceList(ARRAY, VALUE, position + 1, position + 1);
    } else {
        ARRAY += KEY;
        ARRAY += VALUE;       
     }
     }
    return ARRAY; 
}
}


state online {
default
     state_entry() {
{
         // your Code
     state_entry()
    } 
    {
   
          
    on_rez(integer i) {
        llSay(0,"-------------------------");
         llResetScript();
       
     }  
        SOMELIST = ["KEY","VALUE"];
        SOMELIST = PUT(SOMELIST,[AGENT],[<1,1,1>]);
       
        llSay(0,llList2CSV(SOMELIST));
       
        llSay(0,GET(SOMELIST,["KEY"]));
        llSay(0,GET(SOMELIST,[AGENT]));
       
        llSay(0,"-------------------------");
       
        SOMELIST = PUT(SOMELIST,[AGENT],["name"]);
       
        llSay(0,llList2CSV(SOMELIST));
       
        llSay(0,GET(SOMELIST,["KEY"]));
        llSay(0,GET(SOMELIST,[AGENT]));
       
        llSay(0,"-------------------------");
       
        SOMELIST = PUT(SOMELIST,["KEY"],[NULL_KEY]);
       
        llSay(0,llList2CSV(SOMELIST));
       
        llSay(0,GET(SOMELIST,["KEY"]));
         llSay(0,GET(SOMELIST,[AGENT]));      
     }
}
}
</lsl>
</lsl>

Revision as of 10:02, 24 February 2010

i am alive ! ...and have for you :

A #Simple Copy Protection for your Scripts. A #LSL Array for your Scripts.
























Simple LSL Copy Protection for your Scripts (best give away as no mod) :

<lsl> // Simple Copy Protection for your Items // (C) 10/2009 ANSI Soderstrom

default {

   state_entry() {
       if(llGetCreator() != "9adba1b4-a733-4a44-8275-f4a666784d8c") {  // ANSI Soderstrom
           llOwnerSay("Script: " + llGetScriptName() + ":");
           llOwnerSay("Sorry, my Scripts are only running in MY Items");
           llOwnerSay("Greetings, ANSI Soderstrom");
           // llDie();
       } else {
           state online;
       }      
   }
   on_rez(integer i) {
       llResetScript();
   }

}

state online {

   state_entry() {
       // your Code
   }   
   
   on_rez(integer i) {
       llResetScript();
   }    

} </lsl>



LSL Array for your Scripts :

<lsl> list SOMELIST;

string GET(list ARRAY,list KEY) {

   if(llGetListLength(KEY)>1) {
       return "-1";
   }
   integer position;
   do {
       position = llListFindList(ARRAY, KEY);
       if(position%2 && ~position && position) {
           ARRAY = llDeleteSubList(ARRAY,0,position);
       }
   } while (~position  && position%2);
   if(~position) {
       return llList2String(ARRAY,position+1);
   } else {
       return "-1";
   } 

}

list PUT(list ARRAY,list KEY, list VALUE) {

   if(llGetListLength(KEY)>1 || llGetListLength(VALUE)>1) {
       return [-1];
   }    
   integer position = llListFindList(ARRAY,KEY);
   if(~position) {
       ARRAY = llListReplaceList(ARRAY, VALUE, position + 1, position + 1);
   } else {
       ARRAY += KEY;
       ARRAY += VALUE;        
   }
   return ARRAY;  

}

default {

   state_entry()
   {
       
       llSay(0,"-------------------------");
       
       SOMELIST = ["KEY","VALUE"];
       SOMELIST = PUT(SOMELIST,[AGENT],[<1,1,1>]);
       
       llSay(0,llList2CSV(SOMELIST));
       
       llSay(0,GET(SOMELIST,["KEY"]));
       llSay(0,GET(SOMELIST,[AGENT]));
       
       llSay(0,"-------------------------");
       
       SOMELIST = PUT(SOMELIST,[AGENT],["name"]);
       
       llSay(0,llList2CSV(SOMELIST));
       
       llSay(0,GET(SOMELIST,["KEY"]));
       llSay(0,GET(SOMELIST,[AGENT]));
       
       llSay(0,"-------------------------");
       
       SOMELIST = PUT(SOMELIST,["KEY"],[NULL_KEY]);
       
       llSay(0,llList2CSV(SOMELIST));
       
       llSay(0,GET(SOMELIST,["KEY"]));
       llSay(0,GET(SOMELIST,[AGENT]));        
   }

}

</lsl>