|
Beatrice Honey
Registered User
Join date: 5 Jul 2005
Posts: 51
|
02-14-2006 11:04
Can anyone tell a non-scripter (me) how to modify a texture changer script so the textures change on touch in an ordered fashion, instead of the random changing going on now? Here's the script I'm using: default { touch_start(integer total_number) { integer number = llGetInventoryNumber(INVENTORY_TEXTURE); float rand = llFrand(number); integer choice = (integer)rand; string name = llGetInventoryName(INVENTORY_TEXTURE, choice); if (name != "" llSetTexture(name, ALL_SIDES); } } and i have my textures labelled 1-12 . I know there's a really easy answer to this, but I'm just not seeing it  . Thanks for your help!
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
02-14-2006 11:39
So your texture files have names 1, 2, ... 12? // Change this line if you change the number of textures integer numTextures = 12;
integer index = 1;
default { touch_start(integer total_number) { llSetTexture((string)index, ALL_SIDES);
index++; if (index > numTextures) index = 1; } }
That should hopefully do it.
|
|
Beatrice Honey
Registered User
Join date: 5 Jul 2005
Posts: 51
|
Thanks!
02-14-2006 12:03
That absolutely did do it, thank you so much Ziggy 
|
|
Kitsura Katsu
Registered User
Join date: 17 Jun 2006
Posts: 5
|
Another non-scriptor (me)
08-06-2006 08:36
I tried this script out and it works great.
How do I set it up so only the owner can change the textures.
Also, I am linking up to 12 objects together and would like them all to change texture at the same time.
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
08-06-2006 08:54
From: Kitsura Katsu How do I set it up so only the owner can change the textures. Add a line right at the beginning of touch() event. touch_start(integer total_number) { if( llDetectedKey(0) != llGetOwner() ) return;
// things to do on touch go here }
To change textures on multiple prims at once you'll unfortunately need a script in each of the prims, and coordinate them with link messages or something to that effect...
|