removed useless _ folders
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Solution name="Texture_server_for_XS_Pets">
|
||||
<Project name="Texture_server_for_XS_Pets" path="Texture_server_for_XS_Pets\Texture_server_for_XS_Pets.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,363 @@
|
||||
// :CATEGORY:XS Pet
|
||||
// :NAME:Texture_server_for_XS_Pets
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2012-08-16 11:11:55.200
|
||||
// :EDITED:2013-09-17 21:48:44
|
||||
// :ID:879
|
||||
// :NUM:1239
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Texture Server
|
||||
//
|
||||
An article on how to use this script is located at <a href="http://www.outworldz.com/Secondlife/Posts/Breedable-pet-robot/texture-server.htm">http://www.outworldz.com/Secondlife/Posts/Breedable-pet-robot/texture-server.htm</a>
|
||||
// :CODE:
|
||||
|
||||
|
||||
// Xs_Pets textures by Ferd Frederix
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This code is licensed as Creative Commons Attribution/NonCommercial/Share Alike
|
||||
|
||||
|
||||
|
||||
// See http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||
|
||||
// Noncommercial -- You may not use this work for commercial purposes
|
||||
|
||||
// If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
|
||||
|
||||
// This means that you cannot sell this code but you may share this code.
|
||||
|
||||
// You must attribute authorship to me and leave this notice intact.
|
||||
|
||||
//
|
||||
|
||||
// Exception: I am allowing this script to be sold inside an original build.
|
||||
|
||||
// You are not selling the script, you are selling the build.
|
||||
|
||||
// Ferd Frederix
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////y
|
||||
|
||||
|
||||
|
||||
// You must put any textures you want to send to your pets in the same prim as this server.
|
||||
|
||||
// Colors such as color1 and color2 are stored in the Description of the pet prims. Use the prim Name for the texture name
|
||||
|
||||
//
|
||||
|
||||
// The names must match the following pattern:
|
||||
|
||||
// PrimName N
|
||||
|
||||
// Where PrimName is the name you put in the prim to be textured, and N is a number from 0 to however many sets of skins you have.
|
||||
|
||||
//
|
||||
|
||||
// 2-prime xample: Body 0
|
||||
|
||||
// Head 0
|
||||
|
||||
// Body 1
|
||||
|
||||
// Head 1
|
||||
|
||||
//
|
||||
|
||||
// In this case, there should be two ( or more) prims in the pet whoes prim name is Body or Head
|
||||
|
||||
// So you will end up with two possible breeds for your pets, either the 0th or the 1st textures.
|
||||
|
||||
//
|
||||
|
||||
// If the breedable param Color1.x value (Red coloration) is < 0.5, you get Body 0 and Head 0
|
||||
|
||||
// If the breedable param Color1.x value (Red coloration) is > 0.5, you get Body 1 and Head 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// The pets breed by mixing colors. If a 1.0 (all Red) breeds with a 0.0 (No Red), you get a code near the average, or 0.5.
|
||||
|
||||
// Root prim:
|
||||
|
||||
// There is a special name 'root' for the root prim since your pet could be renamed, whioch would change the name of the root prim..
|
||||
|
||||
// root 0 would be the name to use for the first root prim texture, root 1 for the second, and so on.
|
||||
|
||||
// If your root prim is an invisible prim or is not to be textured, you can ignore this 'root' name.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Deeper example:
|
||||
|
||||
// You have a pet robot with 3 sets of breedable skins, and 4 prims, called 'head'. 'body', 'leg' and 'tail'.
|
||||
|
||||
// You will need 3X4, or 12 textures in all.
|
||||
|
||||
// edit the pet, and change the name of the head to 'head', change the body name to 'body', the left leg to 'leg', and the right leg to 'leg'.
|
||||
|
||||
// each texture must also a single digit after it to represent the breed type:
|
||||
|
||||
// head 0, head 1 and head 2
|
||||
|
||||
// body 0, body 1, and body 2
|
||||
|
||||
// leg 0, leg 1, and leg 2
|
||||
|
||||
// tail 0 , tail 1, and tail 2
|
||||
|
||||
|
||||
|
||||
// you may have up to 254 total textures in the server. In the above example, there are
|
||||
|
||||
// 4 textures per skin set, so you can have 254/4, or 63 skins for your pet.
|
||||
|
||||
|
||||
|
||||
// What about the root prim?
|
||||
|
||||
// The last prim you link to is the root prim. It holds the xs_pet scripts.
|
||||
|
||||
// This prim gets renamed in various objects, so you cannot add a name to the prim that matches a
|
||||
|
||||
// texture. A special texture name 'root 0', 'root 1' etc. is set aside for this prim.
|
||||
|
||||
// Most xs_pets will not need to use the root prim texture, because the root prim is the base of the pet
|
||||
|
||||
// and it usually is made invisible. If your root prim needs to be visible and textured,
|
||||
|
||||
// just add a root 0, root1 and so on texture for each texture set.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
// CONFIGURATION //
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// you must put in a UUID from this web site here and in the brain script
|
||||
|
||||
//http://gridurl.appspot.com/random
|
||||
|
||||
|
||||
|
||||
string UUID = "48246356-a7c5-474b-a6fe-f2cec98926b2";
|
||||
|
||||
integer debug = FALSE; // set to 1 or TRUE for debuging information to the owner
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
// INTERNALS //
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
list textureDB; // texture storage
|
||||
|
||||
integer nTextures; // how many we find
|
||||
|
||||
integer nServed; // how many we served
|
||||
|
||||
integer nPrims ; // how many prims there must be
|
||||
|
||||
integer nBreeds; // how man breeds
|
||||
|
||||
list lNames; // a list of names
|
||||
|
||||
key gtextureUUID; // The UUID of the detected texture
|
||||
|
||||
string gtextureName; // the name of the detected texture
|
||||
|
||||
key URLReq = NULL_KEY;
|
||||
|
||||
string url; // sop we can release HTTP-In keys
|
||||
|
||||
key urlRequestId;
|
||||
|
||||
|
||||
|
||||
request_url()
|
||||
|
||||
{
|
||||
|
||||
llReleaseURL(url);
|
||||
|
||||
url = "";
|
||||
|
||||
|
||||
|
||||
urlRequestId = llRequestURL();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
getImage(integer breedNum, string breedName)
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
DEBUG("Seeking Name " + breedName );
|
||||
|
||||
DEBUG("Seeking Number " + (string) breedNum );
|
||||
|
||||
|
||||
|
||||
integer i;
|
||||
|
||||
integer j = llGetListLength(textureDB);
|
||||
|
||||
for (i = 0; i < j; i += 3)
|
||||
|
||||
{
|
||||
|
||||
integer myBreedParam = llList2Integer(textureDB,i);
|
||||
|
||||
string humanName = llList2String(textureDB,i+1);
|
||||
|
||||
key UUID = llList2Key(textureDB,i+2);
|
||||
|
||||
|
||||
|
||||
if (myBreedParam > breedNum )
|
||||
|
||||
{
|
||||
|
||||
DEBUG("Found it!");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (breedName == humanName)
|
||||
|
||||
{
|
||||
|
||||
gtextureName = humanName;
|
||||
|
||||
gtextureUUID = UUID;;
|
||||
|
||||
DEBUG("saving " + humanName + " " + (string) myBreedParam);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
list ListUnique( list lAll ) {
|
||||
|
||||
integer i;
|
||||
|
||||
list lFiltered = llList2List(lAll, 0, 0);
|
||||
|
||||
integer iAll = llGetListLength( lAll );
|
||||
|
||||
for (i = 1; i < iAll; ++i) {
|
||||
|
||||
if ( llListFindList(lFiltered, llList2List(lAll, i, i) ) == -1 ) {
|
||||
|
||||
lFiltered += llList2List(lAll, i, i);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return lFiltered;
|
||||
|
||||
}
|
||||
|
||||
list parsePostData(string message)
|
||||
|
||||
{
|
||||
|
||||
list postData = [];
|
||||
|
||||
list parsedMessage = llParseString2List(message,["&"],[]);
|
||||
|
||||
integer len = ~llGetListLength(parsedMessage);
|
||||
|
||||
|
||||
|
||||
while(++len) {
|
||||
|
||||
string currentField = llList2String(parsedMessage, len);
|
||||
|
||||
|
||||
|
||||
integer split = llSubStringIndex(currentField,"=");
|
||||
|
||||
if(split == -1) {
|
||||
|
||||
postData += [llUnescapeURL(currentField),""];
|
||||
|
||||
} else {
|
||||
|
||||
postData += [llUnescapeURL(llDeleteSubString(currentField,split,-1)), llUnescapeURL(llDeleteSubString(currentField,0,split))];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return postData ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
getTextures()
|
||||
|
||||
{
|
||||
|
||||
textureDB = [];
|
||||
|
||||
lNames = [];
|
||||
|
||||
|
||||
|
||||
integer j = llGetInventoryNumber(INVENTORY_TEXTURE);
|
||||
|
||||
integer i;
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < j ; i++)
|
||||
|
||||
{
|
||||
@@ -0,0 +1,176 @@
|
||||
// :CATEGORY:XS Pet
|
||||
// :NAME:Texture_server_for_XS_Pets
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2012-08-16 11:11:55.200
|
||||
// :EDITED:2013-09-17 21:48:44
|
||||
// :ID:879
|
||||
// :NUM:1240
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// xs_texture plug
|
||||
//
|
||||
An article on how to use this script is located at <a href="http://www.outworldz.com/Secondlife/Posts/Breedable-pet-robot/texture-server.htm">http://www.outworldz.com/Secondlife/Posts/Breedable-pet-robot/texture-server.htm</a>
|
||||
// :CODE:
|
||||
//xs_texture plug in
|
||||
|
||||
|
||||
|
||||
// 12-3-2012 - no longer dorks with the offset, repeat, or rotation when applying a texture
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This code is licensed as Creative Commons Attribution/NonCommercial/Share Alike
|
||||
|
||||
|
||||
|
||||
// See http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||
|
||||
// Noncommercial -- You may not use this work for commercial purposes
|
||||
|
||||
// If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
|
||||
|
||||
// This means that you cannot sell this code but you may share this code.
|
||||
|
||||
// You must attribute authorship to me and leave this notice intact.
|
||||
|
||||
//
|
||||
|
||||
// Exception: I am allowing this script to be sold inside an original build.
|
||||
|
||||
// You are not selling the script, you are selling the build.
|
||||
|
||||
// Ferd Frederix
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
// CONFIGURATION //
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
// you must put in a UUID from this web site here and in the Server script
|
||||
|
||||
// http://gridurl.appspot.com/random
|
||||
|
||||
|
||||
|
||||
string UUID = "48246356-a7c5-474b-a6fe-f2cec98926b2"; // do not use this number, use your own from http://gridurl.appspot.com/random
|
||||
|
||||
integer debug = FALSE; // set to TRUE to see debug messages
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
// INTERNALS //
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
integer LINK_TEXTURE = 801; // ask for a new texture, or paint a color
|
||||
|
||||
|
||||
|
||||
key URLRqstKey;
|
||||
|
||||
key textureRqstKey;
|
||||
|
||||
string newpath ;
|
||||
|
||||
|
||||
|
||||
// globals to hold the params linked in from the brain
|
||||
|
||||
vector colorCode1;
|
||||
|
||||
vector colorCode2;
|
||||
|
||||
integer sex;
|
||||
|
||||
integer shine;
|
||||
|
||||
float glow;
|
||||
|
||||
float breed;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEBUG(string msg)
|
||||
|
||||
{
|
||||
|
||||
if (debug)
|
||||
|
||||
llOwnerSay(llGetScriptName() + " : " + msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
key Request(string cmd)
|
||||
|
||||
{
|
||||
|
||||
DEBUG("Sending:"+newpath+"?"+cmd);
|
||||
|
||||
return llHTTPRequest( newpath+"?"+cmd, [HTTP_METHOD, "GET"], "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
key TextureRequest()
|
||||
|
||||
{
|
||||
|
||||
string URL = newpath + "?breed=" + llEscapeURL((string) breed) ;
|
||||
|
||||
DEBUG("Sending: "+ URL);
|
||||
|
||||
return llHTTPRequest( URL, [HTTP_METHOD, "POST"], "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// change texture of amny prims named texture1 to texture6
|
||||
|
||||
TextureIt(list textures)
|
||||
|
||||
{
|
||||
|
||||
integer nPrims = llGetNumberOfPrims();
|
||||
|
||||
integer i;
|
||||
|
||||
for (i = 0; i <= nPrims; i++)
|
||||
|
||||
{
|
||||
|
||||
list param = llGetLinkPrimitiveParams(i,[PRIM_NAME]); // name holds the texture number
|
||||
|
||||
string primName = llList2String(param,0);
|
||||
|
||||
|
||||
|
||||
// root is special
|
||||
|
||||
if ( i == 1)
|
||||
|
||||
primName = "root";
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// :CATEGORY:XS Pet
|
||||
// :NAME:Texture_server_for_XS_Pets
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :CREATED:2012-08-16 11:11:55.200
|
||||
// :EDITED:2013-09-17 21:48:44
|
||||
// :ID:879
|
||||
// :NUM:1241
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// test code for texture server. Put this into a set of prims with the pet texture script and touch it. Any prim with the same name as a texture in the server will change to that texture.
|
||||
// :CODE:
|
||||
// test code to make a pet change textures.
|
||||
|
||||
// Just put this in a prim inside the pet, and touch it again and again.
|
||||
|
||||
// The pet should change textures on any prim name that
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This code is licensed as Creative Commons Attribution/NonCommercial/Share Alike
|
||||
|
||||
|
||||
|
||||
// See http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||
|
||||
// Noncommercial -- You may not use this work for commercial purposes
|
||||
|
||||
// If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
|
||||
|
||||
// This means that you cannot sell this code but you may share this code.
|
||||
|
||||
// You must attribute authorship to me and leave this notice intact.
|
||||
|
||||
//
|
||||
|
||||
// Exception: I am allowing this script to be sold inside an original build.
|
||||
|
||||
// You are not selling the script, you are selling the build.
|
||||
|
||||
// Ferd Frederix
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
integer LINK_TEXTURE = 801; // ask for a new texture, or paint a color
|
||||
|
||||
|
||||
|
||||
///////// end global Link constants ////////
|
||||
|
||||
|
||||
|
||||
vector colour1 = <1,1,1>;
|
||||
|
||||
vector colour2 = <0,0,0>;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<Project name="Texture_server_for_XS_Pets" guid="D8D1E3B8-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D8D1E4A3-6C00-1014-B904-200204C60A89">
|
||||
<Script name="Texture_server_for_XS_Pets_1.lsl" guid="D8D233AB-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Texture_server_for_XS_Pets_2.lsl" guid="D8D26179-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Texture_server_for_XS_Pets_3.lsl" guid="D8D27E84-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user