Salvage

No promotion here please! Discuss building, collecting, and using community catchables and 7Seas-compatible buyables. Any registered user can start new threads here and reply.

Salvage

Postby Barbara Schwarz » 21 Mar 2009, 13:44

// Mod to include the blueprint(s) this salvage is part of. (Barbara Schwarz)

// OpenBlueprint: Salvage Driver
// A system for custom craftables, for 7Seas fishing content creators.

// ----------------------------------------------------------------------------

// Please consult the documentation that came with your OpenSeas kit for
// how to properly install and set up these scripts.

// Note that the scripts are distributed under a Creative Commons
// Attribution 3.0 United States agreement. To use this script you must agree
// NOT to stamp your creations as "Official 7Seas Products", because even though
// they're using our code they are not created by us. This also means not
// putting our (7S) trademark text in front of your object name. Anything else,
// including commercial repurposing of the code with this header intact, is
// fair game.

// ----------------------------------------------------------------------------

// SALVAGE PASSWORD
// This password is used in your salvage scripts to connect to the blueprint.
// This prevents other people from creating similarly-named salvage and bypassing
// your own salvage to craft the blueprint. It MUST be changed from "default" before
// this script will work.

string salvagepassword = "default";

// make this the name(s) of the blueprints that this salvage fits into.

// examples: "Outerspace" or "Red, Green, or Yellow Killer"
//These will produce strings that are:
//
// "" (default) --> Please make sure you're wearing the corresponding blueprint;
// "ALPHA Outerspace" --> Please make sure you're wearing the ALPHA Outerspace blueprint;
// "Red, Green, or Yellow Killer" --> Please make sure you're wearing the Red, Green, or Yellow Killer blueprint;

string blueprintname = "corresponding";

// ---- Change nothing below this point. Well, unless you want to and know what you're doing. ----

integer handel = 0;
integer failed = FALSE;

string salvagename()
{ string iam = llGetObjectName();
integer colon = llSubStringIndex(iam,":");
if (colon == -1) { return iam; }
else { return llStringTrim(llDeleteSubString(iam,0,colon),STRING_TRIM); }
}

dopermcheck()
{ if (handel != 0) { llListenRemove(handel); }
if (llGetObjectName() == "(7S Boxed Stuff) OpenSeas Developer's Kit") { return; }
handel = llListen(-92302,"",NULL_KEY,""); // to listen for blueprint calls.
if (llGetInventoryPermMask(llGetScriptName(), MASK_NEXT) & PERM_MODIFY)
{ llOwnerSay("Error: The script is set Modifiable. Please only set it transfer-OK! Salvage disabled.");
failed = TRUE; state fail; }
if (llGetInventoryPermMask(llGetScriptName(), MASK_NEXT) & PERM_COPY)
{ llOwnerSay("Error: The script is set Modifiable. Please only set it transfer-OK! Salvage disabled.");
failed = TRUE; state fail; }
if (salvagepassword == "default") { llOwnerSay("Error: Salvage Password is not set. Salvage disabled."); failed = TRUE; state fail; }
}

default // Default state is the one used when the blueprint still needs all salvage loaded.
{ on_rez(integer q) { dopermcheck(); }

state_entry() { dopermcheck(); }

touch_start(integer total_number)
{ if (llGetObjectName() == "(7S Boxed Stuff) OpenSeas Developer's Kit") { return; }
// Format it'll say on -104841 is salvagename,userkey,nonce,hash.
// Hash format is date + nonce + salvagename + salvagepassword + regionname + key
integer nonce = llRound(llFrand(1000000000.0));
string hashpipe = llMD5String(llGetDate() + (string)nonce + salvagename() + salvagepassword + llGetRegionName() + (string)llGetKey(),nonce);
llOwnerSay("Loading this salvage into your blueprint. (Please make sure you're wearing the "+blueprintname+" blueprint; you can click this salvage again if it doesn't work.)");
llSay(-104841,salvagename()+","+(string)llGetOwner()+","+(string)nonce+","+hashpipe);
}

listen(integer channel, string name, key id, string message)
{ // Format it'll hear on -92302 is salvagename,userkey,nonce,hash.
// Hash format is key + date + salvagename + nonce + salvagepassword + regionname
list params = llCSV2List(message);

if (llList2Key(params,1) != llGetOwner()) { return; }
if (llList2String(params,0) != salvagename()) { return; }

integer nonce = llList2Integer(params,2);
string hashcheck = llList2String(params,3);
string hashpipe = llMD5String((string)id + llGetDate() + salvagename() + (string)nonce +
salvagepassword + llGetRegionName(),nonce);
if (hashpipe == hashcheck) { state complete; }
}


}

state complete
{ touch_start(integer total_number)
{ if (llGetOwner() != llDetectedKey(0)) { return; }
llOwnerSay("This Salvage is now inactive, and may be deleted.");
}

state_entry()
{ llRemoveInventory(llGetScriptName()); }
}

state fail
{ touch_start(integer total_number)
{ if (llGetOwner() != llDetectedKey(0)) { return; }
llOwnerSay("This Salvage isn't configured properly and will not operate.");
}
}
Barbara Schwarz
 

Return to OpenSeas Creations

Who is online

Users browsing this forum: No registered users and 2 guests

cron