ROMSEY Homewood Posted April 10, 2011 Share Posted April 10, 2011 Hi GuysQuick Q for U!i want to set texture but not on ALL_SIDES just selected faces of a spiral (tube) here's what i got:-default{ state_entry() { llSetTimerEvent(0.2); } timer() { integer number = llGetInventoryNumber(INVENTORY_TEXTURE); if (number > 0) { float rand = llFrand(number); integer choice = (integer)rand; string name = llGetInventoryName(INVENTORY_TEXTURE, choice); llSetTexture(name, ALL_SIDES); } }}Any ideas? Ty in advance Link to comment Share on other sites More sharing options...
0 Cinnamon Lohner Posted April 10, 2011 Share Posted April 10, 2011 Just replace ALL_SIDES with the face number of side you wish to retexture EXAMPLE: llSetTexture(name, 1); --Cinn http://wiki.secondlife.com/wiki/LlSetTexture Link to comment Share on other sites More sharing options...
0 Pauline Darkfury Posted April 11, 2011 Share Posted April 11, 2011 Cinn has already answered the basic question, but a couple of observations on your script. A 0.2s timer for changing textures is really very short and is not going to give the textures enough time to load for people looking at it (they will likely see just grey for a while, until they have all of the textures cached). If there's a large set of textures in there, this is going to cause rather a lot of lag. Without knowing exactly what you're trying to achieve here, it's difficult to recommend alternatives, but you should maybe look at having many images tiled within a single texture and using either texture animation or just changing the offset of the texture to achieve the random effect. Since it's on a very short timer, replacing "float rand = llFrand(number); integer choice = (integer)rand;" with just "integer choice = (integer)llFrand(number);" will be more efficient, and similarly, not storing the name of the texture in a variable may give a small gain. So, joining all that together, the following should be approx the lowest cost way of doing it: llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (integer)llFrand(number)), ALL_SIDES); Beyond that, it would be more efficient to store the number of textures in a global variable and set that number in state_entry, optionally adding a changed event to update it on CHANGED_INVENTORY. 1 Link to comment Share on other sites More sharing options...
0 PeterCanessa Oh Posted April 11, 2011 Share Posted April 11, 2011 Not only is a 0.2s timer fast, it's too fast for llSetTexture(), which itself delays the script by 0.2s. That means any delay in executing the instruction caused by, for instance, the rest of the processing :smileywink: and the timer will be firing again before the script is ready to handle another event. Add a laggy sim and processor-hogging scripts and your event-queue is going to be permanently full. You may wish to post similar threads in the Scripting forum, you'll get more details there. Personally, I'd love to know WHY you want to change a texture this quickly without using anim. Link to comment Share on other sites More sharing options...
0 ROMSEY Homewood Posted April 11, 2011 Author Share Posted April 11, 2011 TY! Kudos to you all... Link to comment Share on other sites More sharing options...
0 ROMSEY Homewood Posted April 11, 2011 Author Share Posted April 11, 2011 Ty! Kudos to you all! The script is for a flashing bulb effect on on a spiral (tube) rail running down a Helter Skelter, used low rez alpha tex's plus a 300 repeat tex script...seems to work very well, i wanted to get rid of the tex on the 3rd face underneath (which you end up with the spiral effect of the mega prim - a sort of triangular spiral). Helter Skelter will be on show on Lesters Best sim. Link to comment Share on other sites More sharing options...
0 ROMSEY Homewood Posted April 11, 2011 Author Share Posted April 11, 2011 SUPER! Ty for your help Link to comment Share on other sites More sharing options...
Question
ROMSEY Homewood
Hi Guys
Quick Q for U!
i want to set texture but not on ALL_SIDES just selected faces of a spiral (tube) here's what i got:-
default
{
state_entry()
{
llSetTimerEvent(0.2);
}
timer()
{
integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
if (number > 0)
{
float rand = llFrand(number);
integer choice = (integer)rand;
string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
llSetTexture(name, ALL_SIDES);
}
}
}
Any ideas?
Ty in advance
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now