Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture auto cycle with on and off goup access only

Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
10-28-2007 11:08
Could someone pls help me out I want to have a texture change every 30 seconds on touch and then when I touch it again have to turn off and default to a certain texture that i can set threw script and stop the auto cycle. with group access only...

Here is one that I have that auto switches but doesnt turn off and default to certain texture on touch. sorry for the newbe questions...

//code//
float time = 30;
integer total;
integer counter;

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "";)
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
timer()
{
next();
}
}
//end of code//
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-28-2007 12:33
Here is the first part for you to work with:

CODE

integer auto = FALSE;
float time = 30;
integer total;
integer counter;
string default_texture = "enter texture name here";

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
touch_start(integer total_number)
{
if(auto == TRUE)
{
next();
llSetTimerEvent(time);
auto = FALSE;
}
else
{
llSetTexture(default_texture, ALL_SIDES);
llSetTimerEvent(0.0);
auto = TRUE;
}
}
timer()
{
next();
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-28-2007 12:54
and with the group test:

CODE

integer auto = FALSE;
float time = 3;
integer total;
integer counter;
string default_texture = "enter texture name here";

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
touch_start(integer total_number)
{
if(llSameGroup(llDetectedKey(0)) == TRUE)
{
if(auto == TRUE)
{
next();
llSetTimerEvent(time);
auto = FALSE;
}
else
{
llSetTexture(default_texture, ALL_SIDES);
llSetTimerEvent(0.0);
auto = TRUE;
}
}
}
timer()
{
next();
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-28-2007 13:03
oooops I am making the simulator do twice the work:

if(llSameGroup(llDetectedKey(0)) == TRUE)

should be :

if(llDetectedGroup(0) == TRUE)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
thank you
10-28-2007 13:07
Thank you so much smiles....
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
10-29-2007 16:02
is there any way of adding a delay on the touch start to help with accidentally starting it? Thank you for your help already...smiles
Jenna Etzel
Registered User
Join date: 15 Mar 2007
Posts: 1
Cant seem to get it to work anyone?
10-30-2007 19:11
trying to add a touch delay on start to prevent accidentally touching the object...

CODE

integer auto = FALSE;
float time = 20;
integer total;
integer counter;
string default_texture = "1";

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
touch_start(integer total_number)
{
if(llDetectedGroup(0) == TRUE)
{
if(auto == TRUE)
{
next();
llSetTimerEvent(time);
}
timer()
{
time = time + 0.1;
}
touch_end(integer num_detected)

auto = FALSE;
}
else
{
llSetTexture(default_texture, ALL_SIDES);
llSetTimerEvent(0.0);
auto = TRUE;
}
}
}
timer()
{
next();
}
}
CODE
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
still trying anyone?
10-30-2007 19:21
still trying to add a touch delay on touch to help with accidentally touching opject
CODE

integer auto = FALSE;
float time = 20;
integer total;
integer counter;
string default_texture = "1";

next()
{
string name = llGetInventoryName(INVENTORY_TEXTURE,counter);
if(name == "")
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
counter = 0;
if(total < 1)
return;
else
name = llGetInventoryName(INVENTORY_TEXTURE,counter);
}
else if(counter + 1 >= total)
total = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetTexture(name ,ALL_SIDES);
if(total)
counter = (counter + 1) % total;
}

default
{
state_entry()
{
total = llGetInventoryNumber(INVENTORY_TEXTURE);
next();
llSetTimerEvent(time);
}
touch_start(integer total_number)
{
if(llDetectedGroup(0) == TRUE)
{
if(auto == TRUE)
{
next();
llSetTimerEvent(time);
}
timer()
{
time = time + 0.1;
}
touch_end(integer num_detected)

auto = FALSE;
}
else
{
llSetTexture(default_texture, ALL_SIDES);
llSetTimerEvent(0.0);
auto = TRUE;
}
}
}
timer()
{
next();
}
}
CODE
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-30-2007 19:42
From: Cordax Martinek
is there any way of adding a delay on the touch start to help with accidentally starting it? Thank you for your help already...smiles

If you add a delay on touch start to stop from accidently touching it then if you touch it....... Well it will still have been touched and all the delay will do is delay what touch does.

If you accidently touch it then just touch it again.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
came out wrong...
10-31-2007 07:00
is there anyway to have it not start on touch at all unless its held in for aleast 3 seconds to start the touch event... A delay was the wrong question.... sorry.....
Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
10-31-2007 08:41
My press and hold texture cycling script does most of this; might be easier to modify my code though then try to copy parts of it to this script.

/54/85/176343/1.html
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
still trying
11-06-2007 08:03
still cant seem to put all of the funtions together and get it to work...
can anyone pls help me out pls... I am new to scripting and slowly learing...