Discussion: Really, really simple window blinds script
|
Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
|
10-26-2006 19:05
Follow the instructions inside the script below to create windows that have blinds you can open and close. Privacy is built-in, because the script works only for the owner of the window. It's crude, it's inelegant, but it's simple and it does the job! //Simple 3-state tintable windows script //Poppet McGimsie. 10/26/2006
//rez a prim and shape it the way you want (a good place to start getting your head around this script is to make a prim with the dimensions x=1.5, y=0.2 and z=1.5). Scale textures on the faces of the prim the way you want or need them to be either now or later on whenever you want.
//drop this script in your prim's contents and open the script by rightclicking it and selecting "open"
//enter the uuid's of the textures you wish to use for the 6 sides (0 to 5) of your prim for the "open" and "closed" blinds states, where indicated below. The ones I've provided are pretty ugly, so no doubt you'll want to change them.
//save the script to compile and use it by clicking the save button.
//this script is offered for free use, and must stay that way. It should always retain the permissions of yes modify/ yes copy / yes transfer whenever it is used. It should not be sold except as a part of an object that uses it as a script.
//Place your own UUIDs here for to suit your taste. To find the UUID's, open your inventory and rightclick on the texture you want to use and choose "copy Asset UUID." Paste the UUID between the quotation marks. Note that the ordering of the UUIDs here assume that sides 1 and 3 are the window's inside and outside faces, respectively. The other 4 sides are assumed to be the edges of the window (i.e. the parts that are inside the walls)
//open blind textures key open0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open1 = "e192ebd8-b92b-8557-ec19-15f4f70e77eb"; key open2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open3 = "996a74c9-b1cb-d358-23a5-04c888357088"; key open4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//closed blinds textures: key closed0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed1 = "e509fac6-4247-a4c9-db8d-1041d125a731"; key closed2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed3 = "cd78006a-32ba-cd04-be73-3f2f6f82b1bf"; key closed4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//reset blinds textures: these textures show the numbering on the sides of the cubes, and you probably will want to leave them the way they are. key reset0 = "06491157-f9a8-0077-eb4b-312615774a19"; key reset1 = "deb2b70d-dac0-8bee-91ed-0256838bc25b"; key reset2 = "de0c3d34-b6cb-b047-f592-968a285c5719"; key reset3 = "3c6b3170-0892-824e-cc75-484ae541aec0"; key reset4 = "3f5ba16d-4632-31e3-bcc3-2b6d1f549040"; key reset5 = "e4dc95a5-5402-9aaa-deaa-3064f099ddd4";
key owner; // Will be used to retrieve owner's key.
integer iChan = 1234; // channel door will listen for instructions from owner. You can change it byut don't forget to change the message down below to go along with the new number
integer bLock = FALSE; //window starts out unlocked
default { touch_start(integer num_detected) { owner = llGetOwner(); llOwnerSay("Say /1234 open, /1234 close or /1234 reset "); llListen(iChan,"",owner,""); } listen(integer iChan, string name, key id, string msg) { if (iChan == 1234 && id == owner && msg == "open") { llWhisper(0,"Opening shades..."); state open; } if (iChan == 1234 && id == owner && msg == "close") { llWhisper(0,"Close shades..."); state closed; } if (iChan == 1234 && id == owner && msg == "reset") { llWhisper(0,"Resetting window..."); state reset; } } }
state open {state_entry() { llSetTexture(open0,0); llSetTexture(open1,1); llSetTexture(open2,2); llSetTexture(open3,3); llSetTexture(open4,4); llSetTexture(open5,5); state default; } } state closed { state_entry() {llSetTexture(closed0,0); llSetTexture(closed1,1); llSetTexture(closed2,2); llSetTexture(closed3,3); llSetTexture(closed4,4); llSetTexture(closed5,5); state default; } } state reset { state_entry() { llSetTexture(reset0,0); llSetTexture(reset1,1); llSetTexture(reset2,2); llSetTexture(reset3,3); llSetTexture(reset4,4); llSetTexture(reset5,5); state default; } }
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Original Thread
10-27-2006 08:58
_____________________
i've got nothing. 
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
The dialog box controlled version
10-27-2006 22:41
Every good script call out for hud control, so i could not help myself, here is the dialog box controlled version. I have already used a version of this to check out my windows and textures, thanks Poppet! The llListen already specifies on what channel we listen to the owner, so there is no need to check them again in the listen call back routine. //Simple 3-state tintable windows script //Poppet McGimsie. 10/26/2006 //ed44 Gupte modified for hud control - 28 Oct 2006
//rez a prim and shape it the way you want (a good place to start getting your head around this script is to make a prim with the dimensions x=1.5, y=0.2 and z=1.5). Scale textures on the faces of the prim the way you want or need them to be either now or later on whenever you want.
//drop this script in your prim's contents and open the script by rightclicking it and selecting "open"
//enter the uuid's of the textures you wish to use for the 6 sides (0 to 5) of your prim for the "open" and "closed" blinds states, where indicated below. The ones I've provided are pretty ugly, so no doubt you'll want to change them.
//save the script to compile and use it by clicking the save button.
//this script is offered for free use, and must stay that way. It should always retain the permissions of yes modify/ yes copy / yes transfer whenever it is used. It should not be sold except as a part of an object that uses it as a script.
//Place your own UUIDs here for to suit your taste. To find the UUID's, open your inventory and rightclick on the texture you want to use and choose "copy Asset UUID." Paste the UUID between the quotation marks. Note that the ordering of the UUIDs here assume that sides 1 and 3 are the window's inside and outside faces, respectively. The other 4 sides are assumed to be the edges of the window (i.e. the parts that are inside the walls)
//open blind textures key open0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open1 = "e192ebd8-b92b-8557-ec19-15f4f70e77eb"; key open2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open3 = "996a74c9-b1cb-d358-23a5-04c888357088"; key open4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//closed blinds textures: key closed0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed1 = "e509fac6-4247-a4c9-db8d-1041d125a731"; key closed2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed3 = "cd78006a-32ba-cd04-be73-3f2f6f82b1bf"; key closed4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//reset blinds textures: these textures show the numbering on the sides of the cubes, and you probably will want to leave them the way they are. key reset0 = "06491157-f9a8-0077-eb4b-312615774a19"; key reset1 = "deb2b70d-dac0-8bee-91ed-0256838bc25b"; key reset2 = "de0c3d34-b6cb-b047-f592-968a285c5719"; key reset3 = "3c6b3170-0892-824e-cc75-484ae541aec0"; key reset4 = "3f5ba16d-4632-31e3-bcc3-2b6d1f549040"; key reset5 = "e4dc95a5-5402-9aaa-deaa-3064f099ddd4";
key owner; // Will be used to retrieve owner's key.
integer iChan = 1234; // channel door will listen for instructions from owner. You can change it byut don't forget to change the message down below to go along with the new number
integer bLock = FALSE; //window starts out unlocked
string prompt = "Press one of the three buttons";
list buttons = ["reset", "open", "close"];
doReset () { llSetTexture(reset0,0); llSetTexture(reset1,1); llSetTexture(reset2,2); llSetTexture(reset3,3); llSetTexture(reset4,4); llSetTexture(reset5,5); }
doOpen () { llSetTexture(open0,0); llSetTexture(open1,1); llSetTexture(open2,2); llSetTexture(open3,3); llSetTexture(open4,4); llSetTexture(open5,5); }
doClose () { llSetTexture(closed0,0); llSetTexture(closed1,1); llSetTexture(closed2,2); llSetTexture(closed3,3); llSetTexture(closed4,4); llSetTexture(closed5,5); }
default { touch_start(integer num_detected) { owner = llGetOwner(); llListen(iChan,"",owner,""); llDialog(owner, prompt, buttons, iChan); } listen(integer iChan, string name, key id, string msg) { if (msg == "open") { llWhisper(0,"Opening shades..."); doOpen (); } else if (msg == "close") { llWhisper(0,"Close shades..."); doClose (); } else if (msg == "reset") { llWhisper(0,"Resetting window..."); doReset (); } llDialog(owner, prompt, buttons, iChan);
}
}
|
Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
|
Excellent!
10-28-2006 10:49
I couldn't figure out how to use dialog windows in a simple way, and so I am delighted to see this adaptation that perserves (indeed, increases) the simplicity of the script!
Thanks so very much. Ed44!
(should I update the php code in my original post?)
|
Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
|
11-01-2006 05:10
HUD control is wonderful -- but the advantage of the original code is that you can click on a bunch of windows and then type in /1234 close (or whatever) and close the whole bunch of them at once.
Is there any way to do that with HUD control that's simple?
|
Tommy Sikorsky
Registered User
Join date: 7 Oct 2006
Posts: 5
|
Simple window blinds script
12-24-2006 13:48
Bump Bump
Is it possible to make this script work for multiple windows at once without clicking each of them. I have seen things like a light switch in world that open or close (or make opaque) all windows in a house.
|
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
|
12-24-2006 15:00
In the version below: - You can link multiple windows together, so they are then controllable as one. - Cleaned up the listener code. Reduces lag for many windows. - Fixed the window owner restriction code. -peekay //Simple 3-state tintable windows script //Poppet McGimsie. 10/26/2006 //ed44 Gupte modified for hud control - 28 Oct 2006 //Peekay Semyorka added multi-linked window support - 24 Dec 2006
//rez a prim and shape it the way you want (a good place to start getting your head around this script is to make a prim with the dimensions x=1.5, y=0.2 and z=1.5). Scale textures on the faces of the prim the way you want or need them to be either now or later on whenever you want.
//drop this script in your prim's contents and open the script by rightclicking it and selecting "open"
//enter the uuid's of the textures you wish to use for the 6 sides (0 to 5) of your prim for the "open" and "closed" blinds states, where indicated below. The ones I've provided are pretty ugly, so no doubt you'll want to change them.
//save the script to compile and use it by clicking the save button.
//if you link multiple windows together, all of them will open/close/reset together
//this script is offered for free use, and must stay that way. It should always retain the permissions of yes modify/ yes copy / yes transfer whenever it is used. It should not be sold except as a part of an object that uses it as a script.
//Place your own UUIDs here for to suit your taste. To find the UUID's, open your inventory and rightclick on the texture you want to use and choose "copy Asset UUID." Paste the UUID between the quotation marks. Note that the ordering of the UUIDs here assume that sides 1 and 3 are the window's inside and outside faces, respectively. The other 4 sides are assumed to be the edges of the window (i.e. the parts that are inside the walls)
//open blind textures key open0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open1 = "e192ebd8-b92b-8557-ec19-15f4f70e77eb"; key open2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open3 = "996a74c9-b1cb-d358-23a5-04c888357088"; key open4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key open5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//closed blinds textures: key closed0 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed1 = "e509fac6-4247-a4c9-db8d-1041d125a731"; key closed2 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed3 = "cd78006a-32ba-cd04-be73-3f2f6f82b1bf"; key closed4 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad"; key closed5 = "c2216819-cea6-eb1c-b7c2-5b1f3f8472ad";
//reset blinds textures: these textures show the numbering on the sides of the cubes, and you probably will want to leave them the way they are. key reset0 = "06491157-f9a8-0077-eb4b-312615774a19"; key reset1 = "deb2b70d-dac0-8bee-91ed-0256838bc25b"; key reset2 = "de0c3d34-b6cb-b047-f592-968a285c5719"; key reset3 = "3c6b3170-0892-824e-cc75-484ae541aec0"; key reset4 = "3f5ba16d-4632-31e3-bcc3-2b6d1f549040"; key reset5 = "e4dc95a5-5402-9aaa-deaa-3064f099ddd4";
// channel door will listen for instructions from owner integer iChan = 1234;
// the menu will timeout after this number of seconds integer TIMEOUT_SECS = 60;
string prompt = "Press one of the three buttons"; list buttons = ["open", "close", "reset"];
// internal listen handler, do not change integer hMenu = -1;
doReset () { llSetTexture(reset0,0); llSetTexture(reset1,1); llSetTexture(reset2,2); llSetTexture(reset3,3); llSetTexture(reset4,4); llSetTexture(reset5,5); }
doOpen () { llSetTexture(open0,0); llSetTexture(open1,1); llSetTexture(open2,2); llSetTexture(open3,3); llSetTexture(open4,4); llSetTexture(open5,5); } doClose () { llSetTexture(closed0,0); llSetTexture(closed1,1); llSetTexture(closed2,2); llSetTexture(closed3,3); llSetTexture(closed4,4); llSetTexture(closed5,5); }
stopListen() { llSetTimerEvent(0); if (hMenu != -1) { llListenRemove(hMenu); hMenu = -1; } }
default { touch_start(integer num_detected) { key owner = llGetOwner(); integer i; for (i = 0; i < num_detected; i++) { if (owner == llDetectedKey(i)) { hMenu = llListen(iChan,"",owner,""); llDialog(owner, prompt, buttons, iChan); llSetTimerEvent(TIMEOUT_SECS); } } }
listen(integer iChan, string name, key id, string msg) { stopListen(); if (msg == "open") { llWhisper(0,"opening shades..."); } else if (msg == "close") { llWhisper(0,"closing shades..."); } else if (msg == "reset") { llWhisper(0,"resetting shades..."); } else { llOwnerSay("Ignoring unknown command: " + msg); return; } llMessageLinked(LINK_SET, 0, msg, NULL_KEY); }
link_message(integer sender_num, integer num, string msg, key id) { if (msg == "open") { doOpen (); } else if (msg == "close") { doClose (); } else if (msg == "reset") { doReset (); } } timer() { stopListen(); } }
|
Tommy Sikorsky
Registered User
Join date: 7 Oct 2006
Posts: 5
|
Simple window blinds script
12-24-2006 16:49
Peekay!!
Thank you. Merry Christmas.
|
Pompo Bombacci
Some designer :)
Join date: 25 Jul 2006
Posts: 69
|
01-04-2007 10:32
Go it! The only probs I have since its sunglasses is: how do I change the commands on the control panel to show " darker" and "orange" instead of saying " open" "close". I tried changing it but it keeps saying "ignoring command" or something Man that is killer I wish I can fix it..PLZ  ))
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-04-2007 16:12
From: Pompo Bombacci Go it! The only probs I have since its sunglasses is: how do I change the commands on the control panel to show " darker" and "orange" instead of saying " open" "close". I tried changing it but it keeps saying "ignoring command" or something Man that is killer I wish I can fix it..PLZ  )) You need to change the button definitions line and also the listen event handler
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
01-05-2007 03:10
From: Peekay Semyorka In the version below:
- You can link multiple windows together, so they are then controllable as one.
- Cleaned up the listener code. Reduces lag for many windows.
- Fixed the window owner restriction code.
-peekay
Peekay, looking at your code (and I'm not in world right now to check), if you linked multiple windows together with the same script in, wouldn't all of them be listening on the same channel and therefore hear the same dialog responses? I'd recommend having each script listen on a different channel, either by using random numbers or by adding the result of llGetLinkNumber () to the channel.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-05-2007 03:16
From: Stephen Zenith Peekay, looking at your code (and I'm not in world right now to check), if you linked multiple windows together with the same script in, wouldn't all of them be listening on the same channel and therefore hear the same dialog responses?
I'd recommend having each script listen on a different channel, either by using random numbers or by adding the result of llGetLinkNumber () to the channel. The whole idea is that all the windows will react as one, i.e. change every window in the house in one go.
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
01-05-2007 03:20
From: Newgate Ludd The whole idea is that all the windows will react as one, i.e. change every window in the house in one go. Yes, but in Peekays version, getting all of the windows to act as one is accomplished by sending link messages to the other windows.
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-05-2007 04:11
From: Stephen Zenith Yes, but in Peekays version, getting all of the windows to act as one is accomplished by sending link messages to the other windows. Ah, I see your point, would possibly make the whole building change if you had linked the windows in to it.
|
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
|
01-05-2007 04:49
In the original version, there was one listener per window, and the listener was always active. So yes for n-windows there would be n-listeners all on the same channel.
In my version, there is only one listener regardless of the number of windows, and only while the user interacts with the menu. Therefore there is no need to assign different channels to different windows.
Crosstalk could happen if the window owner deliberately clicks on one window after another without selecting anything from the dialogs, activating listeners in each of them. Still, no harm from the crosstalk (no window could get out of sync) and in any case all the listeners timeout within 60 seconds.
-peekay
|
Boobie Douglas
Registered User
Join date: 6 Feb 2007
Posts: 9
|
03-19-2007 17:34
This is a very handy script. Thanks a bunch for posting it. I am wondering if there is an easy way to modify it so that the owner can add users to allow operation. I am not a scripter and have no idea how to achieve that but I know its possible. Thanks again!
|