Difference between revisions of "User:Daemonika Nightfire/Scripts/DEMO Shield"
Kireji Haiku (talk | contribs) (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> | ||
/* // | // ╔══════════════════════════════════−−−−−−−−−→ | ||
// ║ *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"; | |||
key CreatorKey = "61ee201a-81cf-4322-b9a8-a5eb8da777c2"; | |||
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 ! ◣◥◣◥"; | ||
CheckDemo() | CheckDemo() | ||
{ | { | ||
Owner = llGetOwner(); | key Owner = llGetOwner(); | ||
OwnerName = llGetUsername( | string OwnerName = llGetUsername(OwnerKey); | ||
integer OwnerPerms = llGetObjectPermMask(MASK_OWNER); | integer OwnerPerms = llGetObjectPermMask(MASK_OWNER); | ||
if(OwnerPerms & PERM_MODIFY) | if (OwnerPerms & PERM_MODIFY) | ||
{ | { | ||
if(CreatorKey != Owner | 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( | 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() | if (llGetAttached()) | ||
llRequestPermissions(Owner, PERMISSION_ATTACH); | |||
llRequestPermissions(Owner, PERMISSION_ATTACH); | |||
string thisScript = llGetScriptName(); | |||
llRemoveInventory(thisScript); | |||
llRemoveInventory( | // use the next line to delete the whole object | ||
// llDie(); | |||
} | } | ||
} | } | ||
} | } | ||
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) + "/"); | |||
} | } | ||
default | default | ||
{ | { | ||
on_rez(integer start_param) | |||
{ | |||
CheckDemo(); | |||
} | |||
state_entry() | state_entry() | ||
{ | { | ||
CheckDemo(); | CheckDemo(); | ||
} | } | ||
run_time_permissions(integer perm) | run_time_permissions(integer perm) | ||
{ | { | ||
if(perm & PERMISSION_ATTACH) | if (perm & PERMISSION_ATTACH) | ||
llDetachFromAvatar(); | |||
llDetachFromAvatar(); | |||
} | } | ||
touch_start(integer | touch_start(integer num_detected) | ||
{ | { | ||
// 64 KiB = 65536 bytes | // 64 KiB = 65536 bytes | ||
integer Memory = 65536 - llGetFreeMemory(); | integer Memory = 65536 - llGetFreeMemory(); | ||
llSay( | llSay(PUBLIC_CHANNEL, "/me [" + llGetScriptName() + "]: " + (string)Memory + " bytes used."); | ||
} | } | ||
} | } | ||
</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>