1) Allows multiple windows, as many as you want
2) Select to change the tint on the outside or inside of the window
3) When a window is tinted 100% a texture is used instead
The scripts posted are:
TintController - goes in the prim to be used as the contoller
TargetWindow - goes in the windows to be controlled
WindowFace - since the control of inside and outside is based on particular faces of the prim, this script helps you see which side is which during building.
Hope these are useful!
-----------------
//
CODE
// Window Tint Controller Script (put into controller prim)
//
// *******************************************************************
// This program is free software; you can redistribute it and/or
// modify as you wish. Just don't try and sell it to someone ...
// that would not be nice or fair.
// If you have paid someone for this script .. contact me and we'll
// track them down inworld and harass them ;-)
//
// While I do not offer support for this script if you have questions
// feel free to contact me inworld.
//
// Writen by Shifting Dreamscape
// *******************************************************************
//The % to Tint the window
list TINT_OPTIONS = ["40%", "20%", "None", "100%", "80%", "60%"];
//List as many options as windows that you have to tint
list WINDOW_OPTIONS = ["Window Title1", "All"];
//For each option, ending the list with a 0 for All, set up a list of channels.
//These should be large negative numbers, example would be starting at -30000
//and continuing up from there
list WINDOW_CHANNELS = [-30000,0];
//Side of the Window to Tint
list SIDE_OPTIONS = ["Outside", "Inside", "Both"];
//Dialog Channel to listen on
integer LISTEN_CHAN = -29999;
//Identifiers for the different dialog boxes
integer NO_DIALOG = 0;
integer CHECK_WINDOW = 1;
integer CHECK_TINT = 2;
integer CHECK_SIDE = 3;
//Variable set when a window is chosen
string winSelected;
//Holds the Tint level Chosen
string msgTint;
//Holds the side to tint .. will be changed to a digit:
//both = ALL_SIDES (face constant)
//The others are based on the window sides being along the y axis ..
//Use the windowFace script to determine which these are
integer OUT_SIDE = 1; //-y axis
integer IN_SIDE = 3; //+y axis
string sideModifier;
//Holds which Dialog was last shown
integer curDialog;
default
{
state_entry()
{
llListen(LISTEN_CHAN, "", NULL_KEY, "");
} // end state_entry()
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "Which window would you like to tint?", WINDOW_OPTIONS, LISTEN_CHAN);
curDialog = CHECK_WINDOW;
} // end touch_start()
listen(integer channel, string name, key id, string message)
{
//Check that we are getting one of the possible options
if (llListFindList(TINT_OPTIONS + WINDOW_OPTIONS + SIDE_OPTIONS, [message]) != -1)
{
//Hold the window selected and show the next Dialog
if (curDialog == CHECK_WINDOW)
{
//Hold the option selected
winSelected = message;
//Now Ask for the Tint .. setting the the proper dialog
curDialog = CHECK_TINT;
llDialog(id, "How much tint would you like?", TINT_OPTIONS, LISTEN_CHAN);
}
else if (curDialog == CHECK_TINT)
{
//Change the message into a number and hold it
if (message == "None")
{
msgTint = "0";
}
else
{
msgTint = llGetSubString(message, 0, llStringLength(message)-2);
}
//Set Next Dialog and show
curDialog = CHECK_SIDE;
llDialog(id, "Which sides would you like to tint?", SIDE_OPTIONS, LISTEN_CHAN);
}
else if (curDialog == CHECK_SIDE)
{
integer i = 0;
integer quit = 0;
integer listLen = llGetListLength(WINDOW_CHANNELS);
//Now we start tinting!!!
curDialog = NO_DIALOG;
//First set our side modifier based on the side chosen
//Default is Both
if (message == "Inside")
{
sideModifier = (string)IN_SIDE;
}
else if (message == "Outside")
{
sideModifier = (string)OUT_SIDE;
}
else
{
sideModifier = (string)ALL_SIDES;
}
//Now call the windows
while (quit == 0 && i < listLen-1)
{
if (llList2String(WINDOW_OPTIONS, i) == winSelected || winSelected == "All")
{
llSay(llList2Integer(WINDOW_CHANNELS,i), msgTint + "@" + sideModifier);
if (winSelected != "All")
{
quit = 1;
}
}
i++;
}
}
}
} // end listen
} // end default
//
--------------
//
CODE
// Window Tint target Script (put into the window prim)
//
// When a window is set to 100% this will replace the texture based on
// the texture you have assigned below. This allows for blinds,
// mirrored look, or anything else you might want.
//
// If you change the texture or color of the window after dropping
// in this script, be sure to reset or these will be lost
//
// *******************************************************************
// This program is free software; you can redistribute it and/or
// modify as you wish. Just don't try and sell it to someone ...
// that would not be nice or fair.
// If you have paid someone for this script .. contact me and we'll
// track them down inworld and harass them ;-)
//
// While I do not offer support for this script if you have questions
// feel free to contact me inworld.
//
// Writen by Shifting Dreamscape
// *******************************************************************
//Channel to listen to ... based on the value assigned in the controller for this window
integer LISTEN_CHAN = -30000;
//Side constants
integer OUT_SIDE = 1; //-y axis
integer IN_SIDE = 3; //+y axis
//The Inner/Outer Texture when at 100%. The default here is a set of blinds
string IN_TEXT = "d31e1d9d-2f33-64be-0642-655de5e9d001";
string OUT_TEXT = "d31e1d9d-2f33-64be-0642-655de5e9d001";
//Color for the window when the texture is set, default is white but can be changed to anything
vector TEXT_COLOR = <1.0, 1.0, 1.0>;
//Holds the original color of the window sides
vector baseInColor;
vector baseOutColor;
//Holds the original texture
string baseInText;
string baseOutText;
default
{
state_entry()
{
llListen(LISTEN_CHAN, "", NULL_KEY, "" );
//Save the base colors & textures
baseInColor = llGetColor(IN_SIDE);
baseOutColor = llGetColor(OUT_SIDE);
baseInText = llGetTexture(IN_SIDE);
baseOutText = llGetTexture(OUT_SIDE);
}//End state_entry
listen(integer channel, string name, key id, string message)
{
list listValues;
float tintValue;
integer sideToTint;
//Need to split out the side and tint values
listValues = llParseString2List(message,["@"],[""]);
//get the tintValue
tintValue = llList2Float(listValues,0)/100;
//now the side value
sideToTint = llList2Integer(listValues,1);
//Set the Alpha
llSetAlpha(tintValue, sideToTint);
//Now if this is 100% we need to change the color to white and set the texture
if (tintValue == 1)
{
if (sideToTint != OUT_SIDE)
{
llSetColor(TEXT_COLOR, IN_SIDE);
llSetTexture(IN_TEXT, IN_SIDE);
}
if (sideToTint != IN_SIDE)
{
llSetColor(TEXT_COLOR, OUT_SIDE);
llSetTexture(OUT_TEXT, OUT_SIDE);
}
}
//Otherwise we need to reset to the original color and texture
else
{
if (sideToTint != OUT_SIDE)
{
llSetColor(baseInColor, IN_SIDE);
llSetTexture(baseInText, IN_SIDE);
}
if (sideToTint != IN_SIDE)
{
llSetColor(baseOutColor, OUT_SIDE);
llSetTexture(baseOutText, OUT_SIDE);
}
}
}//End Listen
}//End Default
//
---------------
//
CODE
// WindowFace Identifier
//
// Sets a texture on the inside and outside faces of a prim so
// that you can identify these when placing the window.
//
// If you change the texture or color of the window after dropping
// in this script, be sure to reset or these will be lost
//
// Just touch the window to swap between the id textures and the originals
//
// Don't forget to remove this script when you are done
//
// *******************************************************************
// This program is free software; you can redistribute it and/or
// modify as you wish. Just don't try and sell it to someone ...
// that would not be nice or fair.
// If you have paid someone for this script .. contact me and we'll
// track them down inworld and harass them ;-)
//
// While I do not offer support for this script if you have questions
// feel free to contact me inworld.
//
// Writen by Shifting Dreamscape
// *******************************************************************
//Side constants
integer OUT_SIDE = 1; //-y axis
integer IN_SIDE = 3; //+y axis
//Current Texture Constants
integer TEXT_ORIG = 0;
integer TEXT_ID = 1;
//Color for the window when the id texture is set
vector WHITE =<1.0, 1.0, 1.0>;
//The Identifier Textures
string ID_OUT_TEXT = "6d18a282-34c7-27d8-4c96-b0904304ac69";
string ID_IN_TEXT = "114a8958-5f3f-8c6d-1ba7-f26f77ed15b1";
//Holds the original color of the window sides
vector baseInColor;
vector baseOutColor;
//Holds the original texture
string baseInText;
string baseOutText;
//Flag as to which is shown
// 0 = Original
// 1 = Id
integer curText;
default
{
state_entry()
{
//Get the original colors and textures
baseInColor = llGetColor(IN_SIDE);
baseOutColor = llGetColor(OUT_SIDE);
baseInText = llGetTexture(IN_SIDE);
baseOutText = llGetTexture(OUT_SIDE);
curText = TEXT_ORIG;
}//End state_entry
touch_start(integer total_number)
{
if (curText == TEXT_ORIG)
{
llSetColor(WHITE, IN_SIDE);
llSetColor(WHITE, OUT_SIDE);
llSetTexture(ID_IN_TEXT, IN_SIDE);
llSetTexture(ID_OUT_TEXT, OUT_SIDE);
curText = TEXT_ID;
}
else
{
llSetColor(baseInColor, IN_SIDE);
llSetColor(baseOutColor, OUT_SIDE);
llSetTexture(baseInText, IN_SIDE);
llSetTexture(baseOutText, OUT_SIDE);
curText = TEXT_ORIG;
}
} // end touch_start()
}//End Default
//


