Menu

Saving money on uploading fees with a simple color changing HUD



This is basically my first Thread (not counting the Introduction one XD ) so not even sure if I am in the right category posting this…
Ok, so, I just wanted to share my way of adding textures to the uploaded things in SL, which I dowloaded here
Basically all you need is:

  • to be able to create anything in SL, simple box works perfectly,
  • have the UUID of the textures (which 99% of people here put in the name of the texture-and thank you for that!),
  • and 2 simple scripts which I’ll give here.

Basically you’re making a Color changing HUD… script is different depending on how many textures there are for how many faces… 
So first thing is when you upload your item, you put a color changing script inside it:

  • If its one texture for whole object then you put this code inside the object:
Code:
integer ch=123456789;//Change in a unique number to prevent silly things happening around you
//nothing else needs to be changed, very simple

default

state_entry()

llListen(ch,"",NULL_KEY,"");

listen(integer channel, string name, key id, string msg)

if (llGetOwner() == llGetOwnerKey(id))

llSetTexture(llGetSubString(msg,0,-1),ALL_SIDES);

After that you  have to create something, anything, a simple box is just perfect, and add this script inside, making sure the “integer ch=” is the same as in the script inside the uploaded object:

Code:
integer ch=123456789;  // Channel number, must be the same in the main script.

default
    
    touch_start(integer total_number)
   
           llSay(ch,"db87c13b-7ef1-84cc-9776-72b5fc0d5e1e"); //Paste the UUID of the texture between the ""
            
     

Now all that is left is click the box you created and it’ll change the texture of the uploaded object Smile

  • If its more textures for the object, each texture must go to the other Face and you have the info which face it goes to then its easy, if you don’t know for which exact face it is, I suggest you chenge the objects texture with the ones you have by clicking on its texture (mostly white if no other texture assigned ot it) and then clicking the check circle in front “Local” and then you just click Add and add the textures you have to play around and figure out where what goes… 

Anyway, I have a habit of blabbering, this code, of course with your modifications regarding Faces and Textures, goes into the uploaded object:

Code:
integer ch=1234567890;//Channel number. Change in a unique number to prevent silly things happening around you.

default

state_entry()

llListen(ch,"",NULL_KEY,"");

listen(integer channel, string name, key id, string msg)

if (llGetOwner() == llGetOwnerKey(id))

if (msg == "black") //give a name to the texture set in the HUD and write it here so the Script knows what colors you want

llSetTexture("225e9f2c-b2c5-842c-9219-91949255865a", 1); // number 1 and 0 in these two lines represent Face numbers
llSetTexture("a22ae443-2f88-5315-3b92-5655df98a04e", 0);

if (msg == "red")

llSetTexture("2dc7ac2e-8225-da14-95da-7c7bdcec4cef", 1);
llSetTexture("706f8791-8829-acc8-54a0-831497b6a34b", 0);
//I wrote here and exaple for two faces, 0 and 1, but you can add these how many you need

And again, you create a HUD with this next script…and of course, a new script for each color has to go into another created object because clicking activates the color changing… here is one example:

Code:
integer ch=1234567890; // Channel number, must be the same in the main script

default

touch_start(integer total_number)

llSay(ch,"white"); //give the color a name here and use it in main script where you add the texture UUIDs
//in another object you add this script for a new color, and give it a new name by replacing the word white, aka you writing it between the ""



Download from Source link