Difference between revisions of "MLPV2 Texture Changer Add-on"

From Second Life Wiki
Jump to: navigation, search
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
* Back to [[MLPV2_Addons]]
 +
 
* [[MLPV2]]
 
* [[MLPV2]]
 
* [[MLPV2_Color_Changer_Add-on]]
 
* [[MLPV2_Color_Changer_Add-on]]
Line 5: Line 7:
  
  
Simple add on tool for MLPV2 that puts a button on the MLPV2 menu that, when clicked, gives a user a choice of textures for prims in the object with the MLPV2 scripts.
+
Simple add on tool for MLPV2 that puts a button on the MLPV2 menu that sets the texture on any number of prims.  Put several in a menu to give a choice of textures.
(This script won't work for props, only for the prim where the MLPV2 scripts are, and the prims linked to it)
+
  
By Teq Hutchinson, November 2009.  
+
This script won't work for props, only for the prim where the MLPV2 scripts are, and the prims linked to it.
 +
This script should *not* be used for objects with lots of prims that need retexturing.
  
 +
By Teq Hutchinson, November 2009.
 +
Simplified by Lear Cale, March 2011.
  
 
'''Steps to use:'''
 
'''Steps to use:'''
  
#Copy and paste the Main_Script on this page into a script called as you want;
+
#Create a new script in your inventory.  Name it whatever you want, but LC recommends "~~texture".
#Drop this first script into the prim where you have the rest of the MLPV2 scripts;
+
#Drop this script into every prim that you want retexturable;
#Copy and paste the Slave_Script on this page into a script called as you want;
+
#Add the textures you wish to use into each retexturable prim;
#Drop this second script into the  child prims you want to texture with it;
+
#Add lines like the following to a menu in your MLPV2 .MENUITEMS.* notecard(s):
#Add the textures you wish to use into each concerned prims (including root prim if you want);
+
#Add to the menu in an MLPV2 menu notecard the following line(s):
+
  
  LINKMSG Choice1 | 0,-4,987777,Texture1
+
  LINKMSG Choice1 | 0,-1,987777,Texture1
  LINKMSG Choice2 | 0,-4,987777,Texture2
+
  LINKMSG Choice2 | 0,-1,987777,Texture2
 
  ...
 
  ...
  
In the above line, there are two elements for you to customize as appropriate:
+
Each line creates a menu button.  There are two elements for you to customize:
  
 
* Choice1 : the wording that you want to appear for the button on the blue menu.
 
* Choice1 : the wording that you want to appear for the button on the blue menu.
Line 30: Line 32:
  
 
<lsl>
 
<lsl>
// Texture Changer MAIN_SCRIPT
+
// Texture Changer script
//add-on by Teq Hutchinson for MLPV2 by Lear Cale. November 2009.
+
// add-on by Teq Hutchinson for MLPV2. November 2009.
 +
// simplified by Lear Cale, March 2011
  
 
default
 
default
{
+
{  
link_message(integer sender_num, integer num, string str, key id)  
+
    link_message(integer sender_num, integer num, string str, key id)
{
+
    {
          
+
         if (num == 987777 && llGetInventoryType(str) == INVENTORY_TEXTURE)
if (num ==987777 )  
+
        {
 +
            // This will apply your texture to all the sides of the prim
 +
            // SEE https://wiki.secondlife.com/wiki/LlSetTexture if you need something different
  
{
+
            llSetTexture(str, ALL_SIDES);
llMessageLinked( LINK_ALL_OTHERS, 987777, str, "" );
+
        }
if (llGetInventoryType(str)==0) llSetTexture(str, ALL_SIDES);
+
    }
 +
}
 +
</lsl>
  
//THIS WILL APPLY YOUR TEXTURE TO ALL THE SIDES OF THE PRIM
 
//SEE https://wiki.secondlife.com/wiki/LlSetTexture IF YOU NEED SOMETHING DIFFERENT
 
  
}
+
*Here an other script to use UUID texture.
}
+
 
}
+
'''Steps to use are near the same :'''
</lsl>
+
 
 +
# Create a new script in your inventory. Name it whatever you want, but LC recommends "~~texture".
 +
# Drop this script into every prim that you want retexturable;
 +
# Add lines like the following to a menu in your MLPV2 .MENUITEMS.* notecard(s):
 +
 
 +
    LINKMSG nom1 | 0,-1,987777,Texture1
 +
    LINKMSG nom2 | 0,-1,987777,Texture2
  
  
 
<lsl>
 
<lsl>
// Texture Changer SLAVE_SCRIPT
+
// Texture Changer script
//add-on by Teq Hutchinson for MLPV2 by Lear Cale. November 2009.
+
// By Teq Hutchinson, November 2009.
default
+
// Simplified by Lear Cale, March 2011.
{
+
// UUID by Heyter Nitely. June 2014.
link_message(integer sender_num, integer num, string str, key id)
+
{
+
if (num ==987777 && llGetInventoryType(str)==0  ) llSetTexture(str, ALL_SIDES);
+
  
//THIS WILL APPLY YOUR TEXTURE TO ALL THE SIDES OF THE PRIM
+
string texture1 = "f39ca3bf-0058-9cd6-2a56-dd198a992fc0" ;
//SEE https://wiki.secondlife.com/wiki/LlSetTexture IF YOU NEED SOMETHING DIFFERENT
+
string texture2 = "2d56afdf-9541-70b1-0342-820cd826d635" ;
 +
string texture3 = "953a7e95-8cdb-c0f7-d251-996564a7dc67" ;
 +
string texture4 = "1a661817-070d-5f9c-2f00-4d6f0c3e7573" ;
 +
string texture5 = "a9a32bf2-7085-98f2-ab25-ac5c6854bd19" ;
 +
// string texture* = "UUID" ; Add more lines if you want
 +
 +
 +
default
 +
{
 +
    link_message(integer sender_num, integer num, string str, key id)
 +
    {
 +
        if (num == 987777)
 +
        {
 +
            if (str == "nom1")
 +
                llSetTexture(texture1, ALL_SIDES);
 +
            else if (str == "nom2")
 +
                llSetTexture(texture2, ALL_SIDES);
 +
            else if (str == "nom3")
 +
                llSetTexture(texture3, ALL_SIDES);
 +
            else if (str == "nom4")
 +
                llSetTexture(texture4, ALL_SIDES);
 +
            else if (str == "nom5")
 +
                llSetTexture(texture5, ALL_SIDES);//Add lines while you need as string texture. Change "nom*" as you want to show in main MLVP menu. Must be the same that in the note card.
 +
        }
 +
    }
 
}
 
}
}
 
 
 
</lsl>
 
</lsl>
 +
 +
 +
[[Category:MLPV2]]

Latest revision as of 10:55, 25 June 2014


Simple add on tool for MLPV2 that puts a button on the MLPV2 menu that sets the texture on any number of prims. Put several in a menu to give a choice of textures.

This script won't work for props, only for the prim where the MLPV2 scripts are, and the prims linked to it. This script should *not* be used for objects with lots of prims that need retexturing.

By Teq Hutchinson, November 2009. Simplified by Lear Cale, March 2011.

Steps to use:

  1. Create a new script in your inventory. Name it whatever you want, but LC recommends "~~texture".
  2. Drop this script into every prim that you want retexturable;
  3. Add the textures you wish to use into each retexturable prim;
  4. Add lines like the following to a menu in your MLPV2 .MENUITEMS.* notecard(s):
LINKMSG Choice1 | 0,-1,987777,Texture1
LINKMSG Choice2 | 0,-1,987777,Texture2
...

Each line creates a menu button. There are two elements for you to customize:

  • Choice1 : the wording that you want to appear for the button on the blue menu.
  • Texture1 :the name (case and spacing sensitive) of the texture you need to use.

<lsl> // Texture Changer script // add-on by Teq Hutchinson for MLPV2. November 2009. // simplified by Lear Cale, March 2011

default {

   link_message(integer sender_num, integer num, string str, key id)
   {
       if (num == 987777 && llGetInventoryType(str) == INVENTORY_TEXTURE)
       {
           // This will apply your texture to all the sides of the prim
           // SEE https://wiki.secondlife.com/wiki/LlSetTexture if you need something different
           llSetTexture(str, ALL_SIDES);
       }
   }

} </lsl>


  • Here an other script to use UUID texture.

Steps to use are near the same :

  1. Create a new script in your inventory. Name it whatever you want, but LC recommends "~~texture".
  2. Drop this script into every prim that you want retexturable;
  3. Add lines like the following to a menu in your MLPV2 .MENUITEMS.* notecard(s):
   LINKMSG nom1 | 0,-1,987777,Texture1
   LINKMSG nom2 | 0,-1,987777,Texture2


<lsl> // Texture Changer script // By Teq Hutchinson, November 2009. // Simplified by Lear Cale, March 2011. // UUID by Heyter Nitely. June 2014.

string texture1 = "f39ca3bf-0058-9cd6-2a56-dd198a992fc0" ; string texture2 = "2d56afdf-9541-70b1-0342-820cd826d635" ; string texture3 = "953a7e95-8cdb-c0f7-d251-996564a7dc67" ; string texture4 = "1a661817-070d-5f9c-2f00-4d6f0c3e7573" ; string texture5 = "a9a32bf2-7085-98f2-ab25-ac5c6854bd19" ; // string texture* = "UUID" ; Add more lines if you want


default {

   link_message(integer sender_num, integer num, string str, key id)
   {
       if (num == 987777)
       {
           if (str == "nom1")
               llSetTexture(texture1, ALL_SIDES);
           else if (str == "nom2")
               llSetTexture(texture2, ALL_SIDES);
           else if (str == "nom3")
               llSetTexture(texture3, ALL_SIDES);
           else if (str == "nom4")
               llSetTexture(texture4, ALL_SIDES);
           else if (str == "nom5")
               llSetTexture(texture5, ALL_SIDES);//Add lines while you need as string texture. Change "nom*" as you want to show in main MLVP menu. Must be the same that in the note card.
       }
   }

} </lsl>