Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Timmer

Watch Coats
Registered User
Join date: 22 Aug 2006
Posts: 23
07-06-2008 05:47
Hi i want to make somthing rez when tuched after x amount of time , and then once it has been touched have to wait for time x again to work. at the moment i trying this
float gap = 10.0;
float counter = 5.0;

default
{
state_entry()
{
// Activate the timer listener every 2 seconds
llSetTimerEvent(gap);
}

touch_start(integer param)
{
llRezObject("watch 1", llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
}
}


but i cant get it to work , could anyone point me in the right direction or tell me where i might get a script to do this?
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
07-06-2008 06:19
You need a timer() event handler, which is executed every interval set by llSetTimerEvent.
Watch Coats
Registered User
Join date: 22 Aug 2006
Posts: 23
07-06-2008 06:34
wont that make the object rez after x amount of time , i want it the ability to rez it after x amount of time by tuching it and then having to wait x amount of time.

so tuch
wait time x
then can tuch to rez whenever but once tuched
wait x amount of time

so its like a charging up script
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
07-06-2008 07:34
I think this is what your looking for:

From: someone

float gap = 10.0;
integer touched;

default
{
state_entry()
{
touched = TRUE;
llSetTimerEvent(gap);
}
touch_start(integer total_number)
{
if (!touched) {
llRezObject("watch 1", llGetPos() + <0.0,0.0,1.0>, ZERO_VECTOR, ZERO_ROTATION, 42);
touched = TRUE;
llSetTimerEvent(0);
llSetTimerEvent(gap);
}
}
timer()
{
touched = FALSE;
}
}
Watch Coats
Registered User
Join date: 22 Aug 2006
Posts: 23
07-06-2008 07:46
yes , thats it ,thanks
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-06-2008 16:29
While this appears to be acceptable to the OP, it doesn't quite meet the stated requirements. You might want a llSleep() before the llRezObject() in the 'touch_start' event handler to induce the first wait time.
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
07-07-2008 02:34
Here is a slightly different approach:

From: someone

float Delay = 10.0;
integer Frozen;

default
{
state_entry()
{
Frozen = FALSE;
}

touch_start(integer total)
{
if (Frozen) { return; }
else { Frozen = TRUE; }
llSetTimerEvent(Delay);
}

timer()
{
llSetTimerEvent(0.0);
llRezObject("watch 1", llGetPos() + <0.0,0.0,1.0>, ZERO_VECTOR, ZERO_ROTATION, 42);
} // ** You can remove those lines...

object_rez(key id) // ** if you don't need to do anything...
{ // ** with the rezzed object.
Frozen = FALSE;
}
}


This way, it will always rez 'Delay' seconds after the touch, whenever the touch happens.