Difference between revisions of "User:Daemonika Nightfire/Scripts/DEMO Shield"

From Second Life Wiki
Jump to navigation Jump to search
(removed a lot of comments because they made it difficult to read the script although naming conventions were good and code was over all clean)
Line 3: Line 3:
  The funny thing is, this script prohibits modify objects, but to put the script into a pure object can be, must be the primary modify :P
  The funny thing is, this script prohibits modify objects, but to put the script into a pure object can be, must be the primary modify :P
<lsl>
<lsl>
/* // start unprocessed Text
//    ╔══════════════════════════════════−−−−−−−−−→
//    ║ *DS* DEMO-Shield © 2011/2099 by Daemonika Nightfire (daemonika.nightfire)
//    ╚═════════════════════════−−−−−−−−−→
//
//    This script is very useful, if you sell scripted demos.
//    Any Copybot will have unscripted Deco and can not make it funktionality.
//    So that no one has the idea to create a own Fullperm Object and drop your script from the Demo into a new Object without DemoPrim.
//    The code save your Script only, but not Prims.
//
//    Features:
//    ══════════════════════════════════−−−−−−−−−→
//      • remove the Script or delete the complete Object (Script can not live in Objects with MOD permissions)
//      • with or without InstantMessage include SLurl
//      • floating text are not realy needed
//      • selfdetach when it is drop into a wearing Prim
//
//    Terms:
//    ══════════════════════════════════−−−−−−−−−→
//    Do not sell this script for any Linden$, give it FREE away it's Open Source
//    You can import this script into your own scripts
//   In your own interest, make your scripts NO MOD so that nobody can change the CreatorKey.


    ╔══════════════════════════════════−−−−−−−−−→
key CreatorKey = "61ee201a-81cf-4322-b9a8-a5eb8da777c2";
    ║ *DS* DEMO-Shield © 2011/2099 by Daemonika Nightfire (daemonika.nightfire)
    ╚═════════════════════════−−−−−−−−−→
   
    This script is very useful, if you sell scripted demos.
    Any Copybot will have unscripted Deco and can not make it funktionality.
    So that no one has the idea to create a own Fullperm Object and drop your script from the Demo into a new Object without DemoPrim.
    The code save your Script only, but not Prims.
   
    Features:
    ══════════════════════════════════−−−−−−−−−→
      • remove the Script or delete the complete Object (Script can not live in Objects with MOD permissions)
      • with or without InstantMessage include SLurl
      • floating text are not realy needed
      • selfdetach when it is drop into a wearing Prim
   
    Terms:
    ══════════════════════════════════−−−−−−−−−→
    Do not sell this script for any Linden$, give it FREE away it's Open Source
    You can import this script into your own scripts
    In your own interest, make your scripts NO MOD so that nobody can change the CreatorKey.
 
*/ // end unprocessed Text
 
// ### this CreatorKey must show your own Key (Avatar-UUID) ###
key CreatorKey = "61ee201a-81cf-4322-b9a8-a5eb8da777c2"; // stored CreatorKey
 
key Owner;          // OwnerKey
string OwnerName;  // OwnerName


string before_the_name = " © by *DaeSigns*\n◣◥◣◥◣◥◣◥◣◥ ! WARNING ! ◣◥◣◥◣◥◣◥◣◥\n";
string before_the_name = " © by *DaeSigns*\n◣◥◣◥◣◥◣◥◣◥ ! WARNING ! ◣◥◣◥◣◥◣◥◣◥\n";
string behind_the_name = " has try to use a DEMO in illegal way!\n◣◥◣◥ ! GOODBYE BEAUTIFUL WORLD ! ◣◥◣◥";
string behind_the_name = " has try to use a DEMO in illegal way!\n◣◥◣◥ ! GOODBYE BEAUTIFUL WORLD ! ◣◥◣◥";


// ### the following Funktion can be triggered in all events ###
 
CheckDemo()
CheckDemo()
{
{
     Owner = llGetOwner(); // asks for Ownerkey
     key Owner = llGetOwner();
     OwnerName = llGetUsername(Owner); // asks for Owners UserName
     string OwnerName = llGetUsername(OwnerKey);
     integer OwnerPerms = llGetObjectPermMask(MASK_OWNER); // check Owner Permissions, not the next Owner Perms
     integer OwnerPerms = llGetObjectPermMask(MASK_OWNER);
   
 
    // ### just for knowledge, new rezzed Prims are ever modify for the Owner ###
 
     if(OwnerPerms & PERM_MODIFY) // asks for modify is given
     if (OwnerPerms & PERM_MODIFY)
     {
     {
         if(CreatorKey != Owner) // asks whether the stored key is the same as the key of the owner. ( if its the same, it leave this Funktion here )
         if (CreatorKey != Owner)
         {
         {
            // ### If you want to be informed of any misuse of your DEMO-Script, use the instant InstantMessage (SLurl included) ###
        // If you want to be informed of any misuse of your DEMO-Script
            //llInstantMessage(CreatorKey, before_the_name + OwnerName + behind_the_name + "\n@ " + llGetSlurl(llGetRegionName(), llGetPos()));
        // llInstantMessage(CreatorKey, before_the_name + OwnerName + behind_the_name + "\n@ " + llGetSlurl(llGetRegionName(), llGetPos()) );
           
 
             llShout(0,"/me " + before_the_name + OwnerName + behind_the_name); // shouting is realy bad :P
             llShout(PUBLIC_CHANNEL, "/me " + before_the_name + OwnerName + behind_the_name);
           
 
            //llSetText("*DS* DEMO" + before_the_name + OwnerName + behind_the_name,<1,0,0>,1);
        // llSetText("*DS* DEMO" + before_the_name + OwnerName + behind_the_name, <1.0, 0.0, 0.0>, (float)TRUE);
           
 
             if(llGetAttached() != 0) // asks whether the Object is worn as an Attachment
             if (llGetAttached())
            {
                 llRequestPermissions(Owner, PERMISSION_ATTACH);
                 llRequestPermissions(Owner, PERMISSION_ATTACH); // asks for permissions to manage attachments
 
            }
             string thisScript = llGetScriptName();
              
             llRemoveInventory(thisScript);
            // ### use this to just remove the Script from the Object Content ###
 
             llRemoveInventory(llGetScriptName());
        // use the next line to delete the whole object
           
        // llDie();
            // ### or ###
           
            // ### use this to delete the complete Object ###
            //llDie();
         }
         }
     }
     }
}
}


// ### this Funktion create the SLurl for the InstantMessage ###
string llGetSlurl(string RegionName, vector pos)
string llGetSlurl(string RegionName, vector pos)
{
{
     return "http://slurl.com/secondlife/" + llEscapeURL(RegionName) +
     return "http://slurl.com/secondlife/" + llEscapeURL(RegionName)
          "/" + (string)((integer)pos.x) + "/" + (string)((integer)pos.y) + "/" + (string)(llCeil(pos.z));
            + "/" + (string)((integer)pos.x) + "/" + (string)((integer)pos.y) + "/" + (string)(llCeil(pos.z) + "/");
}
}


// ### the real start of the Script ###
default
default
{
{
    on_rez(integer start_param)
    {
        CheckDemo();
    }
     state_entry()
     state_entry()
     {
     {
         CheckDemo(); // run the Funktion above the script
         CheckDemo();
     }
     }
   
 
     run_time_permissions(integer perm)
     run_time_permissions(integer perm)
     {
     {
         if(perm & PERMISSION_ATTACH) // if given permission to manage attachments run the following command
         if (perm & PERMISSION_ATTACH)
        {
             llDetachFromAvatar();
             llDetachFromAvatar(); // detaches Object from the Avatar
        }
     }
     }
   
 
     touch_start(integer total_number) // just for knowledge :)
     touch_start(integer num_detected)
     {
     {
         // 64 KiB = 65536 bytes
         // 64 KiB = 65536 bytes
         integer Memory = 65536 - llGetFreeMemory();
         integer Memory = 65536 - llGetFreeMemory();
         llSay(0, (string)Memory + " bytes used.");
         llSay(PUBLIC_CHANNEL, "/me [" + llGetScriptName() + "]: " + (string)Memory + " bytes used.");
    }
   
    on_rez(integer st)
    {
        // unlike reset on-rez, use this instead of llResetScript();
        CheckDemo(); // run the Funktion above the script
     }
     }
}
}
</lsl>
</lsl>

Revision as of 06:57, 13 October 2012

*DS* DEMO-Shield

Everyone knows the demos with the extra prim what DEMO is written. My idea was now, how do I protect fully functional scripts in the demos? With this script, it is impossible to use these scripts in copied (Copybot) object. Even if the Copybot Fullperm Prims owns about you.

The funny thing is, this script prohibits modify objects, but to put the script into a pure object can be, must be the primary modify :P

<lsl> // ╔══════════════════════════════════−−−−−−−−−→ // ║ *DS* DEMO-Shield © 2011/2099 by Daemonika Nightfire (daemonika.nightfire) // ╚═════════════════════════−−−−−−−−−→ // // This script is very useful, if you sell scripted demos. // Any Copybot will have unscripted Deco and can not make it funktionality. // So that no one has the idea to create a own Fullperm Object and drop your script from the Demo into a new Object without DemoPrim. // The code save your Script only, but not Prims. // // Features: // ══════════════════════════════════−−−−−−−−−→ // • remove the Script or delete the complete Object (Script can not live in Objects with MOD permissions) // • with or without InstantMessage include SLurl // • floating text are not realy needed // • selfdetach when it is drop into a wearing Prim // // Terms: // ══════════════════════════════════−−−−−−−−−→ // Do not sell this script for any Linden$, give it FREE away it's Open Source // You can import this script into your own scripts // In your own interest, make your scripts NO MOD so that nobody can change the CreatorKey.

key CreatorKey = "61ee201a-81cf-4322-b9a8-a5eb8da777c2";

string before_the_name = " © by *DaeSigns*\n◣◥◣◥◣◥◣◥◣◥ ! WARNING ! ◣◥◣◥◣◥◣◥◣◥\n"; string behind_the_name = " has try to use a DEMO in illegal way!\n◣◥◣◥ ! GOODBYE BEAUTIFUL WORLD ! ◣◥◣◥";


CheckDemo() {

   key Owner = llGetOwner();
   string OwnerName = llGetUsername(OwnerKey);
   integer OwnerPerms = llGetObjectPermMask(MASK_OWNER);


   if (OwnerPerms & PERM_MODIFY)
   {
       if (CreatorKey != Owner)
       {
       //  If you want to be informed of any misuse of your DEMO-Script
       //  llInstantMessage(CreatorKey, before_the_name + OwnerName + behind_the_name + "\n@ " + llGetSlurl(llGetRegionName(), llGetPos()) );
           llShout(PUBLIC_CHANNEL, "/me " + before_the_name + OwnerName + behind_the_name);
       //  llSetText("*DS* DEMO" + before_the_name + OwnerName + behind_the_name, <1.0, 0.0, 0.0>, (float)TRUE);
           if (llGetAttached())
               llRequestPermissions(Owner, PERMISSION_ATTACH);
           string thisScript = llGetScriptName();
           llRemoveInventory(thisScript);
       //  use the next line to delete the whole object
       //  llDie();
       }
   }

}

string llGetSlurl(string RegionName, vector pos) {

   return "http://slurl.com/secondlife/" + llEscapeURL(RegionName)
           + "/" + (string)((integer)pos.x) + "/" + (string)((integer)pos.y) + "/" + (string)(llCeil(pos.z) + "/");

}

default {

   on_rez(integer start_param)
   {
       CheckDemo();
   }
   state_entry()
   {
       CheckDemo();
   }
   run_time_permissions(integer perm)
   {
       if (perm & PERMISSION_ATTACH)
           llDetachFromAvatar();
   }
   touch_start(integer num_detected)
   {
       // 64 KiB = 65536 bytes
       integer Memory = 65536 - llGetFreeMemory();
       llSay(PUBLIC_CHANNEL, "/me [" + llGetScriptName() + "]: " + (string)Memory + " bytes used.");
   }

} </lsl>