|
Patience Sands
Registered User
Join date: 18 Apr 2007
Posts: 4
|
12-02-2007 03:36
I apologise for the newb-ness of this question, but i have never played with a script before and this is important to me, I want to use the TextureSwitch - Touch script, bit it changes the textures in random order and i want to change it so they show in the order I have titled them (1 to 12) What do I have to change to do that? 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); } } I know its very simple......if you know how Thanks
|
|
Adelle Fitzgerald
Trying...very very trying
Join date: 6 Jan 2007
Posts: 17
|
12-02-2007 04:25
What you need to do is make a counter, so each time the object is touched it increments until it gets to 12, then reset the counter. The script below should do the trick. The first part defines the counter, then sets the texture to the counter (1). When the object is touched it increments the counter and displays teh corresponding texture, provided the textures are named 1-12. When the counter reaches 12 and is touched again it would normally goto 13, but if the counter is greater than 12 it resets it to 1, and so on. Hope this helps  integer counter;
default { state_entry() { counter = 1; llSetTexture((string)counter, ALL_SIDES); }
touch_start(integer total_number) { counter +=1; if (counter > 12) { counter = 1; } llSetTexture((string)counter, ALL_SIDES); } }
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
a little late
12-02-2007 04:44
integer vgIntTextureCount; integer vgIntCurrentPic;
default{ state_entry(){ //-- give a few seconds to add/remove textures llSetTimerEvent( 5.0 ); }
touch_start(integer total_number){ //-- cycle through available textures if (++vgIntCurrentPic >= vgIntTextureCount){ vgIntCurrentPic = 0; } llSetTexture(llGetInventoryName( INVENTORY_TEXTURE, vgIntCurrentPic ), ALL_SIDES); }
timer(){ //-- check to see how many textures there are vgIntTextureCount = llGetInventoryNumber( INVENTORY_TEXTURE ); }
changed( integer vBitChanges ){ if (vBitChanges & CHANGED_INVENTORY){ //-- wait a few seconds if inventory changes before setting number of availabe textures llSetTimerEvent( 5.0 ); } } }
EDIT: got caught up in other things while editing so I got beat to the finish, this version doesn't care what you name the textures in inventory, and will automatically adjust if you add or remove some
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Patience Sands
Registered User
Join date: 18 Apr 2007
Posts: 4
|
12-02-2007 05:35
Thank you both very much, hopefully my christmas gift will work properly now
|