Jump to content
  • 0

llSetTexture Question


You are about to reply to a thread that has been inactive for 3526 days.

Please take a moment to consider if this thread is worth bumping.

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
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.

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.

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3526 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...