Wall transparency
|
|
Tito Polonsky
Registered User
Join date: 3 May 2005
Posts: 2
|
06-07-2005 13:42
I built a house and saw a place that had a wall darkener. I tryed to find a script to do that inworlds but had no luck. The house i saw had a button which set the transparency of the wall from completly transparent to black. I would apreciate any kind of help 
|
|
Eboni Khan
Misanthrope
Join date: 17 Mar 2004
Posts: 2,133
|
06-07-2005 15:46
From: Tito Polonsky I built a house and saw a place that had a wall darkener. I tryed to find a script to do that inworlds but had no luck. The house i saw had a button which set the transparency of the wall from completly transparent to black. I would apreciate any kind of help  tito I will drop it on you the next time I login.
|
|
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
|
06-08-2005 12:41
integer black=TRUE; default { state_entry() { llSetAlpha(1.0,ALL_SIDES); } touch_start(integer num_detected) { if(black) { llSetAlpha(0.0,ALL_SIDES); llSetColor(<1,1,1>,ALL_SIDES); //remove this line if you dont wanna mess with the color of the prim }else{ llSetAlpha(1.0,ALL_SIDES); llSetColor(<0,0,0>,ALL_SIDES); //remove this line if you dont wanna mess with the color of the prim } } }
Simply drop this in whatever wall you want to black out or go transparent, it will toggle on each touch.
_____________________
---------------------------------------------------------- --The mind's eye is limited only by its focus--
|
|
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
|
06-08-2005 12:53
or if you want walls that listen to a single button use the following script in the walls themselves: default { state_entry() { llSetAlpha(1.0,ALL_SIDES); llListen(9999,"",NULL_KEY,""); } listen(integer chan, string name, key id, string msg) { if(msg="solid") { llSetAlpha(0.0,ALL_SIDES); } if(msg="clear") { llSetAlpha(1.0,ALL_SIDES); } } }
and this script goes into the prim you're using as a button. I've added code to turn the button red for transparent and no color for black. integer black=FALSE; default { state_entry() {
} touch_start(integer num_detected) { if(black) { llShout(9999,"clear"); llSetColor(<1,0,0>,ALL_SIDES); }else{ llShout(9999,"solid"); llSetColor(<1,1,1>,ALL_SIDES); } black=!black; } }
All walls will turn opaque or transparent with each push of the on/off button. Make sure your walls are within 100meters of the button itself (SL limit on shout distance). I'm writing this from work so pardon me if the script might have a bug in it, but it looks ok from here. -Syn 
_____________________
---------------------------------------------------------- --The mind's eye is limited only by its focus--
|
|
Snakeye Plisskin
Registered User
Join date: 8 Apr 2005
Posts: 153
|
06-21-2005 19:03
This script seems to work for a split second when touching the button prim but flicks back to solid. If I manually change the wall prim to 90% transparency it changes the prim to solid. I'm not a programmer so not sure why it doen't work for me, prolly doing a newb thing. The button changes color as it should. 
|
|
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
|
06-22-2005 09:32
I logged into SL remotely thru my home computer from work (a very slow business indeed) and tried this out. Looks like it runs fine on the first on/off sequence but then fails to respond after that. I'm clueless at this point as to why but will continue to look at it.
_____________________
---------------------------------------------------------- --The mind's eye is limited only by its focus--
|
|
Barbarra Blair
Short Person
Join date: 18 Apr 2004
Posts: 588
|
06-22-2005 09:42
I think there is a bug with "else" in Linden scripts--you may be triggering the "else" everytime you reset conditions in your "if".
_____________________
--Obvious Lady
|
|
Barbarra Blair
Short Person
Join date: 18 Apr 2004
Posts: 588
|
06-22-2005 09:43
black is only true when you restart the script.
_____________________
--Obvious Lady
|
|
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
|
06-23-2005 11:29
DUH!  If I had a dollar for everytime I did this lol The section in the wall code that reads: if(msg="solid") { llSetAlpha(0.0,ALL_SIDES); } if(msg="clear") { llSetAlpha(1.0,ALL_SIDES); }
should be if(msg=="solid") { llSetAlpha(0.0,ALL_SIDES); } if(msg=="clear") { llSetAlpha(1.0,ALL_SIDES); }
Newb mistake and I still make it, the = should be == when doing comparisons.
_____________________
---------------------------------------------------------- --The mind's eye is limited only by its focus--
|
|
Snakeye Plisskin
Registered User
Join date: 8 Apr 2005
Posts: 153
|
06-24-2005 05:02
Cool, works nicely 
|
|
Sebastian Tyne
Registered User
Join date: 18 May 2005
Posts: 1
|
now..
06-27-2005 16:19
Just a couple of newbish questions on this.
How should I set up my sheet of glass (texture, color, etc.) to ensure this runs smoothly?
How should I modify the script to be constant semitransparant (tinted) glass viwing from one side and adjustable opaqueness on the other side.
EXAMPLE: House with tinted windows that you can always look out of but you can change to full black or slightly tinted with the controler to a viewer from the outside.
thanks for the help Sebastian
|
|
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
|
06-28-2005 09:38
To set this up, create 2 cube prims. Drop the wall code in one and the button code in the other. Press the button prim to see the wall appear & disappear. If you wanted only one side of the wall prim to go solid/clear, you'd modify the code as such: if(msg=="solid") { llSetAlpha(0.0,1); } if(msg=="clear") { llSetAlpha(1.0,1); }
Notice i changed the word "ALL_SIDES" to "1" in this instance. This means face 1 will go clear/solid but the rest wont. There are 6 sides to a cube prim, numbered 0 thru 5, 0 being the top of a newly created cube.
_____________________
---------------------------------------------------------- --The mind's eye is limited only by its focus--
|