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

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


==Short Version==
==Short Version==
Silent version with necessary options for just remove the script from the object-content of monify objects.
Silent version with necessary options for just remove the script from the object-content of modify objects.
<lsl>
<lsl>
/*
/*

Revision as of 07:48, 7 November 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> /* // 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.
  • / // end unprocessed Text

// ### this CreatorKey must show your own Key (Avatar-UUID) ### key CreatorKey = "61ee201a-81cf-4322-b9a8-a5eb8da777c2"; // stored CreatorKey (use your own)

key Owner; // OwnerKey string OwnerName; // OwnerName

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 ! ◣◥◣◥";

// ### the following Funktion can be triggered in all events ### CheckDemo() {

   Owner = llGetOwner(); // asks for Ownerkey
   OwnerName = llGetUsername(Owner); // asks for Owners UserName
   integer OwnerPerms = llGetObjectPermMask(MASK_OWNER); // check Owner Permissions, not the next Owner Perms
   
   // ### just for knowledge, new rezzed Prims are ever modify for the Owner ###
   if(OwnerPerms & PERM_MODIFY) // asks for modify is given
   {
       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 you want to be informed of any misuse of your DEMO-Script, use the instant InstantMessage (SLurl included) ###
           //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
           
           llSetText("*DS* DEMO" + before_the_name + OwnerName + behind_the_name,<1,0,0>,1);
           
           if(llGetAttached() != 0) // asks whether the Object is worn as an Attachment
           {
               llRequestPermissions(Owner, PERMISSION_ATTACH); // asks for permissions to manage attachments
           }
           
           // ### use this to just remove the Script from the Object Content ###
           //llRemoveInventory(llGetScriptName());
           
           // ### or ###
           
           // ### use this to delete the complete Object ###
           //llDie();
       }
   }

}

// ### this Funktion create the SLurl for the InstantMessage ### 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));

}

// ### the real start of the Script ### default {

   state_entry()
   {
       CheckDemo(); // run the Funktion above the script
   }
   
   run_time_permissions(integer perm)
   {
       if(perm & PERMISSION_ATTACH) // if given permission to manage attachments run the following command
       {
           llDetachFromAvatar(); // detaches Object from the Avatar
       }
   }
   
   touch_start(integer total_number) // just for knowledge :)
   {
       // 64 KiB = 65536 bytes
       integer Memory = 65536 - llGetFreeMemory();
       llSay(0, (string)Memory + " bytes used.");
   }
   
   on_rez(integer Dae)
   {
       // unlike reset on-rez, use this instead of llResetScript();
       CheckDemo(); // run the Funktion above the script
   }

} // released @ https://wiki.secondlife.com/wiki/User:Daemonika_Nightfire/Scripts/DEMO_Shield // you can find more of my scripts here: https://wiki.secondlife.com/wiki/User:Daemonika_Nightfire // german discussion here: http://www.slinfo.de/vb_forum/fragen-scripting/75816-demo-shield.html </lsl>

Short Version

Silent version with necessary options for just remove the script from the object-content of modify objects. <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 (Script can not live in Objects with MOD permissions)

   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"; // stored CreatorKey (use your own)

// ### the following Funktion can be triggered in all events ### CheckDemo() {

   // ### just for knowledge, new rezzed Prims are ever modify for the Owner ###
   if(llGetObjectPermMask(MASK_OWNER) & PERM_MODIFY) // check owner permissions and asks for modify is given (not the next Owner Perms)
   {
       if(CreatorKey != llGetOwner()) // asks whether the stored key is the same as the key of the owner. (if its the same, it leave this Funktion here)
       {
           llRemoveInventory(llGetScriptName()); // remove the script from the object content
       }
   }

}

default {

   state_entry()
   {
       CheckDemo(); // run the funktion above the script
   }
   
   changed(integer change)
   {
       if(change & (CHANGED_OWNER|CHANGED_INVENTORY))
       {
           CheckDemo(); // or llResetScript();
       }
   }

   on_rez(integer Dae)
   {
       CheckDemo(); // or llResetScript();
   }

} // released @ https://wiki.secondlife.com/wiki/User:Daemonika_Nightfire/Scripts/DEMO_Shield // you can find more of my scripts here: https://wiki.secondlife.com/wiki/User:Daemonika_Nightfire // german discussion here: http://www.slinfo.de/vb_forum/fragen-scripting/75816-demo-shield.html </lsl>