Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do you pause?

Eshnah Neox
Registered User
Join date: 24 Jul 2009
Posts: 1
07-30-2009 23:15
I'm making a new script for my recruiter object
I need to put a pause of about 3 seconds between the actions in said script
I'm a total noob scriptwriter so I have no idea how how to do this
Can someone help me please?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
07-30-2009 23:25
llSleep sounds like what you need, but just to warn you, that's exactly what it does, so the script can't do anything at all during that pause
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
07-31-2009 09:23
Like Ruthven says...

Another approach is to use llSetTimer(3). This will cause a timer() event to trigger 3 seconds in the future. In this case, you could allow *some* operations of the script to proceed, but skip the ones that you want to "pause". I guess in this case you mght also have a global flag that you set while pausing.

Rough outline...from memory, untested,
CODE

int pausing = FALSE;

pause(float t)
{
pausing = TRUE;
llSetTimerEvent( t );
}

...snip...

if ( !pausing ) { do stuff here};

...snip...

pause( 3 );

... while pausing, the stuff won't happen...

timer()
{
pausing = FALSE;
llSetTimerEvent(0); // turns off timer
}
{\CODE]
_____________________
So many monkeys, so little Shakespeare.
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
07-31-2009 09:46
Sorta similar, you can also do something like this..

CODE

integer gStep = 0;

default
{
listen or touch or collide or whatever your trigger is()
{
llSetTimerEvent (3.0);
}

timer()
{
gStep++;

if (gStep == 1)
{

}
else if (gStep == 2)
{

}
else if (gStep == 3)
{

}
.
.
}
}
CODE
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Gypsy Paz
Registered User
Join date: 28 Dec 2005
Posts: 17
07-31-2009 15:47
another approach would be to use a pause state and a timer, it is very efficient but could be a tad more complicated because you have to handle the state_entry() event properly.

default{}
some_event(){
state pause;
}
}

state pause{
state_entry(){
llSetTimerEvent(3);
}

timer(){
llSetTimerEvent(0);
state default;
}
}