Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for Simple tint script, yes I know...

Jenny Sparrow
Registered User
Join date: 11 Mar 2007
Posts: 7
12-12-2008 14:53
Hi, I know you can find free window tint scripts all over but what I need may even be more simple then the free ones.

I'm looking for a simple window tint script in the same prim, no listener,no button, just touch the prim (window) to get a tint menu 0, 20, 40, 60, 80, 100, for that same prim, that anyone can access. To control that prim and only that prim.

I know I can use many common scripts with listeners, even put the contol script in the same prim with the tint script but I dont want 40 listeners on my plot causing lag.

Can anyone point me in the right direction?
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-12-2008 15:26
Here's something I came up with. It starts with black color and ends in white. The colors correspond to 0, 20, 40, 80 and 100. You can set your own colors in the script. Note that the order_buttons function and random dialog channel snippet were taken from the LSL wiki.

From: someone

integer sides;
integer channel;

vector zero_color;
vector twenty_color;
vector forty_color;
vector sixty_color;
vector eighty_color;
vector hundred_color;


list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
+ llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}


default
{
state_entry()
{
channel = (integer)(llFrand(-1000000000.0) - 1000000000.0); // random channel for dialog menu

llListen(channel,"",NULL_KEY,"";);

//Set colors here
zero_color = <0.0,0.0,0.0>; // 0% = black
twenty_color = <.2,.2,.2>; // 20% = dark gray
forty_color = <.4,.4,.4>; // 40% = medium gray
sixty_color = <.6,.6,.6>; // 60% = moderate gray
eighty_color = <.8,.8,.8>; // 80% = light gray
hundred_color = <1.0,1.0,1.0>; // 100% = white

// Set sides here, or leave -1 for all sides
sides = -1; // all sides
}

touch_start(integer total_number)
{

llDialog(llDetectedKey(0), "Please select a tint setting: ",order_buttons(["0%", "20%", "40%", "60%", "80%", "100%"]), channel);
}

listen(integer ch, string name, key id, string message)
{
if (ch == channel)
{
if (message == "0%";)
{
llSetColor(zero_color,sides);
} else if (message == "20%";)
{
llSetColor(twenty_color,sides);
} else if (message == "40%";)
{
llSetColor(forty_color,sides);
} else if (message == "60%";)
{
llSetColor(sixty_color,sides);
} else if (message == "80%";)
{
llSetColor(eighty_color,sides);
} else if (message == "100%";)
{
llSetColor(hundred_color,sides);
}
}
}
}


Here's the same thing, but using transparency.

From: someone

integer sides;
integer channel;

float zero_alpha;
float twenty_alpha;
float forty_alpha;
float sixty_alpha;
float eighty_alpha;
float hundred_alpha;


list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
+ llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}


default
{
state_entry()
{
channel = (integer)(llFrand(-1000000000.0) - 1000000000.0); // random channel for dialog menu

llListen(channel,"",NULL_KEY,"";);

//Set alphas here
zero_alpha = 0.0; // 0% = transparent
twenty_alpha = 0.2; // 20%
forty_alpha = 0.4; // 40%
sixty_alpha = 0.6; // 60%
eighty_alpha = 0.8; // 80%
hundred_alpha = 1.0; // 100% = no transparency

sides = -1; // all sides
}

touch_start(integer total_number)
{

llDialog(llDetectedKey(0), "Please select a tint setting: ",order_buttons(["0%", "20%", "40%", "60%", "80%", "100%"]), channel);
}

listen(integer ch, string name, key id, string message)
{
if (ch == channel)
{
if (message == "0%";)
{
llSetAlpha(zero_alpha,sides);
} else if (message == "20%";)
{
llSetAlpha(twenty_alpha,sides);
} else if (message == "40%";)
{
llSetAlpha(forty_alpha,sides);
} else if (message == "60%";)
{
llSetAlpha(sixty_alpha,sides);
} else if (message == "80%";)
{
llSetAlpha(eighty_alpha,sides);
} else if (message == "100%";)
{
llSetAlpha(hundred_alpha,sides);
}
}
}
}
Jenny Sparrow
Registered User
Join date: 11 Mar 2007
Posts: 7
12-12-2008 16:23
Thank you! ;)

That's almost exactly what I need, just with color instead of transparency.
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-12-2008 16:34
You mean transparency instead of color? The first script uses color. The second uses transparency (see my edited previous post).
Jenny Sparrow
Registered User
Join date: 11 Mar 2007
Posts: 7
12-12-2008 16:48
That's perfect! Your the best! TYVM!
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-12-2008 16:53
You're welcome. Enjoy. :)