Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

newbie question

Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
06-15-2005 14:19
Hello,

Newbie scripter here with a question :)

I want a script similar to some security scripts wherein the textures (say on the windows for instance) can be changed on command. Typically, one types "blinds" or some such thing, and the windows become opaque.

I have looked in the Wiki and the necessary functions are there and that makes sense, but for a newbie it is waaay preferable to have an actual script to alter as oposed to starting from scratch.

Does anyone know where to get such a thing?

The part that is really unclear to me is exactly how to word it to change only *one* texture on a prim and not the whole prim.

Both the manner in which one refers to the prim face and the kind of logic necessary to change a lot of prims at once is not too clear in the Wiki IMO.
_____________________
.
black
art furniture & classic clothing
===================
Black in Neufreistadt
Black @ ONE
Black @ www.SLBoutique.com


.
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
06-15-2005 15:17
Unfortunately, I don't have a script handy, but I did try to clarify the bit about faces. See "side" for more. That bit of the wiki could use some cleanup... I'll get to it when I can.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
06-15-2005 17:49
From: Catherine Omega
Unfortunately, I don't have a script handy, but I did try to clarify the bit about faces. See "side" for more. That bit of the wiki could use some cleanup... I'll get to it when I can.
Tx Catherine :)
dont know how i missed that.
_____________________
.
black
art furniture & classic clothing
===================
Black in Neufreistadt
Black @ ONE
Black @ www.SLBoutique.com


.
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
06-15-2005 20:59
From: Dianne Mechanique
Tx Catherine :)
dont know how i missed that.
Well, probably because it was buried. I've been watching the forums, looking for questions and clarifications. This is an important one, and I'm sure it gets asked a lot, so I linked to it from all the relevant pages in their respective Q&A sections.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
06-16-2005 16:35
Don't make it on voice-command unless you must! You can probably just click on the window and have it toggle, which will reduce lag.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
06-19-2005 08:09
From: Zindorf Yossarian
Don't make it on voice-command unless you must! You can probably just click on the window and have it toggle, which will reduce lag.
Unfortunately I have to as I have over a hundred windows to change at the same time.

I dont really know where to start though.

Would one use scripts located in each individual prim/window that are activated by the voice command?

Or would it be a single script in some kind of "controler" prim that cycles through each window by ID number telling the windows to change?

.
_____________________
.
black
art furniture & classic clothing
===================
Black in Neufreistadt
Black @ ONE
Black @ www.SLBoutique.com


.
Olmy Seraph
Valued Member
Join date: 1 Nov 2004
Posts: 502
06-19-2005 08:46
From: Dianne Mechanique
Unfortunately I have to as I have over a hundred windows to change at the same time.

I dont really know where to start though.

Would one use scripts located in each individual prim/window that are activated by the voice command?

Or would it be a single script in some kind of "controler" prim that cycles through each window by ID number telling the windows to change?


Well, you really don't want over 100 open listeners. That would lag your sim something fierce.

You'll still need a script in each window prim, but you won't be using llListen for each one. Instead, you'll rely on link messages, which are more like events and don't incur the same kind of overhead while inactive.

1) Choose a controller prim. Usually the root prim of the build is the best choice, but it's not required to be the root. You can go three ways for activating the blinds: touch activated, private listener, open listener.

touch activated: I like this kind of interface for building automation. Create a controller prim that responds to touch events. You touch it, all the blinds on the building open or close. You can even have several of these scattered around the house. If you want the controller to toggle all blinds, you just do that on touch. If you want more control, you can use dialogs to present choices such as selecting which floor's blinds to open.

private listener: Just one prim listens on a non-zero channel, such as 66. To activate, you say "/66 blinds open". Listening on a non-zero or private channel is nice in that your commands don't spam other people, but moreso because it causes less lag.

open listener: Just one prim listens on channel 0. To activate, say "blinds open" or whatever. This is pretty convenient, but can be a bit laggy when there are lots of avs or other scripts listening on channel 0.

For either private or open listener, you may need several around the build depending on how large it is. If it's less than 40m across, you can get away with just one in the center. If your build is larger than that, you'll be linking in multiple sections anyway, so you'll need multiple listeners or controller prims anyway.

Whichever you choose, how it works is the controller prim receives the command, then uses a link message to thell the window blinds to open/close.

2) Put a blinds script in each window prim. This script has a link_message event handler that opens or closes the blind.

If you are using two textures for the different open/close appearances, you will use llSetTexture("blinds open", BlindSide), where BlindSide is the face of the blind. The other way to do it is to have both appearances on the same texture, and just offest the texture so that one or the other half is displayed as appropriate: llOffsetTexture(0.0, OpenOffset, BlindSide). Using the offset approach is nice as you don't force a new texture download, so it's pretty fast.

3) The controller prim uses llMessageLinked to open/close blinds. The window prims will get the link message and react. You don't need to cycle through all the window prims - just use the LINK_SET constant to broadcast to all prims in the link. Link messages that aren't handled explicitly by another prim's script have no effect and are ignored.

4) If you want to, you can have a touch event in each window prim too, so you can control each window individually as well as en masse. Or you could have every window prim act as a controller for all window blinds - each touch would use llMessageLinked(LINK_SET, ...) to broadcast the open/close toggle to all window blind prims.
_____________________
Some people are like Slinkies... not really good for anything, but they sure bring a smile to your face when you push them down the stairs.
Dianne Mechanique
Back from the Dead
Join date: 28 Mar 2005
Posts: 2,648
06-20-2005 07:14
Wow,
thanks for the detailed info Olmy.
If I cant do it with all this help, I dont deserve to be in SL at all.

I will let you know how it goes, and I owe you one.
thank you

:)
_____________________
.
black
art furniture & classic clothing
===================
Black in Neufreistadt
Black @ ONE
Black @ www.SLBoutique.com


.