Jump to content
  • 0
Sign in to follow this  
ROMSEY Homewood

llSetTexture Question

Question

6 answers to this question

Recommended Posts

  • 0

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.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...