Cycling Textures - by touch
|
Goodwrench Grayson
Classic Gaming Nut
Join date: 18 Jun 2004
Posts: 223
|
08-24-2004 19:07
I would like to find a way to cycle textures on an object face, but not the cycle-every-2-seconds route. I'd like to make this a sort of virtual book where every click moves forward a texture. If this sounds easy (which it probably does for you LSL-gurus), then I'd love to add one other feature: creating a timer that returns the book to it's cover/default page after, say, 5 minutes of inactivity in flipping pages. I have been using the following script (certainly not written by me; I'm not sure whom) to cycle textures every X seconds: default { state_entry() { llSetTimerEvent(7.5); } 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, 0); } } } Any help for this LSL-invalid is greatly appreciated. 
_____________________
We used to remember our Roots at The Mushroom Kingdom - memorial can be found at Davenport 200, 150 Section 8 Server - my home on the web
|
Davo Greenstein
Dag from Oz
Join date: 22 Dec 2003
Posts: 150
|
08-24-2004 19:20
I want this too..
For use on Backdrops of snapshots where I click and click till I have a backdrop that matches the colors and style I want...
Does anyone have this kinda script ?
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
08-24-2004 19:35
default { touch_start(integer num_detected) { integer number = llGetInventoryNumber(INVENTORY_TEXTURE); if (number > 0) { float rand = llFrand(number); integer choice = (integer)rand; string name = llGetInventoryName(INVENTORY_TEXTURE, choice); llSetTexture(name, 0); } }
Try that. I just reused that script in another event.
_____________________
</sarcasm>
|
Davo Greenstein
Dag from Oz
Join date: 22 Dec 2003
Posts: 150
|
08-24-2004 19:46
Does that move to random texture from contents ?
I'm after one that moves thu in order
and also preferable has an option of floating text of the texture name
LOL
I dont want much eh
|
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
|
08-24-2004 19:57
Here's a script that will cycle through the textures in the prim's inventory in order when you touch them. Not sure if it's exactly what you're after, if not I have a few more advanced ones, just let me know. //Change Texture on Click //By Rysidian Rubio.
//--DESCRIPTION--
//This script will display a texture from the object's inventory onto a face (or faces) of the prim. //when you click the prim the texture will change to the next texture in the inventory.
//global variables integer texture_total; //don't change integer texture_num = 0; //don't change integer side = 1; //***number of the the side of the prim to show the texture, use ALL_SIDES for all sides of the prim
//function to count textures in inventory get_textures() { texture_total = llGetInventoryNumber(INVENTORY_TEXTURE); }
//function to reset texture to first texture in inventory reset_textures() { get_textures(); texture_num = 0; llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, texture_num), side); }
//function which displays the next texture in the inventory. next_texture() { if (texture_num == texture_total) { texture_num = 0; } else { texture_num += 1; } llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, texture_num), side); }
default { state_entry() { reset_textures(); llAllowInventoryDrop(TRUE); }
touch_start(integer total_number) { next_texture(); }
changed(integer change) { if (change & CHANGED_INVENTORY) { reset_textures(); } }
on_rez(integer start_param) { llResetScript(); }
}
|
Davo Greenstein
Dag from Oz
Join date: 22 Dec 2003
Posts: 150
|
08-24-2004 20:14
Kewl Rhys
Aussie Aussie Aussie
LOL
|
Goodwrench Grayson
Classic Gaming Nut
Join date: 18 Jun 2004
Posts: 223
|
08-24-2004 22:10
I've said it before and I'll say it again: You SL people rock.  That script works perfectly for my Rysidian!
_____________________
We used to remember our Roots at The Mushroom Kingdom - memorial can be found at Davenport 200, 150 Section 8 Server - my home on the web
|
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
|
08-25-2004 18:09
Oi Oi Oi!
Your Rysidian? I thought I was the only one? lol.
|
Tyler Rocco
The awakened
Join date: 8 Feb 2005
Posts: 69
|
06-02-2005 02:50
one problem with this...I get this error when it gets to the last texture.
Object: Couldn't find texture
_____________________
Some say the end is near. Some say we'll see armageddon soon. I certainly hope we will cuz I sure could use a vacation from this
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
06-02-2005 09:59
From: Tyler Rocco one problem with this...I get this error when it gets to the last texture. Try replacing the line "if (texture_num == texture_total)" with "if (texture_num == texture_total - 1)".
|
bargain Walcott
Registered User
Join date: 31 Oct 2005
Posts: 248
|
04-02-2006 19:55
I'm a little lost here. I don't see where the timer funtion was ever introduced into the script? So as to return to the 1st texture or a specific texture after so long of inactivity.
|