Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Materials UUID Texture Changer // SENDER
- string product_id = "c5796baf-9bbe-999a-ed7b-7bb19f776a04"; // product id needs to match the one set in the receiver
- // -------------------------------------------
- string vApplierPassword = "#PASSWORD"; // password needs to match the one set in the receiver
- integer vApplierChannel = 1976; // channel needs to match the one set in the receiver
- // [ PRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rot, vector specular_color, integer glossiness,
- // integer environment ]
- // [ PRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rot ]
- // valid formats:
- // button & texture uuid diffuse
- // button & texture uuid diffuse & texture uuid normal
- // button & texture uuid diffuse & texture uuid normal & texture uuid specular
- // if you want to ignore a field, type NULL_KEY, eg, if you want just specualar use the folling line:
- // "BUTTON1",NULL_KEY, NULL_KEY, "TEXTURE_UUID",
- list settings = [
- "BUTTON1",
- "ec361789-d072-c404-1edf-7a754a6e3e00",
- "ec361789-d072-c404-1edf-7a754a6e3e00",
- "ec361789-d072-c404-1edf-7a754a6e3e00",
- "BUTTON2",
- "bc15d140-7800-2058-525f-c5fcb196e1c1",
- "bc15d140-7800-2058-525f-c5fcb196e1c1",
- "bc15d140-7800-2058-525f-c5fcb196e1c1",
- "BUTTON3",
- "37acf7d9-bcec-65e6-f2b5-ad3d00022375",
- "37acf7d9-bcec-65e6-f2b5-ad3d00022375",
- "37acf7d9-bcec-65e6-f2b5-ad3d00022375",
- "BUTTON4",
- "aba0b7e8-66a9-f5e8-0660-05ad41acc45c",
- "aba0b7e8-66a9-f5e8-0660-05ad41acc45c",
- "aba0b7e8-66a9-f5e8-0660-05ad41acc45c",
- "BUTTON5",
- "fc3a5c80-3064-73ec-ba53-b90f143b09a9",
- "fc3a5c80-3064-73ec-ba53-b90f143b09a9",
- "fc3a5c80-3064-73ec-ba53-b90f143b09a9",
- "BUTTON6",
- "d5433834-4b33-c29c-416b-30af007ca35f",
- "d5433834-4b33-c29c-416b-30af007ca35f",
- "d5433834-4b33-c29c-416b-30af007ca35f",
- "BUTTON7",
- "7f3c13d2-9cf0-9645-5aa9-e9603539a1ab",
- "7f3c13d2-9cf0-9645-5aa9-e9603539a1ab",
- "7f3c13d2-9cf0-9645-5aa9-e9603539a1ab",
- "BUTTON8",
- "267c3acb-5ee1-e17f-3214-cfc1178d3202",
- "267c3acb-5ee1-e17f-3214-cfc1178d3202",
- "267c3acb-5ee1-e17f-3214-cfc1178d3202"
- ];
- integer isKey(key in ) {
- if ( in ) return 2;
- return ( in == NULL_KEY);
- }
- default
- {
- touch_start(integer num_detected)
- {
- string btnid = llGetLinkName(llDetectedLinkNumber(0));
- integer line = llListFindList(settings, [btnid]);
- if (line != -1) {
- string pswd = llSHA1String((string) llGetOwner() + vApplierPassword + product_id);
- integer end = 0;
- list l;
- while (!end) {
- string t = llList2String(settings, ++line);
- if (isKey((key) t)) l += t;
- else end = 1;
- }
- llRegionSayTo(llGetOwner(), vApplierChannel, llDumpList2String([pswd] + l, "&"));
- }
- }
- }
- -----------------------------------------------
- // Materials UUID Texture Changer // RECEIVER
- string product_id = "c5796baf-9bbe-999a-ed7b-7bb19f776a04"; // product id needs to match the one set in the sender
- // -------------------------------------------
- string vApplierPassword = "#PASSWORD"; // password needs to match the one set in the sender
- integer vApplierChannel = 1976; // channel needs to match the one set in the sender
- // -------------------------------------------
- string vTargetPrimName = "MCM"; // prim name of the prim that is affected by the applier
- integer vTargetPrimFace = 1; // face that should get textured
- integer _TargetPrimLinknr;
- default
- {
- state_entry()
- {
- _TargetPrimLinknr = -1;
- integer i;
- for (i = 0; i < llGetObjectPrimCount(llGetKey()) + 1; i++)
- if (llGetLinkName(i) == vTargetPrimName)
- _TargetPrimLinknr = i;
- if (_TargetPrimLinknr == -1)
- llOwnerSay("error: unable to find \"" + vTargetPrimName + "\" so could not register its linknr, please check if the name is spelled correctly and reset the script...");
- else
- llListen(vApplierChannel, "", llGetOwner(), "");
- }
- changed(integer change) {
- if ((change & CHANGED_LINK) || (change & CHANGED_INVENTORY))
- llResetScript();
- }
- listen(integer channel, string name, key id, string message) {
- if (channel == vApplierChannel) {
- //if (llGetAttached() == 0) return; // don't continue if this product is not worn...
- list data = llParseString2List(message, ["&"], []);
- string pswd = llList2String(data, 0);
- if (pswd != llSHA1String((string) llGetOwner() + vApplierPassword + product_id))
- return; // don't continue if the message is not meant for this product...
- list lt = llList2List(data, 1, -1);
- integer i = 0;
- for (i; i < llGetListLength(lt); ++i) {
- key t = (key) llList2String(lt, i);
- if (t) {
- if (i == 0) {
- llSetLinkTexture(_TargetPrimLinknr, t, vTargetPrimFace);
- } else if (i == 1) {
- list l = llGetLinkPrimitiveParams(_TargetPrimLinknr, [PRIM_NORMAL, vTargetPrimFace]);
- l = llListReplaceList(l, [t], 0, 0);
- llSetLinkPrimitiveParamsFast(_TargetPrimLinknr, [PRIM_NORMAL, vTargetPrimFace] + l);
- } else if (i == 2) {
- list l = llGetLinkPrimitiveParams(_TargetPrimLinknr, [PRIM_SPECULAR, vTargetPrimFace]);
- l = llListReplaceList(l, [t], 0, 0);
- llSetLinkPrimitiveParamsFast(_TargetPrimLinknr, [PRIM_SPECULAR, vTargetPrimFace] + l);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement