Script: Theme Texture Change v2
Documentation · Theme Texture Change
Version 2 is on the works. Watch this space for news. Current state: BETA TEST.
[Black Tulip] Script - Theme Texture Change v2 in Marketplace.
Follow these directions carefully. Complete the several Step by Step Guides in the first place, then check the rest of the sections. There's a Troubleshooting section at the end. Before asking for help, check that your problem isn't one of the problems described in there. There's a section in this documentation meant for advanced users. Its purpose is to provide more concise and to the point information so they don't have to wade through long tutorials. Still, having a look at the step by step guides is recommended.
License of Use: Click here to read the License of use.
What's included in your purchase
Check that your box contains the following assets:
- [Black Tulip] Theme Texture Change v2 - AUX TOOL
- [Black Tulip] Theme Texture Change v2
- [Black Tulip] Theme Texture Change v2 ~CFG~
- [Black Tulip] Do Not Texture This Side
- [Black Tulip] Proof Of Purchase - Theme Texture Change v2
- [Black Tulip] Theme Texture Change v2 ~DOC~
- [Black Tulip] Normal map - NO NORMAL (32x32)
- [Black Tulip] Specular map - NO SPECULAR (32x32)
- [Black Tulip] Theme Texture Change v2 - POSES ADDON
- [Black Tulip] Theme Texture Change v2 - HUD SCRIPT
- [Black Tulip] Theme Texture Change v2 - HUD SCRIPT ~CFG~
- [Black Tulip] TTCv2 - Items for Tutorial (boxed/folder)
- [Black Tulip] Swing
- [Black Tulip] Test Box
- [Black Tulip] Chair for Texture Change V2
- [Black Tulip] Table for Texture Change V2
- [Black Tulip] TTCv2 - Notecards for Tutorial (boxed/folder)
- [BT]:Swing - Dark Brown
- [BT]:Swing - Light Brown
- [BT]:Swing - White
- [BT]:Swing - Dark BrownREMOVETHISTEXT
- [BT]:Swing - Light BrownREMOVETHISTEXT
- [BT]:Swing - WhiteREMOVETHISTEXT
- [BT]:ALPHA:Legs 25%
- [BT]:ALPHA:Legs 50%
- [BT]:ALPHA:Top 25%
- [BT]:ALPHA:Top 50%
- [BT]:COLOR:Legs Magenta
- [BT]:COLOR:Legs Red
- [BT]:COLOR:Top Magenta
- [BT]:COLOR:Top Red
- [BT]:Legs:Light Brown
- [BT]:Legs:Dark Brown
- [BT]:Top:Light Brown
- [BT]:Top:Dark Brown
- [Black Tulip] TTCv2 - Sample HUD (boxed/folder)
- [Black Tulip] Table for Texture Change V2 - Needs HUD - Master
- [Black Tulip] Table for Texture Change V2 - Needs HUD - Slave
- [Black Tulip] Table for Texture Change V2 - Needs HUD
- [Black Tulip] TTCv2 - Sample HUD
- [Black Tulip] TTCv2 - Sample Scripts for API (boxed/folder)
- [Black Tulip] TTCv2 - llMessageLinked sample
- [Black Tulip] TTCv2 - llRegionSay sample
- [Black Tulip] TTCv2 - Textures for Tutorial (boxed/folder)
- [Black Tulip] Swing - Metal
- [Black Tulip] Swing - Wood - Dark Brown
- [Black Tulip] Swing - Wood - Light Brown
- [Black Tulip] Swing - Wood - White
- [Black Tulip] SwingLegs - Dark Brown
- [Black Tulip] SwingLegs - Light Brown
- [Black Tulip] SwingLegs - White
- [Black Tulip] Chair Legs - Dark Brown
- [Black Tulip] Chair Legs - Green
- [Black Tulip] Chair Legs - Light Brown
- [Black Tulip] Chair Legs - White
- [Black Tulip] Chair Seat - Dark Green
- [Black Tulip] Chair Seat - Dark Red
- [Black Tulip] Chair Seat - Dark Red Two
- [Black Tulip] Table Legs - Dark Brown
- [Black Tulip] Table Legs - Green
- [Black Tulip] Table Legs - Light Brown
- [Black Tulip] Table Legs - White
- [Black Tulip] Table Top - Dark Brown
- [Black Tulip] Table Top - Green
- [Black Tulip] Table Top - Light Brown
- [Black Tulip] Table Top - White
If any of these is missing, contact Auryn Beorn for a replacement.
- Auxiliary tool with clean web output
- Works with materials/non materials
- Reads relevant prims from name or description (compatibility with UniDoor and KoolDoor)
- Back to AVsitter 2 button or any other application you need
- Define default access mode
- Demo mode for stores: load a theme after a given time
- Works with RLV in AVsitter 2
- The [MODULE] script is no longer necessary: everything is handled by the same script
- Separate unlinked objects have a common menu (for example, swings or big houses)
- Special menus to change color only or transparency only
- Create texture change HUDs with the HUD script
- Poses Add-On: Change the texture depending on which pose is being played in AVsitter 2
- Complete tutorial objects and textures included
- Scripting API
Step by Step Guide: The auxiliary tool (Let's start with a box)
Let's begin by rezzing a box. Write t;myBox in its description field, as the image shows:
Set a different color to each face of the box. For example:
Drop the [Black Tulip] Theme Texture Change v2 - AUX TOOL script in its contents.
Click on the box to get the auxiliary tool menu.
Now click on "Create!" and wait while the texture lines are being output. You can choose to copy them to a notecard (its name, we'll indicate it later), or you can choose to open the link that shows at the end of all the texture lines. The link has the following aspect:
When you open the link in your browser, you will have text like this one:
Select the text. CTRL C to copy it. Now create a notecard named:
and paste in it (CTRL V) the text you've copied from your browser. Your notecard will look like:
Excellent! You've created your first texture theme. Keep the [BT]:Plywood Colors. We'll need it later.
What have we learned so far:
- We have to write a description in the prims that will change their texture.
- This description begins by t; and then the text we want (minus the # character)
- We have dropped the auxiliary tool and created a theme using the menu.
- We have created a texture theme notecard with the web output.
- The texture theme notecard has a name that begins with [BT]: (Yes, there's a : after [BT]; we'll discuss its importance later.)
- After that, we write what we want as theme name (in this case, Plywood Colors).
- The theme name cannot have more than 24 bytes (usually, 24 characters).
Let's color our cube, all of it, white, and then select the Blank texture so the cube is entirely white with a white texture.
Bring up again the auxiliary tool menu if you don't have it already up (or if it expired), and click on "Create!" for the new texture theme data.
Save the new output in a notecard named:
Now texture the box so the Default (plywood) texture is set, and the top face is tinted black:
Run again the auxiliary tool, and copy the (web) output in a notecard named:
We have three theme texture notecards, enough for our next important step, so bring up again the auxiliary tool menu:
Hit on the "[DELETE]" option, and confirm. This will delete the auxiliary script from inside the box. We don't need it anymore once we've created all of our notecards.
Now we change in our inventory the permissions for Next Owner of the [Black Tulip] Theme Texture Change v2 script as follows:
- Right click on the script, select "Properties" from the menu.
- Change permissions for Next Owner as the image shows:
Drop the three theme notecards that we've created, then the [Black Tulip] Theme Texture Change v2 ~CFG~ configuration notecard included in your package. Once this notecard is in, we drop the main script into the box. It is important doing it in this order.
If everything is correct, the texture change script will read the configuration notecard and notify once it's finished. From this point on, we can use the texture change script.
Click on the box and select one theme from the options we get on the buttons. The texture changes accordingly to the theme:
What have we learned so far:
- How to create more than one texture theme.
- The fact that we have to drop first the configuration notecard, and after that, the script.
- Selecting themes from the menu.
- Setting up the object.
We're completing this first section by learning how to create themes that will affect only to some faces, but not all of them. This means that the faces not involved will keep their texture on, whichever this is at the moment of selecting the theme that only changes some but not all faces.
Delete the main script and drop again the auxiliary tool in the box.
Let's change the box's texture so:
- The top face is colored red with the Default plywood texture.
- The rest of the faces display the [Black Tulip] Do Not Texture This Side texture, included in your package.
Create a texture theme notecard called:
[BT]:Only Red Top
with the contents of creating this new theme. Delete again the auxiliary tool.
Now drop this notecard in the object, and the main script. Try some texture changes (for example, try "White") and then the theme that only changes the top face to a red color.
What have we learned so far:
- How to create a texture theme that involves only some faces of the object.
- How to work if we need a new theme after we had completed a starting set of themes.
- Theme notecards changing fewer faces require less time to load.
Repeat these steps as many times as necessary, and then let's continue the tutorial in the next section: The auxiliary tool (Now with a table and a chair). Check the [Black Tulip] Test Box included object to see the finished example (This item is inside the [Black Tulip] TTCv2 - Items for Tutorial box/folder).
Step by Step Guide: First important notes
IMPORTANT: When you want to write the t; block, but there's text already that needs to be there.
- If the description field cannot hold more characters (for example, if using UniDoor or KoolDoor), then you can write the t; block in the NAME field of the object.
- If the description field can hold more characters, then use the # character to separate the existing part from your t; block.
- If you're using the NAME field, it is likely that you already have something written in there (like, the name of the object). Go to the end of the name, add a # character, then write your t; block.
- In conclusion: The # character serves as a separator.
IMPORTANT: When you're using the NAME field of the prim for the t; block, you have to click on "Read Name" on the auxiliary tool's menu to make sure that the auxiliary tool reads the name instead of the description. If its output is empty, remember to click on that button. Check also that your prims have t; blocks in descriptions or names.
IMPORTANT: You have to choose if the texture change will read descriptions, or names. This means that if one prim needs to use the name, then all the texture change prims must have the t; block in the NAME. Conversely, if one prim needs to use the description, then all the texture change prims must have the t; block in the DESCRIPTION.
IMPORTANT: If we're reading the name, we have to specify this in the configuration notecard of the script. We see how when we talk about all the notecard parameters.
IMPORTANT: The t; blocks are like this: t;identifierChosenByUs. If you have more than one texture-change prims, each one must have something DIFFERENT as "identifierChosenByUs". For example, t;legs and t;top if we're talking of a table.
Step by Step Guide: The auxiliary tool (Creating submenus)
The configuration notecard: Basic parameters, new number for ADJUST and BUTTON, demo mode for store displays
The basic parameters
- 0 - We get the menu on touch, regardless of the avatar that clicks sitting on the object or not.
- 1 - We never get the menu on touch, we get it through link messages only: for example through a BUTTON or an ADJUST option in AVsitter 2. (The number to send is -31400100)
- 2 - We get the menu on touch if we're not sitting on the object. If we're sitting, then we get it through link messages only (BUTTON or ADJUST in AVsitter 2; the number to send is -31400100).
- 0 - Reads the t; block from the NAME of the object.
- 1 - Reads the t; block from the DESCRIPTION of the object.
This is the access mode the object has by default. The owner can later change this in the [ACCESS] menu. Possible values:
- 0 - Access is open to everybody by default.
- 1 - Access is open only to the owner by default.
- 2 - Access is open to the object's group by default.
If it has no value, the main menu displays a [CLOSE] button on the bottom left corner on the menu. But, if it has a value, the main menu displays a button with a text of our choosing. The line has, thus, the following format:
button = buttonTextInMenu|codeNumber|primNumberTarget|extraText|showMenu and it will send a linked message with this format:
llMessageLinked(primNumberTarget, codeNumber, extraText, id) where id is the UUID of the avatar that got the texture menu. Finally, showMenu is 0 if we don't want to show the texture menu after the special button has been clicked, or 1 if we want to show the texture menu after the special button has been clicked.
Confused by all this? Simply utilize the following line to have a "Back to AVsitter" button in your main menu of the texture change:
button = [^AVsit]|90005|-1||0 (this is the recommended thing to do when clickMode, seen above, has 1 or 2 as value).
IMPORTANT: New number for BUTTON and ADJUST in AVsitter 2
As a consequence of unifying the style of BUTTON/ADJUST numbers through all of the new Black Tulip scripts, this version of the texture change has a NEW value to use in both the BUTTON and ADJUST lines: -31400100
This means that now our BUTTON and ADJUST lines will look like this:
- BUTTON Texture|-31400100
- ADJUST Texture|-31400100
Demo mode for stores
Store owners may want that their items on display go back to a selected texture theme after some time has gone by. This helps in having your store display everything with a consistent theme, not having to worry about the test choices your possible customers will make. The parameters we explain now are to be used only in your store. Your final product doesn't need them and values can be empty.
- 0 - Demo mode is inactive.
- 1 - Demo mode is ACTIVE, and the following parameters take effect.
- demoTime - In here we indicate how many seconds after the texture has been changed, to return to the texture theme we want to show by default. This value has to be at least 60 or it will default to 300 seconds (five minutes).
- demoBaseNC - In here we write the name of the texture theme notecard that we want to be applied after the time specified in demoTime has passed.
Remember: These three parameters are not meant for your final product! These are only for the store/event display items. The final product should have them with empty values.
Step by Step Guide for ADVANCED users
The use of this script consists of three steps:
- Decide which prims will change their texture. Write t;identifier in each prim's description that has the texture, a different identifier for each one. Or, if you're using UniDoor or KoolDoor, write t;identifier in the name of the prim(s) after using a # character as a separator. Again, it is important to write different identifiers in different prims.
- Use the "Create!" button of the auxiliary tool script to get the texture theme. Use "Read Name" to switch between reading the name or the description for t; blocks. Use the "Do not texture this side" to skip faces that should not change their texture in a prim that has SOME faces changing texture. Create a theme notecard per texture theme. They have to be named [BT]:YourTextureThemeName - as you include more : characters in the notecard name, you get your themes sorted into subfolders.
- Change permissions of your script in inventory. Drop the configuration notecard, all the texture theme notecards, and after you have them, drop the main script. Let the configuration notecard to be read and ready to go.
The configuration notecard: Advanced use
The special Color and Alpha menus
We can have only one special Color menu and/or only one special Alpha menu per object. The purpose of these menus is to present with options to either change the color of the object (or some parts), or change the transparency of the object (or some parts).
We set this up using the colorMenu and alphaMenu parameters of the configuration notecard. We specify in here the notecard name of the corresponding submenu with the options that only change color or only change alpha.
This works in conjunction with the Cr. Color and Cr. Alpha of the auxiliary tool. When we click on Cr. Color, the auxiliary tool only outputs the color that the object should have for that specific theme. When we click on Cr. Alpha, the auxiliary tool does the same with the transparency.
Now, this color might be lost when another texture theme is applied, and same happens to the transparency. How can we avoid this? We can avoid this in the texture themes where we want for the color to persist by changing the color field (or the transparency field) to an asterisk * character.
For instance, if our texture theme is this:
We locate the seventh field (empty fields count) and substitute it to an asterisk * character like this:
Similarly happens with the transparency. If we choose to generate themes that only change the transparency, this can be lost when another texture theme is applied. How can we avoid this? Like we do with the color: using an * character, this time on the eighth field.
For instance, if our texture theme is this:
We locate the eighth field (empty fields count) and substitute it to an asterisk * character like this:
And if we want to preserve both color and alpha? Then the texture theme lines would be like this:
Can we do this in an easy way? Yes, by using the Cr. No Color, Cr. No Alpha or the Cr. No C&A buttons of the Auxiliary Tool. Each one creates the appropriate texture theme lines with an asterisk * character in the right place.
Setting the script to work as master or slave in different objects that should coordinate their textures
When we want two (or more) objects changing textures coordinately, we follow the procedure explained next. But first, let's answer this question: when do we want objects changing textures coordinately? For example, when we have a swing. Usually, the legs of the swing are a separate object from the swing itself. But both have wood textures that we may want to coordinate. So this is how we have to proceed.
First, we choose which will be the master object. Swing legs? Swing? Let's suppose we choose the swing as the master object. This means, the swing legs is the slave object. Both objects will have the texture change script included, and they will have notecards with common names for the themes that should coordinate. This means, we need for instance a notecard named [BT]:Dark wood in both the master and the slave. Do this for all the notecards that apply.
Now, in the master object, we set this in the configuration notecard:
listenToChannelObjects = 0 listenWithClick = 0 listenWithClickTime = 0 channelObjects = Your channel number (for example, -123456) setName = Your unique name here (for example, Spring Set 1)
and in the slave object, we set this in the configuration notecard:
listenToChannelObjects = 1 listenWithClick = 0 listenWithClickTime = 0 channelObjects = Your channel number (for example, the same -123456) setName = Your unique name here (for example, the same Spring Set 1)
The difference is this: all the slave objects set listenToChannelObjects to 1, while the master object sets listenToChannelObjects to 0.
IMPORTANT: The master and slave objects must have the same listenToChannelObjects number. They also must have the same setName value. But we can and in fact must use different settings for different sets of objects that we sell.
IMPORTANT: If we're NOT using a master/slave configuration, listenToChannelObjects and listenWithClick must be set to 0. The value of listenWithClick might be different if we're creating a HUD, which is discussed in the corresponding section.
IMPORTANT: When working with a master-slave configuration, all the slave items (even the slave-master we see next) must have the clickMode parameter set to 1.
There's yet another distinction to make that is controlled by one parameter in the notecard. Let's see it with examples.
Suppose we have a pair of earrings and a HUD to change textures/colors/alpha for it. When we click on the color button, a menu shows. Twice. One per earring. We don't want this. We want having just one color menu that changes both. So this means we need a structure like this:
- Master Object: The HUD
- Slave-Master: The earring that will show the color/alpha menu
- Slave-Slave: The earring that will simply apply the texture theme, not showing the menu
Under a setting like this, the Slave-Master object needs that the parameter slaveMaster is set to 1, and the Slave-Slave object needs that the parameter slaveMaster is set to 0.
We have a similar-yet-a-little-different scenario in a swing with separate parts. The structure we need is this:
- Master Object: The swing
- Slave-Slave: The swing legs that will simply apply the texture theme, not showing the menu
We don't have to set slaveMaster if we have a Master-Master object, but the legs of the swing would be a Slave-Slave, so slaveMaster has to be set to 0 in this case.
Working with a control management system
If you work with a control management system, make sure that either in a configuration notecard or in a script you use the value assigned to areaMgmSys in the configuration notecard.
The Poses Add-On (AVsitter 2)
Ever wanted to be able to change the texture of your object when a pose is selected? Now this is possible with the Poses Add-On.
Make sure in the first place that you drop the [Black Tulip] Theme Texture Change v2 - POSES ADDON before you drop any other scripts.
The configuration notecard supports two parameters:
- TexturePose = nameInMenu|textureNotecardToLoad
- TexturePoseDefault = textureNotecardToLoad
The first one, TexturePose, defines what textureNotecardToLoad when the pose nameInMenu is played in AVsitter. Notice the pipe character | used to separate both values.
You can use as many TexturePose lines as you need.
The second one, TexturePoseDefault, defines what textureNotecardToLoad when a pose is selected and it doesn't show in any of the TexturePose lines.
Creating Texture HUDs
Creating a texture HUD is like creating a master/slave setup, the HUD being the master and the object/s being the slave/s. There's a difference, though. The HUD uses the following assets instead of the regular [Black Tulip] Theme Texture Change v2 script and CFG notecard:
- [Black Tulip] Theme Texture Change v2 - HUD SCRIPT
- [Black Tulip] Theme Texture Change v2 - HUD SCRIPT ~CFG~
Those are the only assets the HUD needs to work. Then the slave/s have a regular set up, as we've discussed. The important parameters in the HUD configuration notecard are:
channelObjects = -872342 setName = Your unique name here
which have the same meaning as we saw in the master/slave section, and have to be used the same way. The sample notecard contains some more lines that we will discuss later.
The slave configuration notecard presents a small difference. We can, of course, use these values like in the master/slave section:
listenToChannelObjects = 1 listenWithClick = 0
which means that the slave objects are constantly listening, or we can use these values:
listenToChannelObjects = 0 listenWithClick = 1 listenWithClickTime = 150
which means that the slave objects will start listening only after they're touched, and they will listen for a maximum of listenWithClickTime seconds. After that, they become dormant and will need of a new click to have them listen. This allows us to selectively change textures, for instance.
There is a case where using the listenWithClick setup is not recommended: in small objects like jewelry, for they're difficult to click on. So, as a rule of thumb, set listenWithClick to 0 (and thus, listenToChannelObjects to 1) when the objects are small (jewelry, body adornments), and set listenWithClick to 1 (and thus, listenToChannelObjects to 0) when the objects are normal sized (like furniture, houses, etc.)
Constructing the HUD
The functionality of the HUD is based in this idea: each HUD button is associated to one function: change a texture, show the COLOR menu, show the ALPHA menu, show a text where we link to our social media venues. If we examine the [Black Tulip] TTCv2 - Sample HUD object, we find that the texture buttons have this DESCRIPTION format:
- btnT=[BT]:Top:Dark Brown
- btnT=[BT]:Top:Light Brown
So the DESCRIPTION format is:
btnT=TEXTURE THEME NOTECARD NAME
for the buttons which function is to apply a specific texture theme.
The button that will invoke the COLOR menu has the following DESCRIPTION:
The button that will invoke the TRANSPARENCY (ALPHA) menu has the following DESCRIPTION:
Lastly, we can use as many buttons as we wish with the following format:
This means that the script will read the [Black Tulip] Theme Texture Change v2 - HUD SCRIPT ~CFG~ notecard and look for a line that begins with btnM, which in our example is:
mediaBL = Follow our blog for all our news: www.yourlink.here
So when the corresponding button is clicked, the text "Follow our blog for all our news: www.yourlink.here" will show up in chat for the user eyes only.
IMPORTANT: Don't forget the parameter slaveMaster that was discussed in the previous section. It is vital if the HUD applies to more than one object.
IMPORTANT: Remember that when working with a master-slave configuration, all the slave items (even the slave-master) must have the clickMode parameter set to 1.
This section is for scripters only. It describes the commands you can use with linked messages and llRegionSay commands in order to perform several functions. You need a good understanding of LSL to continue with this section.
Command numbers to be used as linked messages:
- -31400100: Shows up the menu taking the access level into account
- -31400200: When a texture is selected to load from the menu, the following link message is sent:
llMessageLinked(LINK_SET, llGetLinkNumber() ,"-3140020|" + notecardName + "|" + pathToNotecard + "|" + areaMgmSys + "|" + setName, avatarID);
- -31400210: Expects a message with the format areaMgmSys + "|" + notecardToRead and if areaMgmSys coincides with the areaMgmSys parameter defined in the configuration notecard, then it loads the texture in the notecardToRead notecard. It overrides any access settings.
Command numbers to be used as both linked and listen messages (in the channelObjects channel defined in the configuration notecard):
- 800000: Loads a notecard, does not show up menu after loading
- 800001: Changes the notecard path
- 800006: Shows the textures menu in the current path (listen only)
Check the [Black Tulip] TTCv2 - Sample Scripts for API box/folder for examples using the scripting API.
Q: I've added the ADJUST line in AVpos, but the button isn't showing under [ADJUST].
A: First, make sure that you have only one ADJUST line in your AVpos notecard. Use the Search feature for this. If you have one ADJUST line, for instance:
then you need to modify the ADJUST line like, for example:
If your AVsitter 2 doesn't admit this format, it is likely that you're using one of the first versions of AVsitter 2. Update to the latest version to have all of AVsitter's features - including this one.
Q: I've set up everything, but only one prim changes its texture.
A: Make sure that you've given different identifiers to your descriptions/names. Make sure they're consistent, i.e., that it's either all in descriptions, or all in names. They can't be mixed.
Q: I've set up everything, and all prims but a few change their texture.
A: See above. Likely, some prims share identifier.
Q: I've set up everything and when using the texture menu, some (or all) the textures are gray.
A: First, make sure that you're working with a full perms object. If you are, try redoing the themes with a fresh new copy of your object. If this doesn't work, then go to another sim and create the themes in a fresh new copy of your object.
Q: The auxiliary tool's output is empty.
A: Make sure that you've assigned t; blocks to either descriptions or names and that you're using the correct mode (description/name) in the auxiliary tool.
Q: I already have a description/name in this prim, what do I do?
A: Remember, you can separate the description/name in sections by adding a # character and then the t; block.
Q: I have added the textures add-on, but the textures don't change with the poses. What can I do?
A: Likely, the textures add-on was dropped after the texture change script. Reset the texture change script and try again.
If after having followed the directions and checked the troubleshooting list, you have problems making the script work, please click here for the customer service form.