Window Tinting Script
|
|
Abba Thiebaud
PerPetUal NoOb
Join date: 20 Aug 2006
Posts: 563
|
01-02-2007 11:04
Somewhere, either in the library or in the wiki, I found a great menu based tinting system for windows in a home. I have searched for three days now and cannot find it.
The way it works is there's a script in the "window" itself that doesn't do anything without the "tint controller". Touch the controller prim and you get a blue menu giving you the options of 0-100% tinting (in 20% increments). Pick a number and watch the window change tint.
Anywho the script I got, has been modified/retyped quite a few times, put a bunch of new comments in it, made it usable on multiple windows with different tints and I wanted to give credit where credit is due, but I've already misplaced the original script. (duh!)
Anyone know which one I'm talking about?
Thanks in advance.
A
|
|
Krazzora Zaftig
Do you have my marbles?
Join date: 20 Aug 2005
Posts: 649
|
01-02-2007 12:36
not really but if you find it and it is open source toss me a copy. I currently have one I am working on that will do that, change textures (glass, no texture, blinds, and rude). It also does door scripting. Sadly mine isn't configurable to much for other houses. i'm slightly rebuilding it for a each house, etc and it's not done yet. Right now about 50% done and not functional at all (slight scipting flaws).
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
01-02-2007 12:44
if you go to the SL start areas (Help Island), there is a free house called the BSD Archer House. It has a menu driven window tinting script installed in it that is open source, and quite good. you just have to pull the scripts out of the related pieces. 
|
|
Abba Thiebaud
PerPetUal NoOb
Join date: 20 Aug 2006
Posts: 563
|
01-02-2007 14:22
Thanks, but I *have* a working script. It's based on someone elses that I picked up somewhere and can't find now. I just wanted to give credit where it was due so when I post it in the forum it's acknowledged that it's not all my work. I have the freebie house you mentioned, but never thought of doing that! (again, duh!) The search continues.....  A
|
|
Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
|
window tinter
01-03-2007 09:30
Abba, I have given out several copies of a window tinter that uses dialog to go I think 10,30,50,70,90,100 percent tinted (transparant) if it was mine go for it, no need to give names, if anything just say you moded a free script. I am sure many people would love a free multi window tinter.
|
|
Abba Thiebaud
PerPetUal NoOb
Join date: 20 Aug 2006
Posts: 563
|
01-06-2007 16:42
From: Perwin Rambler Abba, I have given out several copies of a window tinter that uses dialog to go I think 10,30,50,70,90,100 percent tinted (transparant) if it was mine go for it, no need to give names, if anything just say you moded a free script. I am sure many people would love a free multi window tinter. That's what I'm working on. Not exactly ready for release yet, but it's based on the freebie I found somewhere, which may in fact be yours. The one I have does not have the info on the writer in the comments anywhere (I found my original Word doc that had all the comments in it) so I hope it's yours then.  What I'm working on is specific to the "rounded edge skybox" that I use. (_____) <--- this with a roof, basically. Using any textures/colors you want, it's set to have one controller that makes changes in the transparency for any single section or all. (Ceiling, left side, right side, front, back, floor, all). It could probably work with any build with some mods, I just wanted something that would allow me to control all the different areas without having a different control prim for each section I want to change. It basically asks you (via menu) which section (or all) you want to change, then a submenu with the percentage. You click it and it does the work. When I have it complete, I'll post it for critique (first attempt at something this big) and anyone's use, if they want it. A
|
|
Abba Thiebaud
PerPetUal NoOb
Join date: 20 Aug 2006
Posts: 563
|
01-07-2007 13:44
Window tinting script using menu based options for a two story building, but can be modified however you'd like for whichever building style you have. This script controls several windows with one controller, varying the tinting from window to window as you choose the transparency level. Critiques are appreciated and welcomed! OK, main script (which goes into the controller prim) // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // (C) 2007 Abba Thiebaud>SecondLifer // Please remember, I do not offer support for this script; your use of // this script is your acknowledgement and agreement to the above // terms. // // DO NOT REMOVE THE ABOVE HEADER FOR ANY REASON WHATSOEVER.
// Window Controller Script (put into controller prim) list TINT_OPTIONS = ["40%", "20%", "None", "100%", "80%", "60%"]; list WALL_OPTIONS = ["Lower Front", "Lower Back", "Lower Sides", "Upper Front", "Upper Back", "Upper Sides", "Ceiling", "All"]; integer UPPER_FRONT = -28394; integer LOWER_FRONT = -28395; integer UPPER_BACK = -28396; integer LOWER_BACK = -28397; integer UPPER_SIDE = -28398; integer LOWER_SIDE = -28399; integer CEILING = -28400; integer CHANNEL = -28393; integer wallChannel; integer allWalls;
PaintAllWalls(string tintLevel) { integer i; integer j; j = -28394;
for (i = 0; i < 7; i++) { llSay(j, tintLevel); j--; } // end for } // end PaintAllWalls default { state_entry() { llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users) } // end state_entry() touch_start(integer total_number) { llDialog(llDetectedKey(0), "Which wall would you like to tint?", WALL_OPTIONS, CHANNEL); // present dialog on click allWalls = 0; } // end touch_start() listen(integer channel, string name, key id, string message) { if (llListFindList(TINT_OPTIONS + WALL_OPTIONS, [message]) != -1) // verify dialog choice { if (message == "Upper Front") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = UPPER_FRONT; } else if (message == "Upper Back") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = UPPER_BACK; } else if (message == "Upper Sides") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = UPPER_SIDE; } else if (message == "Lower Front") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = LOWER_FRONT; } else if (message == "Lower Back") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = LOWER_BACK; } else if (message == "Lower Sides") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = LOWER_SIDE; } else if (message == "Ceiling") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); wallChannel = CEILING; } else if(message == "All") { llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); allWalls = 1; }
if (message == "100%") { if(allWalls == 1) { PaintAllWalls("100"); } else { llSay(wallChannel, "100"); } } else if (message == "80%") { if(allWalls == 1) { PaintAllWalls("80"); } else { llSay(wallChannel, "80"); } } else if (message == "60%") { if(allWalls == 1) { PaintAllWalls("60"); } else { llSay(wallChannel, "60"); } } else if (message == "40%") { if(allWalls == 1) { PaintAllWalls("40"); } else { llSay(wallChannel, "40"); } } else if (message == "20%") { if(allWalls == 1) { PaintAllWalls("20"); } else { llSay(wallChannel, "20"); } } else if (message == "None") { if(allWalls == 1) { PaintAllWalls("0"); } else { llSay(wallChannel, "0"); } } } // end if (valid message) } // end listen } // end default And the window script (which goes into the actual windows) // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // (C) 2007 Abba Thiebaud>SecondLifer // Please remember, I do not offer support for this script; your use of // this script is your acknowledgement and agreement to the above // terms. // // DO NOT REMOVE THE ABOVE HEADER FOR ANY REASON WHATSOEVER. // // // //Here the target (aka Windows), put this script into them. //integer chan = -28394; // uncomment for UPPER_FRONT //integer chan = -28395; // uncomment for LOWER_FRONT //integer chan = -28396; // uncomment for UPPER_BACK //integer chan = -28397; // uncomment for LOWER_BACK //integer chan = -28398; // uncomment for UPPER_SIDE //integer chan = -28399; // uncomment for LOWER_SIDE //integer chan = -28400; // uncomment for CEILING
//START SCRIPT default { state_entry() { llListen(chan, "", NULL_KEY, "" ); }
listen( integer channel, string name, key id, string message ) { if ( message == "100" ) { llSetAlpha(1.0, ALL_SIDES); } else if ( message == "80" ) { llSetAlpha(0.8, ALL_SIDES); } else if ( message == "60" ) { llSetAlpha(0.6, ALL_SIDES); } else if ( message == "40" ) { llSetAlpha(0.4, ALL_SIDES); } else if ( message == "20" ) { llSetAlpha(0.2, ALL_SIDES); } else if ( message == "0" ) { llSetAlpha(0.0, ALL_SIDES); } } } //////END SCRIPT
|
|
Paskis Robinson
Registered User
Join date: 28 Jun 2006
Posts: 51
|
01-07-2007 19:52
I sell a window tint script for $20L that can optionally use a remote; can have its tint levels set; can be limited to use by AVs by name; and can relay the message to cover windows over a wide area. Check my 'picks' in world.
|
|
Abba Thiebaud
PerPetUal NoOb
Join date: 20 Aug 2006
Posts: 563
|
01-07-2007 21:14
From: Paskis Robinson I sell a window tint script for $20L that can optionally use a remote; can have its tint levels set; can be limited to use by AVs by name; and can relay the message to cover windows over a wide area. Check my 'picks' in world. Yes. I appreciate that. But it defeats the purpose of the challenge to write it myself. Any comments on the code that was posted? I'd love to hear from experienced scripters, such as yourself. It'll help me improve and jog my mind for things I hadn't thought of. A
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-08-2007 01:03
From: Abba Thiebaud Yes. I appreciate that. But it defeats the purpose of the challenge to write it myself. Any comments on the code that was posted? I'd love to hear from experienced scripters, such as yourself. It'll help me improve and jog my mind for things I hadn't thought of. A In the wall colouring code, If you reordered your lists , or made a list of channels, you could use a straight llListFindList call to find the particular channel rather than multiple if statements. You can also improve the efficiency of your code by short cutting the tint calculation. Rather than using multiple if's you can use a straight cast. (None would become 0) I'd also suggest that rather than using one string just to send another ("100%" -> "100"  could be improved by just passing on the original string. The calculation above would still work. list WALL_OPTIONS = ["Lower Front", "Lower Back", "Lower Sides", "Upper Front", "Upper Back", "Upper Sides", "Ceiling", "All"];
list WallChannels = [-28395,-28397,-28399,-28394,-28396,-28398,-28400];
Then in the listen integer index = llListFindList(WALL_OPTIONS, [message]); if (index != -1) // verify dialog choice { if (message == "All") { allWalls = 1; } else { allWalls = 0; wallChannel = llList2Integer(WallChannels,index); } llDialog(id, "How much tint would you like?", TINT_OPTIONS, CHANNEL); } else { integer index = llListFindList(TINT_OPTIONS, [message]); if (index != -1) // verify dialog choice { if(allWalls == 1) { PaintAllWalls(message); } else { llSay(wallChannel, message); } } }
In the window code listen( integer channel, string name, key id, string message ) { // the cast will stop at the first non numeric character float value = ( (integer)message / 100.0 ); }
|
|
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
|
01-10-2007 06:29
llMessageLinked?
To control every prim in the object.... I'd look at going through the linkset pulling the link numbers and names of each prim (run two parallel lists or one of those headachy strided ones to store the link number and prim name), then using those to send the linkmessage command.
That way it would work with every prim in the linkset that you give a name to. Maybe? You could add prims and not have to recode the script, just make it update its list(s).
You could then use the list of identified prims to generate the menu. And send to link number -1 for "all". You could go further with a third list/dimension and use prim descriptions to store some descriptive codeword like "window" "floor" "wall" and have the menu tint all windows, floors or walls. I think. I haven't written LSL that does that, it just looks like it might work.
_____________________
Ace's Spaces! at Deco (147, 148, 24) ace.5pointstudio.com
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-10-2007 12:47
From: Ace Albion llMessageLinked?
To control every prim in the object.... I'd look at going through the linkset pulling the link numbers and names of each prim (run two parallel lists or one of those headachy strided ones to store the link number and prim name), then using those to send the linkmessage command.
That way it would work with every prim in the linkset that you give a name to. Maybe? You could add prims and not have to recode the script, just make it update its list(s).
You could then use the list of identified prims to generate the menu. And send to link number -1 for "all". You could go further with a third list/dimension and use prim descriptions to store some descriptive codeword like "window" "floor" "wall" and have the menu tint all windows, floors or walls. I think. I haven't written LSL that does that, it just looks like it might work. LINK_SET is preferable to -1 (its a defined constant) You cannot read the description but you can read the name. I used that idea in one version of a similar tool I have.
|