Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string MODE;
- float INTERVAL = 1.0;
- vector COLOR = <255.0, 0.0, 0.0>;
- string PROGRESSION = "cycling";
- integer STRIPEY = FALSE;
- key INVISI = "38b86f85-2575-52a9-a531-23108d8da837";
- key STRIPES = "267cb98c-3d08-0baa-e3da-c46522361548";
- set_colors(vector sent_color)
- {
- llSay(265, (string)sent_color);
- llMessageLinked(0, 3, (string)sent_color, NULL_KEY);
- llSleep(0.05);
- llSetColor(sent_color, 0);
- }
- set_stripes()
- {
- if (!STRIPEY)
- {
- STRIPEY = TRUE;
- llSetTexture(STRIPES, 0);
- llSay(265, "stripeon");
- }
- else
- {`
- STRIPEY = FALSE;
- llSetTexture(TEXTURE_BLANK, 0);
- llSay(265, "stripeoff");
- }
- }
- float midpoint(float first, float second)
- {
- float output;
- if (first > second)
- {
- output = (second + ((first - second) / 2.0));
- }
- else if (first < second)
- {
- output = (first + ((second - second) / 2.0));
- }
- else
- {
- output = first;
- }
- return output;
- }
- //###########################################################################################
- default //linear
- {
- state_entry()
- {
- COLOR = <255.0, 0.0, 0.0>;
- MODE = "linear";
- PROGRESSION = "cycling";
- llListen(623568, "", llGetOwner(), "");
- if (INTERVAL < 0.5) INTERVAL = 0.5;
- llSetTimerEvent(INTERVAL);
- llSetTextureAnim(ANIM_ON | LOOP | SMOOTH, 0, 7, 1, 6, 0, 1);
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- touch_start(integer total_number)
- {
- if (llDetectedKey(0) == llGetOwner())
- {
- if (PROGRESSION == "cycling")
- {
- llSetTimerEvent(0.0);
- PROGRESSION = "static";
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- else
- {
- llSetTimerEvent(INTERVAL);
- PROGRESSION = "cycling";
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- }
- }
- listen(integer channel, string name, key id, string message)
- {
- list parsed = llParseString2List(message, [" "], []);
- string command = llList2String(parsed, 0);
- if ((llList2Float(parsed, 1) > 0.0) && ((command == "linear") || (command == "random") || (command == "step")))
- {
- INTERVAL = llList2Float(parsed, 1);
- if ((INTERVAL == 0.0) || (INTERVAL < 0.5))
- {
- INTERVAL = 0.5;
- }
- llSetTimerEvent(INTERVAL);
- }
- if (command == "step")
- {
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- if (command == "solid")
- {
- if (llGetListLength(parsed) == 4)
- {
- COLOR.x = llList2Float(parsed, 1);
- COLOR.y = llList2Float(parsed, 2);
- COLOR.z = llList2Float(parsed, 3);
- state solid;
- }
- else
- {
- llSay(2389547, "Please provide 3 values for RGB");
- }
- }
- if (command == "invisi")
- {
- state invisi;
- }
- if (command == "random")
- {
- state random;
- }
- if (command == "chaos")
- {
- state chaos;
- }
- if (command == "stripes")
- {
- set_stripes();
- }
- }
- timer()
- {
- if ((COLOR.x == 255.0) && (COLOR.y >= 0.0) && (COLOR.y < 255.0) && (COLOR.z == 0.0))
- {
- ++COLOR.y;
- set_colors(llVecNorm(COLOR));
- }
- else if ((COLOR.x <= 255.0) && (COLOR.x > 0.0) && (COLOR.y == 255.0) && (COLOR.z == 0.0))
- {
- --COLOR.x;
- set_colors(llVecNorm(COLOR));
- }
- else if ((COLOR.x == 0.0) && (COLOR.y == 255.0) && (COLOR.z >= 0.0) && (COLOR.z < 255.0))
- {
- ++COLOR.z;
- set_colors(llVecNorm(COLOR));
- }
- else if ((COLOR.x == 0.0) && (COLOR.y <= 255.0) && (COLOR.y > 0.0) && (COLOR.z == 255.0))
- {
- --COLOR.y;
- set_colors(llVecNorm(COLOR));
- }
- else if ((COLOR.x >= 0.0) && (COLOR.x < 255.0) && (COLOR.y == 0.0) && (COLOR.z == 255.0))
- {
- ++COLOR.x;
- set_colors(llVecNorm(COLOR));
- }
- else if ((COLOR.x == 255.0) && (COLOR.y == 0.0) && (COLOR.z <= 255.0) && (COLOR.z > 0.0))
- {
- --COLOR.z;
- set_colors(llVecNorm(COLOR));
- }
- }
- }
- //###########################################################################################
- state solid
- {
- state_entry()
- {
- llSetTimerEvent(0.0);
- MODE = "solid";
- PROGRESSION = "static";
- llListen(623568, "", llGetOwner(), "");
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- if ((COLOR.x > 1.0) || (COLOR.y > 1.0) || (COLOR.z > 1.0))
- {
- set_colors(llVecNorm(COLOR));
- }
- else
- {
- set_colors(COLOR);
- }
- }
- listen(integer channel, string name, key id, string message)
- {
- list parsed = llParseString2List(message, [" "], []);
- string command = llList2String(parsed, 0);
- if (command == "solid")
- {
- if (llGetListLength(parsed) == 4)
- {
- COLOR.x = llList2Float(parsed, 1);
- COLOR.y = llList2Float(parsed, 2);
- COLOR.z = llList2Float(parsed, 3);
- if ((COLOR.x > 1.0) || (COLOR.y > 1.0) || (COLOR.z > 1.0))
- {
- set_colors(llVecNorm(COLOR));
- }
- else
- {
- set_colors(COLOR);
- }
- }
- else
- {
- llSay(2389547, "Please provide 3 values for RGB");
- }
- }
- if ((llList2Float(parsed, 1) > 0.0) && ((command == "linear") || (command == "random") || (command == "step")))
- {
- INTERVAL = llList2Float(parsed, 1);
- }
- if (command == "step")
- {
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- if (command == "linear")
- {
- state default; //linear
- }
- if (command == "invisi")
- {
- state invisi;
- }
- if (command == "random")
- {
- state random;
- }
- if (command == "chaos")
- {
- state chaos;
- }
- if (command == "stripes")
- {
- set_stripes();
- }
- }
- }
- //###########################################################################################
- state invisi
- {
- state_entry()
- {
- llSetTimerEvent(0.0);
- MODE = "invisi";
- PROGRESSION = "static";
- llListen(623568, "", llGetOwner(), "");
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- llSay(265, "invisi");
- COLOR = <1.0, 1.0, 1.0>;
- llMessageLinked(0, 3, (string)COLOR, NULL_KEY);
- llSetColor(COLOR, 0);
- llSetTexture(INVISI, 0);
- }
- listen(integer channel, string name, key id, string message)
- {
- list parsed = llParseString2List(message, [" "], []);
- string command = llList2String(parsed, 0);
- if ((llList2Float(parsed, 1) > 0.0) && ((command == "linear") || (command == "random") || (command == "step")))
- {
- INTERVAL = llList2Float(parsed, 1);
- }
- if (command == "step")
- {
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- if (command == "linear")
- {
- state default; //linear
- }
- if (command == "solid")
- {
- if (llGetListLength(parsed) == 4)
- {
- COLOR.x = llList2Float(parsed, 1);
- COLOR.y = llList2Float(parsed, 2);
- COLOR.z = llList2Float(parsed, 3);
- state solid;
- }
- else
- {
- llSay(2389547, "Please provide 3 values for RGB");
- }
- }
- if (command == "random")
- {
- state random;
- }
- if (command == "chaos")
- {
- state chaos;
- }
- }
- state_exit()
- {
- llSetTexture(TEXTURE_BLANK, 0);
- }
- }
- //###########################################################################################
- state random
- {
- state_entry()
- {
- MODE = "random";
- PROGRESSION = "cycling";
- if (INTERVAL < 2.0) INTERVAL = 2.0;
- llListen(623568, "", llGetOwner(), "");
- llSetTimerEvent(INTERVAL);
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- touch_start(integer total_number)
- {
- if (llDetectedKey(0) == llGetOwner())
- {
- if (PROGRESSION == "cycling")
- {
- llSetTimerEvent(0.0);
- PROGRESSION = "static";
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- else
- {
- llSetTimerEvent(INTERVAL);
- PROGRESSION = "cycling";
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- }
- }
- listen(integer channel, string name, key id, string message)
- {
- list parsed = llParseString2List(message, [" "], []);
- string command = llList2String(parsed, 0);
- if ((llList2Float(parsed, 1) > 0.0) && ((command == "linear") || (command == "random") || (command == "step")))
- {
- INTERVAL = llList2Float(parsed, 1);
- if (INTERVAL < 2.0)
- {
- INTERVAL = 2.0;
- }
- llSetTimerEvent(INTERVAL);
- }
- if (command == "step")
- {
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- if (command == "linear")
- {
- state default; //linear
- }
- if (command == "solid")
- {
- if (llGetListLength(parsed) == 4)
- {
- COLOR.x = llList2Float(parsed, 1);
- COLOR.y = llList2Float(parsed, 2);
- COLOR.z = llList2Float(parsed, 3);
- state solid;
- }
- else
- {
- llSay(2389547, "Please provide 3 values for RGB");
- }
- }
- if (command == "invisi")
- {
- state invisi;
- }
- if (command == "chaos")
- {
- state chaos;
- }
- if (command == "stripes")
- {
- set_stripes();
- }
- }
- timer()
- {
- vector new_color;
- vector color_1;
- vector color_2;
- vector color_3;
- new_color.x = llFrand(1.0);
- new_color.y = llFrand(1.0);
- new_color.z = llFrand(1.0);
- color_2.x = midpoint(COLOR.x, new_color.x);
- color_2.y = midpoint(COLOR.y, new_color.y);
- color_2.z = midpoint(COLOR.z, new_color.z);
- color_1.x = midpoint(COLOR.x, color_2.x);
- color_1.y = midpoint(COLOR.y, color_2.y);
- color_1.z = midpoint(COLOR.z, color_2.z);
- color_3.x = midpoint(color_2.x, new_color.x);
- color_3.y = midpoint(color_2.y, new_color.y);
- color_3.z = midpoint(color_2.z, new_color.z);
- set_colors(color_1);
- set_colors(color_2);
- set_colors(color_3);
- set_colors(new_color);
- COLOR = new_color;
- }
- }
- //###########################################################################################
- state chaos
- {
- state_entry()
- {
- MODE = "chaos";
- INTERVAL = 0.05;
- PROGRESSION = "cycling";
- llListen(623568, "", llGetOwner(), "");
- llSetTimerEvent(INTERVAL);
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- llSay(265, "chaos");
- llMessageLinked(0, 3, "chaos", NULL_KEY);
- }
- listen(integer channel, string name, key id, string message)
- {
- list parsed = llParseString2List(message, [" "], []);
- string command = llList2String(parsed, 0);
- if ((llList2Float(parsed, 1) > 0.0) && ((command == "linear") || (command == "random") || (command == "step")))
- {
- INTERVAL = llList2Float(parsed, 1);
- }
- if (command == "step")
- {
- llSay(2389547, "Color: " + MODE + ", " + PROGRESSION + " at " + (string)INTERVAL + " seconds");
- }
- if (command == "linear")
- {
- state default; //linear
- }
- if (command == "solid")
- {
- if (llGetListLength(parsed) == 4)
- {
- COLOR.x = llList2Float(parsed, 1);
- COLOR.y = llList2Float(parsed, 2);
- COLOR.z = llList2Float(parsed, 3);
- state solid;
- }
- else
- {
- llSay(2389547, "Please provide 3 values for RGB");
- }
- }
- if (command == "invisi")
- {
- state invisi;
- }
- if (command == "random")
- {
- state random;
- }
- if (command == "stripes")
- {
- set_stripes();
- }
- }
- timer()
- {
- COLOR.x = llFrand(1.0);
- COLOR.y = llFrand(1.0);
- COLOR.z = llFrand(1.0);
- llSetColor(COLOR, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement